Multi User Edits and Terraform State file
Multiple Users and Terraform State file
terraform state pull
Always use terraform state pull prior to starting work on the tf project.
Pulling the terraform state file
To ensure that you always pick up the latest terraform state, you need to perform a special operation.
Apart from doing the normal git pull it is also good to do the terraform state pull . All latest changes within the terraform state file will be pulled with this command.
terraform state pull
Push terraform state file?
This is a command that can potentially lead to an inconsistent state. Push might override other team member changes on to terraform state file. It is often discouraged to use terraform state push command.
terraform state push
Can tf prevent accidental state pushes?
1. Lineage ID – Terraform has a safety mechanism based on a lineage ID assigned to each state file. If you are attempting to push the terraform state file with a different lineage ID then terraform will not allow it.
2. Serial Number – Terraform also assigns a unique and higher serial number to each terraform state file.
Leave a Reply