Skip to main content

[Spacelift.io] Terraform State Lock: How It Works & Best Practices

·172 words·1 min

I’ve written a blog post on using Terraform State Lock:

The Terraform state file is arguably one of the most important objects in Terraform. In the state file, Terraform keeps track of the resources it manages, their attributes, and their relationships with one another. It also contains metadata, output values, and check block results.

The state file is stored in a state backend. You can use the default local backend, where the state file is stored as a local file, or any of the available remote backends, where it is stored at a remote location.

For anything other than local experiments, you should use a remote backend. Unlike the local backend, it enables collaboration with other developers on the same Terraform configuration. The key concept that enables collaboration without chaos is state locking.

This blog post will explore the concept of state locking in Terraform: what it is, why it’s important, how to enable it with common remote backends, and best practices for state locking.

Read more at spacelift.io

Mattias Fjellström
Author
Mattias Fjellström
Cloud architect · Author · HashiCorp Ambassador · Microsoft MVP

Related