Terraform / OpenTofu module for storing Terraform / OpenTofu state in AWS S3 bucket and state locks in AWS DynamoDB.
module "tf_state" {
source = "voidsolutionsorg/tf-state/aws"
version = "1.0.0"
project_name = "example"
}
terraform {
backend "s3" {
bucket = "example-tf-state"
key = "myapp/production/tfstate"
region = "us-east-1"
dynamodb_table = "example-tf-state-lock"
encrypt = true
}
}
Name | Version |
---|---|
terraform | >= 1.5.0 |
aws | ~> 5.0 |
Name | Version |
---|---|
aws | 5.61.0 |
No modules.
Name | Type |
---|---|
aws_dynamodb_table.tf_state_lock | resource |
aws_s3_bucket.tf_state | resource |
aws_s3_bucket_acl.tf_state | resource |
aws_s3_bucket_ownership_controls.tf_state | resource |
aws_s3_bucket_versioning.tf_state | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
billing_mode | The billing mode for the DynamoDB table | string |
"PAY_PER_REQUEST" |
no |
force_destroy | Destroy the bucket even if it contains objects | bool |
true |
no |
project_name | The name of the project, used for naming resources | string |
n/a | yes |
read_capacity | The read capacity for the DynamoDB table | number |
null |
no |
tags | A map of tags to add to all resources | map(string) |
{} |
no |
write_capacity | The write capacity for the DynamoDB table | number |
null |
no |
No outputs.
Module is maintained by Aleksa Siriški with help from the VoidSolutions team.
Apache 2 Licensed. See LICENSE for full details.