Skip to content

DeimosCloud/terraform-aws-remote-state

Repository files navigation

Terraform AWS Remote State Module

A terraform module to automate creation and configuration of backend using S3 bucket

Usage

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

Contributing

Report issues/questions/feature requests on in the issues section.

Full contributing guidelines are covered here.

Requirements

Name Version
terraform >= 0.12
aws >= 3.0.0, < 4.0.0

Providers

Name Version
aws 3.74.0
local 2.1.0
random 3.1.0
template 2.2.0

Modules

No modules.

Resources

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

Inputs

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

Outputs

Name Description
bucket_name bucket name
dynamodb_table Dynamodb name

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published