-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"terraform plan" should produce an error when given a plan file #19235
Comments
Is there anything I can do to help surface this issue better? As it stands, I cannot use "viewing planfiles" in my workflow, or I risk unintended changes to the remote state. |
Hi @eedwards-sk! Sorry for this strange behavior, and thanks for reporting it. Passing an already-existing plan file to To view a plan file that was already created, you can use |
Thanks so much for the response and clarity over the workflow. I'm trying to build a CI pipeline with a 'view plan' step, so this was throwing quite the wrench in it. I'm excited to try the Generating an error when running against a plan file would definitely help, as would updating the docs on the plan command. That's where I mostly got set on this trail, specifically these two lines from https://www.terraform.io/docs/commands/plan.html:
Edit: also the output of
Thanks again. |
Thanks for pointing out the docs there. I'm not sure what is the story behind that; perhaps this used to be the way to do this prior to the implementation of the I'm going to rescope this issue slightly to cover updating that documentation and removing what seems to be vestiges of an earlier usage that is no longer fully functional. |
From a quick inspection of the code, I see that the error message I mentioned is already in place in master ready to be included in the forthcoming v0.12.0 release: Lines 61 to 68 in f4cdb99
So the remaining work here is to get the docs updated. Since the behavior change here is already included in the v0.12.0 scope I'm going to add this issue to the v0.12.0 milestone to represent the need to update the docs as well before release. |
The documentation for the plan command continues to state the following:
However, it seems this behavior was made unavailable in 0.12 and |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Terraform Version
Terraform Configuration
s3 backend with terraform files containing aws data sources
Actual Behavior
running
terraform plan <plan_name>
updates the remote stateExpected Behavior
running
terraform plan <plan_name>
does not update the remote stateSteps to Reproduce
terraform init
with s3 backend config (remote state file does not exist)terraform plan -out=tfplan .
(remote state file does not exist)terraform plan tfplan
(state file now exists)Additional Context
running inside concourse ci pipeline
according to documentation, state should not be updated on a plan, e.g.:
https://www.terraform.io/guides/running-terraform-in-automation.html
https://www.terraform.io/docs/commands/plan.html
I'm trying to use the
terraform plan <plan_name>
command to view an existing plan, so that an operator can confirm the changesI want to use
-refresh=true
because the operator should know what the actual effects will be when ranHowever, the state file should not be updated when viewing the plan, instead it should refresh and then 'throwaway' the state, correct?
The text was updated successfully, but these errors were encountered: