use_lockfile

The s3 backend setting, added in Terraform 1.10, that locks state by writing a small lock file next to it in the bucket, with no extra database.

In more detail

It replaces the older DynamoDB-based locking, which is now deprecated. It relies on conditional writes in Amazon S3, so only one run can create the lock file at a time.

Example

backend "s3" {
  bucket       = "example-tf-state"
  key          = "orders/terraform.tfstate"
  region       = "eu-west-2"
  use_lockfile = true
}

Related terms

Taught in

References

Certification courses