S3 bucket and DynamoDB lock table for Terraform State backend.
Edit the following items in backend.tf
:
- Set your credentials in the
aws
provider as described in the Terraform documentation (or, setup AWS CLI for your environment usingaws configure
to automatically work out of the box). - Replace all instances of
example
with the name of your terraform project.
To launch the backend, run:
* terraform init
* terraform plan
* And, when ready: terraform apply
In order to use the new backend for your Terraform project, just add the following snippet to a *.tf
file, replacing example
where appropriate and setting the region:
terraform {
backend "s3" {
encrypt = true
bucket = "example-remote-state-storage-s3"
dynamodb_table = "example-state-lock-dynamo"
region = "us-east-1"
key = "example.tfstate"
}
}