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

lemon-ambulance-1111

12/11/2023, 2:09 PM
I am running ansible playbooks and ec2 creation in pulumi single shot. In 1st phase i am running some of the playbooks.i comment the 1st phase command.local.command after some time using the same stack i am running remaining 2nd phase playbooks. when i give pulumi up 1st phase playbooks are getting deleted. is there a way not to delete the 1st phase playbook and run the 2nd phase playbook
d

dry-keyboard-94795

12/11/2023, 3:08 PM
You shouldn't need to comment out the first Command resource, pulumi will only run it once provided the inputs don't change. Commenting it out is expected to delete the resource
l

lemon-ambulance-1111

12/11/2023, 3:11 PM
In the first phase playbook I have some packages that need to be installed that will take hours . During the 1st phase i comment 2nd phase playbook and same vice versa
d

dry-keyboard-94795

12/11/2023, 3:14 PM
No need to do any commenting out. What you can do is have the 1st command depend on the ec2 instance, and have the 2nd command depend on the 1st command. This will make it so that pulumi runs everything in sequence, and the commands will only run once on the ec2 instance being created
If it's taking hours to run, it'd be worth creating a golden image for the ec2 instance to use instead of a stock AMI. Tools like Packer can help with this