-
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
Expected "apply" not to do anything, but creates duplicate #1783
Comments
note: I understand why this happens; Still, I would expect running Note that in our case we invoke plan and apply programmatically, so there is no human in between to determine if we should use the plan when calling apply. |
You can delete the old plan after applying it / before running terraform plan. (This is what I do anyway). |
Hi there - thanks for this report, and sorry for the confusing behavior. Generally speaking, the plan file encodes the expected state along with the diff, and refuses to apply if the state it sees during application does not match. This doesn't cover the "create" case, though, since the expected plan is "nothing there", and TF doesn't have visibility into resources whose IDs it hasn't already recorded.
Yep at first glance this seems like a reasonable expectation to me. Flagging as a POLA violation bug and we'll get this looked at. |
I just had a quick look at terraform plan --help and it looks like -detailed-exitcode will allow you to detect the empty plan case as well. But I also think writing the plan file every time is reasonable. |
This makes the planfile workflow more consistent. If a plan yields a noop, the apply of that planfile will noop. Fixes #1783
This makes the planfile workflow more consistent. If a plan yields a noop, the apply of that planfile will noop. Fixes hashicorp#1783
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. |
What happens:
What I expected to happen:
Am I misunderstanding the Terraform workflow, or could this be a bug?
I added the full command output below:
The text was updated successfully, but these errors were encountered: