-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
command: Refuse to apply plan if its state doesn't match current
After running "terraform plan -out=tfplan" and then "terraform apply tfplan" the plan file is left on disk and could previously potentially be applied a second time. Here we add a new constraint that prevents the use of a plan that was not produced from the current state, thus avoiding that problem. It will also reduce race conditions (on the human timescale) between running "plan" and later running "apply", in environments where multiple people/processes are using Terraform with the same remote state. This hazard cannot be eliminated entirely without proper locking, but the with this change in place the race condition is only for two concurrent *applies*, as opposed to overlapping of the whole time period between plan and apply.
- Loading branch information
1 parent
f92fce3
commit f66f674
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters