A generic remote state storage generator.

Fred Damstra (Macbook 2015) 2bc0b45a92 Added backend.tf for remote config. 2 vuotta sitten
.gitignore f2030e1ede Initial commit 2 vuotta sitten
.pre-commit-config.yaml 003b411e2b Adds dynamodb 2 vuotta sitten
.terraform.lock.hcl f2030e1ede Initial commit 2 vuotta sitten
.tflint.hcl f2030e1ede Initial commit 2 vuotta sitten
.tfsec.yaml 003b411e2b Adds dynamodb 2 vuotta sitten
README.md 2bc0b45a92 Added backend.tf for remote config. 2 vuotta sitten
backend.tf 2bc0b45a92 Added backend.tf for remote config. 2 vuotta sitten
config.tf f7a3294d4c Oops.. I like us-east-2 2 vuotta sitten
dynamodb.tf 9e8984b10a Made dynamodb optional 2 vuotta sitten
output.tf 0933bc2c37 Final state before storing backend 2 vuotta sitten
provider.tf f2030e1ede Initial commit 2 vuotta sitten
required_providers.tf f2030e1ede Initial commit 2 vuotta sitten
s3.tf 0933bc2c37 Final state before storing backend 2 vuotta sitten

README.md

Terraform Remote State

Creates an S3 bucket and a dynamodb table for terraform remote state storage.

Table of Contents

  1. Usage
  2. Requirements
  3. Providers
  4. Inputs
  5. Outputs

Usage

First Time Creation

If this is your first time using this module, remove the backend.tf file, then create fresh via:

terraform apply
  1. Save the output config as backend.tf
  2. Edit backend.tf and copy the bucket name to the key name.
  3. Run terraform init. Answer YES to whether to copy the backend.tf
  4. If it was successful, run rm terraform.tfstate*
  5. Run a final terraform apply

Later usage

Run terraform output to get the config, and copy it as a backend.tf in your other projects. Be careful not to reuse the key.

Making Changes

Once you've migrated the backend to s3, you probably do not want to make changes. Do so at your own risk.

Requirements

Name Version
terraform >= 1.0
aws ~> 4.0

Providers

Name Version
aws 4.34.0

Modules

No modules.

Resources

Name Type
aws_dynamodb_table.lock_table resource
aws_s3_bucket.state_storage resource
aws_s3_bucket_acl.state_storage resource
aws_s3_bucket_lifecycle_configuration.state_storage resource
aws_s3_bucket_public_access_block.state_storage resource
aws_s3_bucket_server_side_encryption_configuration.state_storage resource
aws_s3_bucket_versioning.state_storage resource

Inputs

No inputs.

Outputs

Name Description
backend_tf n/a