What's the best way to determine why Pulumi (via `...
# typescript
s
What's the best way to determine why Pulumi (via
pulumi preview
) is saying a resource must be replaced?
i
Sometimes I run a
pulumi up
select
details
when it asks me “Do you want to perform this update?” to help figure that out
if that doesn’t help I’ve ran these commands in the past that were helpful:
Copy code
pulumi preview --logtostderr -v=9 2> out.txt

grep replaces= out.txt
It’s super verbose but it might help you determine what’s going on
g
pulumi preview --diff
☝️ 1
s
OK, so it looks like the replacement of the EC2 instance is somehow related to the security group assigned to the instance (which is not changing or being modified in any way).
Is this a known behavior, or is there something I'm doing wrong here?
g
I think I know what's happening
Are you using the
securityGroups
argument to specify your security groups? If so, you should use
vpcSecurityGroupIds
instead.
securityGroups
is a "legacy" AWS argument from the EC2-Classic days before they had VPC support. It's an immutable property of EC2 instances. Whereas
vpcSecurityGroupIds
allows changes.
s
Ah, I see! Thanks for the clarification. I will update my code accordingly!
g
We have an open issue to deprecate
securityGroups
, fwiw.
👍🏻 1