You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+33Lines changed: 33 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -132,6 +132,39 @@ Follow this procedure just once to create your deployment.
132
132
This concludes the one-time preparation. Now you can extend and modify your
133
133
Terraform configuration as usual.
134
134
135
+
### S3 Native State Locking (Terraform >= 1.10)
136
+
137
+
Starting with Terraform 1.10, S3 supports [native state locking](https://developer.hashicorp.com/terraform/language/backend/s3#s3-state-locking)
138
+
via `use_lockfile = true`, removing the need for a DynamoDB table.
139
+
140
+
> **Note**: DynamoDB-based state locking is [deprecated](https://developer.hashicorp.com/terraform/language/backend/s3#enabling-dynamodb-state-locking-deprecated)
141
+
> in Terraform 1.10+. New setups should use S3 native locking instead.
142
+
143
+
To use S3 native locking instead of DynamoDB:
144
+
145
+
```hcl
146
+
module "terraform_state_backend" {
147
+
source = "cloudposse/tfstate-backend/aws"
148
+
149
+
namespace = "eg"
150
+
stage = "test"
151
+
name = "terraform"
152
+
attributes = ["state"]
153
+
154
+
# Use S3 native locking (Terraform >= 1.10)
155
+
s3_state_lock_enabled = true
156
+
157
+
# Disable DynamoDB table (not needed with S3 native locking)
158
+
dynamodb_enabled = false
159
+
160
+
terraform_backend_config_file_path = "."
161
+
terraform_backend_config_file_name = "backend.tf"
162
+
force_destroy = false
163
+
}
164
+
```
165
+
166
+
The generated `backend.tf` will use `use_lockfile = true` instead of `dynamodb_table`.
Copy file name to clipboardExpand all lines: variables.tf
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -182,13 +182,13 @@ variable "bucket_enabled" {
182
182
variable"s3_state_lock_enabled" {
183
183
type=bool
184
184
default=false
185
-
description="Whether to create the S3 bucket."
185
+
description="Whether to use S3 native state locking (use_lockfile). Requires Terraform >= 1.10. When enabled, DynamoDB is not needed for state locking. See https://developer.hashicorp.com/terraform/language/backend/s3#s3-state-locking"
186
186
}
187
187
188
188
variable"dynamodb_enabled" {
189
189
type=bool
190
190
default=true
191
-
description="Whether to create the DynamoDB table."
191
+
description="Whether to create the DynamoDB table for state locking. Note: DynamoDB-based locking is deprecated in Terraform >= 1.10 in favor of S3 native locking (s3_state_lock_enabled). See https://developer.hashicorp.com/terraform/language/backend/s3#enabling-dynamodb-state-locking-deprecated"
0 commit comments