From the course: Introduction to Terraform on Azure
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Implementing state locking and versioning
From the course: Introduction to Terraform on Azure
Implementing state locking and versioning
- [Instructor] Imagine that you and your teammate both run the Terraform apply with the log = false command at the same time on the same infrastructure. Both commands read the current state, attempt to make changes and try to write back to the state file simultaneously. What happens? Corrupted state, lost changes and potentially broken infrastructure. This is why state locking and proper versioning are absolutely critical for team environments. State locking is Terraform's safety mechanism that prevents multiple operations from running at the same time. When you run Terraform plan or Terraform apply, Terraform automatically acquires a lock, performs the operation, then releases the lock. You may wonder how the Azure backend in our configuration handles locking. It uses blob leases to implement locks and you can see the list status in the overview page of your tfstate in Azure. Let me show you where to find that. Navigate to your Azure Blob Storage. Make sure to open the container and…
Contents
-
-
-
-
-
(Locked)
What are workspaces?5m 43s
-
Using Terraform workspaces11m 21s
-
(Locked)
Define and provision Azure VM with workspaces10m 28s
-
(Locked)
Understanding Terraform state (local vs. remote)5m 6s
-
(Locked)
Configuring remote state using Azure Blob Storage11m 14s
-
(Locked)
Implementing state locking and versioning10m 25s
-
(Locked)
-
-
-