tfstate-backend

cloudposse/tfstate-backend/aws

Terraform Module HCL AWS

Terraform module that provision an S3 bucket to store the terraform.tfstate file and a DynamoDB table to lock the state file to prevent concurrent modifications and state corruption.

Install
module "tfstate-backend" {
source = "cloudposse/tfstate-backend/aws"
version = "1.8.0"
}
⭐ Source on GitHub 📦 Registry page
README

Terraform module to provision an S3 bucket to store terraform.tfstate file and a DynamoDB table to lock the state file to prevent concurrent modifications and state corruption. The module supports the following: 1. Forced server-side encryption at rest for the S3 bucket 2. S3 bucket versioning to allow for Terraform state recovery in the case of accidental deletions and human errors 3. State locking and consistency checking via DynamoDB table to prevent concurrent operations 4. DynamoDB server-side encryption https://www.terraform.io/docs/backends/types/s3.html __NOTE:__ The operators of the module (IAM Users) must have permissions to create S3 buckets and DynamoDB tables when performing terraform plan and terraform apply __NOTE:__ This module cannot be used to apply changes to the mfa_del

Inputs (50)
NameTypeDescriptionDefault
terraform_versionstringThe minimum required terraform versionnull
s3_replica_bucket_arnstringThe ARN of the S3 replica bucket (destination)""
dynamodb_enabledboolWhether to create the DynamoDB table.true
namespacestringID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp'null
attributeslist(string)ID element. Additional attributes (e.g. `workers` or `cluster`) to add to `id`, []
billing_modestringDynamoDB billing mode"PAY_PER_REQUEST"
logginglist(object({ target_buckeDestination (S3 bucket name and prefix) for S3 Server Access Logs for the S3 buc[]
source_policy_documentslist(string)List of IAM policy documents (in JSON format) that are merged together into the []
stagestringID element. Usually used to indicate role, e.g. 'prod', 'staging', 'source', 'bunull
delimiterstringDelimiter to be used between ID elements. Defaults to `-` (hyphen). Set to `""` null
terraform_backend_config_file_namestring(Deprecated) Name of terraform backend config file to generate"terraform.tf"
permissions_boundarystringARN of the policy that is used to set the permissions boundary for the IAM repli""
namestringID element. Usually the component or solution name, e.g. 'app' or 'jenkins'. Thinull
block_public_aclsboolWhether Amazon S3 should block public ACLs for this buckettrue
ignore_public_aclsboolWhether Amazon S3 should ignore public ACLs for this buckettrue
restrict_public_bucketsboolWhether Amazon S3 should restrict public bucket policies for this buckettrue
terraform_backend_config_template_filestring(Deprecated) The path to the template used to generate the config file""
s3_state_lock_enabledboolWhether to create the S3 bucket.false
sse_encryptionstringThe server-side encryption algorithm to use. Valid values are `AES256`, `aws:kms"AES256"
contextanySingle object for setting entire context at once. See description of individual { "additional_tag_map": {}, "attribu
… and 10 more inputs
Outputs (8)
s3_bucket_domain_name — S3 bucket domain name
s3_bucket_id — S3 bucket ID
s3_bucket_arn — S3 bucket ARN
s3_replication_role_arn — The ARN of the IAM Role created for replication, if enabled.
dynamodb_table_name — DynamoDB table name
dynamodb_table_id — DynamoDB table ID
dynamodb_table_arn — DynamoDB table ARN
terraform_backend_config — Rendered Terraform backend config file
Resources (16)
aws_dynamodb_tableaws_iam_policyaws_iam_roleaws_iam_role_policy_attachmentaws_s3_bucketaws_s3_bucket_aclaws_s3_bucket_loggingaws_s3_bucket_object_lock_configurationaws_s3_bucket_ownership_controlsaws_s3_bucket_policyaws_s3_bucket_public_access_blockaws_s3_bucket_replication_configurationaws_s3_bucket_server_side_encryption_configurationaws_s3_bucket_versioninglocal_filetime_sleep
Details
FrameworkTerraform Module
LanguageHCL
Version1.8.0
Cloud AWS
★ Stars437
Forks189
Total downloads1.9M
Inputs50
Outputs8
Resources16
Examples1
LicenseApache-2.0
Namespacecloudposse
Updated