liveBook · Manning

Locking

As explained in Grokking Software Architecture

A database mechanism that restricts concurrent access to data to protect consistency during operations.

State locking coordinates infrastructure deployments that share remote state. When one developer deploys, Terraform locks the state file; another deployment must wait, preventing competing updates from overwriting state or corrupting the environment. section 9.7.3

Two developers, one deployment

Developer A starts a deployment and Terraform locks the remote state file. If Developer B deploys at the same time, Terraform stops B until the update in progress finishes. section 9.7.3

How Grokking Software Architecture covers it

How deep it goes
Explains automatic locking and blocking concurrent deployments, noting a database table may support the lock.
Examples
Uses two developers deploying simultaneously, with remote state stored in an AWS S3 bucket.
What you can do after
Operate Terraform team deployments by waiting for an active infrastructure update to finish before deploying.
How it connects
Connects Terraform state files, remote state storage, and Infrastructure as Code team deployments.

Also explained in

Compare how 21 books explain locking →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Software Architecture. The section links point to the parts of the book it draws on.