Open nitrocode opened 1 year ago
I believe that the terraform refresh
command has been deprecated due to it being unsafe. Is this something we still want to work on? Also running atlantis plan
or atlantis apply
should result in the same behaviour according to the docs:
Terraform automatically performs the same refreshing actions as a part of creating a plan in both the terraform plan and terraform apply commands
I believe that the terraform refresh command has been deprecated due to it being unsafe
Do you have a reference explaining that the refresh command is unsafe?
Is this something we still want to work on?
Yes, id personally like it.
Also running atlantis plan or atlantis apply should result in the same behaviour according to the docs:
Yes this is true. However, then you get a more complex plan to review. The refresh reduces the plan to the main resources that are changing.
It's mentioned in the documentation here: https://developer.hashicorp.com/terraform/cli/commands/refresh, I don't think that the warning should apply to Atlantis, as I expect that this more related to local development.
Anyhow, I would like to pick this up in the case that we still want this feature.
Ah thank you for sharing that link. I did not know it was deprecated.
https://developer.hashicorp.com/terraform/tutorials/state/refresh
Though Terraform will continue to support the refresh subcommand in future versions, it is deprecated, and we encourage you to use the -refresh-only flag instead. This allows you to review any updates to your state file. Unlike the refresh subcommand, -refresh-only mode is supported in workspaces using Terraform Cloud as a remote backend, allowing your team to collaboratively review any modifications.
Then perhaps the workaround i included above is the best way forward.
The downside of not implementing atlantis refresh
is that you would need to get an approval first for the plan with all the junk before you could complete the lifecycle of a refresh only plan in order to create a new plan without the junk to make it easier to review....
This is the issue with the current workaround.
The ideal method would be that you could run atlantis refresh
and it would either run terraform refresh && terraform plan
or terraform plan -refresh-only && terraform apply && terraform plan
(without merging the branch). Whether the former or latter is used, it's just an implementation detail.
Community Note
Describe the user story
For terraform 0.15.4 and later, sometimes the attributes of managed resources are modified. When a
terraform plan
is run, we get a lot of information that frankly no one cares about and then finally the plan is appended beneath it.In order to remove the text above the
plan
we have to run aterraform refresh
.This can be added to the
plan
workflow but I do not want to run it all the time since it's more calls to AWS than we need.Ref https://support.hashicorp.com/hc/en-us/articles/4405950960147-New-Feature-Objects-have-changed-outside-of-Terraform-
Example of the "junk" with the
no changes
messageDescribe the solution you'd like
It would be best to have an option to run it like this.
or
Related to this issue https://github.com/runatlantis/atlantis/issues/2776
Describe the drawbacks of your solution
None
Describe alternatives you've considered
Run a refresh-only plan first
or
Run
terraform refresh
locally and then runatlantis plan
in the PR.