Hi all. I plan to use pulumi at work if possible (...
# getting-started
b
Hi all. I plan to use pulumi at work if possible (replacing bespoke boto3 scripts..). We are heavy cloudformation an servicecatalog users, which seems like it will be easy to migrate over pulumi (cloudformation is essentially already there) and servicecatalog should be easy for us to wrap around our code into a ressource. Question: cloudformation exposes the concept of "drift" (if someone modifies the ressource manually, for instance). Does pulumi have plans to detect and make use of that feature? Currently it seems like it's not being used by the diff engine at all (maybe it should).
g
Yes, Pulumi can do this with "refresh", but
pulumi
does not refresh automatically. You can instruct pulumi to do a refresh with
pulumi refresh
or the
--refresh
flag on the
up
,
preview
, etc. commands. https://www.pulumi.com/docs/reference/cli/pulumi_refresh/
🙌 1
b
Ohhh why have I not discovered this on my own? thanks!
I could still do more for cloudformation however, like trigger a drift detection , show the drift result, and eventually rollback the drifted changes
g
You can run
pulumi refresh --expect-no-changes
which will return an error if drift is detected, so you can build your own scripting around that.
Also, the Pulumi Automation SDK can help make that scripting more programmatic. More on that is at https://www.pulumi.com/blog/tag/automation-api/.
b
What I meant is that pulumi won't consider a "drifted" cloudformation template as needing an update
the drift applies to the cloudformation template's ressources, not the template itself
so a cloudformation template will report "drift detected" in AWS console, but pulumi will consider that it doesn't need refreshing (in other words: --expect-no-changes reports no changes)
since the cloudformation ressource itself didn't change, pulumi is right (nobody changed the template)
but that's not as useful as it could be to a user
🙂
g
Ah, I see. Well... it is just code, so you can call the cloudformation API to do the drift detection alongside your Automation SDK code if that makes sense for your workflow.
b
yeah, that's probably what we'll end up doing. Or gradually switch ressources to be created by pulumi directly instead of having a middle layer of cloudformation
(this way we'd have nicer diffs, too)
g
Or gradually switch ressources to be created by pulumi directly instead of having a middle layer of cloudformation
Highly recommend this. 😂 (Disclaimer: I work at Pulumi. I'm biased obviously.)
b
My colleagues are ex-AWS so I have some legwork to do first. But since I'm a big fan of the "it's just code" aspect it should be relatively easy to show the benefits. Also, the automation API is going to be saving us a lot of time.
Thanks a lto for your help, in any case