This message was deleted.
# general
s
This message was deleted.
a
Refresh does't change any resources, it simply updates the state file with what's on the real world.
For example, imagine you have an EC2 instante with instance class t2.nano, started with Pulumi. Then you go to the EC2 console and upgrade it to m5.xlarge. Pulumi doesn't know about this change, so it won't try to bring it back to t2.nano.
If you run refresh, Pulumi will look at AWS, see that the instance is now m5.xlarge and it will update the state file accordingly. Next time you run Pulumi it will know that it needs to change the instance class of the instance back to t2.nano.
b
thanks for the answer.
is it then an antipattern to run refresh in a ci pipeline?
e.g i ran into the issue that when changing my access key for my aws account, the refresh fails (as the key has changed which makes sense) and the next
pulumi up
would then try to recreate all resources (i had to disable auto-naming, so this will fail)
a
If refresh messes with your state file, then that might happen
b
@blue-orange-84367 maybe consider doing something else to test your access key before running pulumi refresh. Though I'm surprised that pulumi refresh failing would update the state file
b
i re-run refresh on all my ci/cd, just too high of a chance that something has changed and it might break the deploy. some resources don't like updates as well as others, or you don't want cascading deletion of other resources, so in those cases I'll delete a resource from a console, update my git repo and run a deploy, it will see the item is gone, and recreate it with new configuration.
b
actually the refresh isn't failing. It prints the following error in the build logs:
Copy code
refreshing warning: configured Kubernetes cluster is unreachable: unable to load schema information from the API server: the server has asked for the client to provide credential
It seems like afterwards the state lost all knowledge about the deployment in the cluster and tries to create new deployments. as said we disabled auto-naming (for some internal reasons), which leads to pulumi complaining, that a resource with that name already exists.