https://pulumi.com logo
#general
Title
# general
c

calm-waiter-87397

11/16/2023, 10:20 AM
Hi all! You know if there is a way to use pulumi in a stateless mode?
d

dry-keyboard-94795

11/16/2023, 10:21 AM
Doo you mean to manage resources that should always be run/created, or to always resolve against infrastructure without a state file?
c

calm-waiter-87397

11/16/2023, 10:25 AM
I mean to create resource without saving the state, in order to manually manage then those resources
d

dry-keyboard-94795

11/16/2023, 10:27 AM
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

calm-waiter-87397

11/16/2023, 10:38 AM
Is there a specific documented way for discard the state? Or I can simply delete the state? Many thanks @dry-keyboard-94795!
d

dry-keyboard-94795

11/16/2023, 11:13 AM
c

calm-waiter-87397

11/16/2023, 11:27 AM
uhm I meant how to discard the state without delete all created resources - associated with the stack
d

dry-keyboard-94795

11/16/2023, 11:28 AM
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

calm-waiter-87397

11/16/2023, 12:31 PM
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

dry-keyboard-94795

11/16/2023, 12:33 PM
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

calm-waiter-87397

11/16/2023, 12:35 PM
Yeah, and the right way to do so is to use retainOnDelete and do a pulumi destroy?
d

dry-keyboard-94795

11/16/2023, 12:36 PM
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

calm-waiter-87397

11/16/2023, 1:03 PM
Nice, got it! many thanks Anthony!
s

stale-answer-34162

11/16/2023, 2:48 PM
if you dont want use stateful IAC you could use Ansible
d

dry-keyboard-94795

11/16/2023, 3:10 PM
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

stale-answer-34162

11/16/2023, 3:12 PM
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

dry-keyboard-94795

11/16/2023, 3:14 PM
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

stale-answer-34162

11/16/2023, 3:15 PM
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.