Skip to content

Latest commit

 

History

History

terraform_backend

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Terraform Backend

A backend defines where Terraform stores its state data files. This folder is used to setup a remote backend for the infrastructure Terraform code of the EC2 instance. The state files are stored in a S3 bucket, and the lock synchronization is implemented with a Dynamo DB table.

Instructions

Install Terraform

Terraform is required to run the following instructions. It can be installed, or used from Docker.

Define the necessary AWS keys as environment variables

# Always required:
export AWS_ACCESS_KEY_ID="AFG..."
export AWS_SECRET_ACCESS_KEY="ASR..."

# May be necessary:
export AWS_SESSION_TOKEN="WIo..."

Initialize terraform locally if it isn't initialized yet

terraform init

Create the backend resources (S3 bucket, etc)

terraform apply

Destroy the backend resources (optional)

terraform destroy