Hi all, I'm trying to automate some pulumi changes...
# general
q
Hi all, I'm trying to automate some pulumi changes and I'm seeing something kind of strange. GCP native, python3.9, pulumi v3.103.1 if it matters. if I do
pulumi --non-interactive up -y
an update is run even when there are no changes. Is that expected behavior? I guess it's not that big a problem but it doesn't seem like correct behavior. Is there a reasonable way to run it so that it will only run the update if there are actually updates to run?
a
I'd guess that there are in fact changes to be made but Pulumi doesn't let you know beforehand as it doesn't refresh the current state of the cloud resources before applying changes.
pulumi up/pre
operations don't refresh the state of the cloud APIs unless you pass in
pulumi up --refresh
(which is the default behavior in Terraform). See relevant discussion on GitHub. What I've started doing is explicitly setting this option in the project configuration
Pulumi.yaml
Copy code
options:
  refresh: always
There's also an option that will fail if there are changes pending when you don't expect any. I find this particularly useful for detecting configuration drift. In combination with the
--diff
flag you can resolve any differences between state & actual cloud resources.
pulumi pre --expect-no-changes --refresh --diff