A terraform module to automate creation and configuration of backend using S3 bucket
provider "aws" {
region = "us-east-2" # Bucket is created in the same region
}
module "remote_state_locking" {
source = "git::https://gitlab.com/deimosdev/tooling/terraform-modules/terraform-aws-remote-state"
use_lock = false
}
This creates a backend.tf
file in the specified backend_output_path
(default: project directory). Apply the configured backend by running terraform init
again
Report issues/questions/feature requests on in the issues section.
Full contributing guidelines are covered here.
Name | Version |
---|---|
terraform | >= 0.12 |
aws | >= 3.0.0, < 4.0.0 |
Name | Version |
---|---|
aws | 3.74.0 |
local | 2.1.0 |
random | 3.1.0 |
template | 2.2.0 |
No modules.
Name | Type |
---|---|
aws_dynamodb_table.terraform_locks | resource |
aws_s3_bucket.remote_state | resource |
local_file.remote_state_locks | resource |
random_id.this | resource |
aws_region.current | data source |
template_file.remote_state | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
backend_output_path | The default file to output backend configuration to | string |
"./backend.tf" |
no |
bucket_key | The Key to store bucket in | string |
"global/terrform.tfstate" |
no |
bucket_name | Name of bucket to be created. If not provided name is generated from name_prefix appended with a random string | string |
"" |
no |
dynamo_lock_name | Name of Dynamo lock to be created for lock. If not provided name is generated from name_prefix appended with a random string | string |
"" |
no |
enable_versioning | enables versioning for objects in the S3 bucket | bool |
true |
no |
force_destroy | Whether to allow a forceful destruction of this bucket | bool |
false |
no |
name_prefix | Prefix for all created resources | string |
"tfstate-" |
no |
use_lock | Whether to enable locking using dynamo_db | bool |
true |
no |
Name | Description |
---|---|
bucket_name | bucket name |
dynamodb_table | Dynamodb name |