Skip to content

Default state locking to S3 lockfile#7

Merged
gsavage merged 1 commit into
mainfrom
s3-lockfile
May 11, 2026
Merged

Default state locking to S3 lockfile#7
gsavage merged 1 commit into
mainfrom
s3-lockfile

Conversation

@gsavage
Copy link
Copy Markdown
Contributor

@gsavage gsavage commented May 10, 2026

Terraform 1.10+ supports native S3-based state locking via the use_lockfile=true backend option, which writes a .tflock object alongside the state file and removes the need for a per-environment DynamoDB table. The pinned Terraform version (1.14.6) supports this everywhere tf runs.

The wrapper now defaults to S3 locking. Set TF_STATE_LOCK=dynamodb to opt back into DynamoDB-based locking; any other value fails fast at init time.

Operational note for consumers: the OIDC role used by base.yml needs s3:DeleteObject on the state bucket (ideally scoped to *.tflock) so that lock release can remove the lockfile object. Existing DynamoDB lock tables can stay in place and be cleaned up later.

Terraform 1.10+ supports native S3-based state locking via the
use_lockfile=true backend option, which writes a .tflock object alongside
the state file and removes the need for a per-environment DynamoDB table.
The pinned Terraform version (1.14.6) supports this everywhere tf runs.

The wrapper now defaults to S3 locking. Set TF_STATE_LOCK=dynamodb to opt
back into DynamoDB-based locking; any other value fails fast at init time.

Operational note for consumers: the OIDC role used by base.yml needs
s3:DeleteObject on the state bucket (ideally scoped to *.tflock) so that
lock release can remove the lockfile object. Existing DynamoDB lock
tables can stay in place and be cleaned up later.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@gsavage gsavage merged commit a12ce21 into main May 11, 2026
1 check passed
@gsavage gsavage deleted the s3-lockfile branch May 11, 2026 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants