Hacker News new | ask | show | jobs
by shatteredspace 1733 days ago
Made an edit to my original comment but it may help to be here also.

'terraform refresh' may be what you are looking for. This will update the state to match current configurations that may have been done outside of Terraform.

2 comments

From https://www.terraform.io/docs/cli/commands/refresh.html :

> You shouldn't typically need to use this command, because Terraform automatically performs the same refreshing actions as a part of creating a plan in both the terraform plan and terraform apply commands.

I'm talking about fixing the external actual configuration that has diverged, to match what terraform config wants it to be.

However, snom380 says this is what terraform is intended to do, and does with properly implemented providers, which makes sense to me.

I'm not sure if you are talking about the same things. We -- me, snom380, and the original quote I made from OP -- are talking about what happens when external actually existing live resources have diverged from terraform's state. I understand what you said that under a "perfect" situation, this would not happen. But it does sometimes for various reasons, what the original quote from OP is talking about and what I'm talking about is what happens when it does. I think maybe you are talking about something else.