Terraform Version 14.9
We had removed an instance from the cloud using the command :terraform destroy -target testaddnode -target core_instance
I had also removed the instance details from the output.tf
, when I do a, terraform refresh I could see the state file is getting updated and the instance details are removed, **but instance details in output section of the state file are not removed **.
I am currently migrating from tf 0.11.14 to tf .14.9 and this operation used to work fine with tf 11 .
Are there any issues regarding terraform refresh in tf 14 which doesn’t update the state file of the output that has been changed?
Is there any workaround to update the output section in the terraform state file?
This is a known issue and fixed in Terraform v0.15
See Refresh during destroy by jbardin · Pull Request #27408 · hashicorp/terraform (github.com)
I also experienced the bug, and for a while used a workaround to manually
terraform refresh before destroy. Now, I can confirm that the v0.15 beta fixes that and reverted the behavior as it was in v0.13.
And a quote from https://github.com/hashicorp/terraform-provider-kubernetes/issues/1113#issuecomment-795685238:
Just as a side note, given this issue was not fixed at all in v0.14.x this is going to cause folks that need this functionality to completely skip the v0.14.x of terraform for their work. I know we will
@TjeuKayim Thanks for the replay.
I had tried the following actions:-
1)Tried refresh before destroy but wasn’t able to see it modifying the state output variables.
2)Tried using TF 15.0 (not beta ) the same issue exists!!.
The only way through is to do a TF apply but the problem is if customers have made any modification outside TF it can ruin their systems.
Have you tried TF 15.0 does it work for you ?
I probably misread your description of the issue, sorry. Now that I look at it again, your issue seems to differ from the one that I encountered.
I needed Terraform to refresh during destroy (fixed in v0.15.0), while you need the output section of state file to be refreshed after destroy operations.
Maybe you could submit your issue to the the GitHub issue tracker, if that hasn’t been done already.