Closed starptr closed 2 months ago
Hi @starptr. pulumi refresh
[^1] only uses your state file. It does not incorporate changes from your config file or your program. You will need to run pulumi up
first to migrate the new token from your config to your state, then pulumi refresh
will work.
[^1]: This is also true for pulumi destroy
.
Hey @iwahbe, thanks for the response! Running pulumi up
(specifically, not pulumi up --refresh
) indeed looks like it is now using the new token. So I'm closing this issue.
But now, I am confused about the "correct thing to do" whenever I want to sync up cloud resources with changes to either my config (eg. DO auth token) or program (eg. make a new Droplet). I thought I read somewhere that the best practice was to always sync the local Pulumi state with the true real-world state by running pulumi up --refresh
(which is equivalent to pulumi refresh
as I understand it) before pushing the actual changes config/program changes. I'm probably mistaken, but not sure what the correct mental model should be. Any helpful context & knowledge appreciated!
Describe what happened
After my old DO token expired, I added a new DO API token via
pulumi config set digitalocean:token XXX --secret
, and confirmed that the token is necessary & correct by runningbefore and after setting the token env variable. (The request fails before, and succeeds after.) However, running
pulumi refresh
keeps failing, with every error message looking like this:Any pointers appreciated :)
(Interestingly, when I run
pulumi config set digitalocean:token XXX --secret
, I notice that an encrypted version of the token is added toPulumi.dev.yaml
, and callingpulumi config set …
multiple times changes the string that is inPulumi.dev.yaml
. But it looks like this is expected behavior?)Sample program
I will do this if needed to debug this :)
Log output
No response
Affected Resource(s)
No response
Output of
pulumi about
Additional context
No response
Contributing
Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).