Hi all! You know if there is a way to use pulumi i...
# general
c
Hi all! You know if there is a way to use pulumi in a stateless mode?
d
Doo you mean to manage resources that should always be run/created, or to always resolve against infrastructure without a state file?
c
I mean to create resource without saving the state, in order to manually manage then those resources
d
You could create resources, then discard the state. You won't be able to use pulumi to update afterwards, however.
If you know what parts will be manually managed, you can use
ignoreChanges
on those fields
c
Is there a specific documented way for discard the state? Or I can simply delete the state? Many thanks @dry-keyboard-94795!
d
c
uhm I meant how to discard the state without delete all created resources - associated with the stack
d
If you remove a resource from state, it'll try recreating again on your next up
If you're adding a resource in code, then deleting the code, you can use
retainOnDelete
to keep the resource in your infrastructure: https://www.pulumi.com/docs/concepts/options/retainondelete/
What's the usecase? Can you share more details beyond wanting to create in pulumi then manage outside (ie, what resources, any limitations)?
c
The use case it's simply to use Pulumi only for delivery infrastructure (on-shot) and not for manage it lately. For example: Some final customers don't want to use IaC for infra management, but want to use IaC just for delivery
Now they use directly CSP API cli to do that.. instead of pulumi.. for that reason
d
In that situation, I'd have a stack per customer, then remove the stack state for whatever customer wants to opt out of IaC management
c
Yeah, and the right way to do so is to use retainOnDelete and do a pulumi destroy?
d
I sent the wrong command before, it'd be this one: https://www.pulumi.com/docs/cli/commands/pulumi_stack_rm/
Which deletes the stack without deleting the resources in infrastructure
What you should end up with is a Project, with a stack per customer. The customers that want IaC management remain, the customers that don't get ejected with
stack rm --force
If there are resources in the stack that you still need to manage via pulumi, they should be moved to a different project so that there's a clean divide between "customer managed" and "managed by you"
c
Nice, got it! many thanks Anthony!
s
if you dont want use stateful IAC you could use Ansible
d
In my experience, ansible isn't a very good tool for infrastructure; though great for provisioning purposes. A large part is its inability to track what's already there (so updates are problematic, requiring constant workarounds), and the other being not great support for infra related tasks as people don't use it for that normally.
s
its pretty terrible but its stateless as long as your destination supports ssh and python.
I like the yaml syntax. I would like it if yaml format for IAC was more popular.
d
Pulumi has yaml support, though I've never played with it. Perhaps because I've been burned by terraform (advanced usecases) + cloudformation/whatever azure uses for any case 😉
s
I played with it but the support for the big libraries I need was lacking
I am always certain that orgs using azure have no idea what they are doing.
its my insta job req ignore.