AWS and HashiCorp stepped it up and now it’s finally time to ditch the DynamoDB table to handle state concurrency. This is officially supported on Terraform 1.11.0 and higher.
Now simply enable versioning on the bucket, then, configure your backend in Terraform to use S3 with native locking enabled.
To enable S3 state locking, use the following optional argument:
use_lockfileWhether to use a lockfile for locking the state file. Defaults to false.
terraform {
required_version = "~> 1.11.0"
backend "s3" {
bucket = "s3-native-lock-setup"
key = "backend/terraform.tfstate"
region = "eu-north-1"
profile = "ProfileForAccount-12345678910"
use_lockfile = true
}
}
Check out the whole reference at developer.hashicorp.com.