Skip to content

Perspective on why terraform plan is run with -lock=false and has no ability to manipulate the option #400

Answered by dflook
ojintoad asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @ojintoad.

The dflook/terraform-plan (and dflook/terraform-check) actions run terraform plan with -lock=false because they do not write to the state. But the dflook/terraform-apply action does modify the state file, so it runs terraform plan with the state lock enabled (it will then run terraform apply, again with a state lock). So they both run terraform plan, the difference is if the github action as a whole could modify the state file.

Think of the plan action as creating a speculative plan - what would happen if this change was applied right now? If we locked the state while we did this, then:

  1. Other plan (or apply) actions would have to wait for us to finish, even though it won't …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ojintoad
Comment options

Answer selected by ojintoad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants