Terraform 1.5: Migrating from Local State to S3 Backend—Uncertain Lock Behavior
0 reputation · 20 May 2022, 18:26 UTC
State Migration Concerns
When upgrading a Terraform project from a local state file to an S3 backend, the migration process prompts the user to confirm the transfer of the existing state. This transition is documented in the Terraform 1.5 release notes and the official backend configuration guide.
Locking on Backends Without Built‑In Support
Some S3 configurations, especially those using legacy bucket policies or without DynamoDB table integration, do not provide native locking. Terraform’s default behavior for such backends is to skip locking, which may expose the state to concurrent write attempts.
Unresolved Decision Points
- What are the exact implications for concurrent modifications when the S3 backend lacks locking support?
- Does Terraform automatically disable locking during migration, or must the user manually configure a lock mechanism (e.g., a separate DynamoDB table) before or after the migration?
- Can the migration be performed safely without creating a local backup of the state file, and if the migration fails, what is the recommended recovery path to restore the original local state?
These questions remain open for teams planning to move to remote backends while ensuring state consistency and safety.