Create a terraform state and lock store (terraform.io) using S3/DynamoDB backends
module "store" {
source = "github.com/developmentseed/terraform-state-store"
region = "${var.region}"
table_name = "${var.table_name}"
bucket_name = "${var.bucket_name}"
}
Name | Description | Required | Default |
---|---|---|---|
region | The AWS region | yes | |
table_name | The name of the dynamoDB table | yes | |
bucket_name | The name of the s3 bucket | yes |
Name | Description |
---|---|
table_name | The name of the dynamoDB table. |
bucket_name | The name of the s3 bucket. |
$ brew install terraform
$ terraform init
$ terraform apply \
--var region=us-east-1 \
--var bucket_name=my-bucket-terraform-state \
--var table_name=my-table-terraform-lock
Include this block in your terraform file (or in a terraform.tf
file)
# terraform.tf
terraform {
backend "s3" {
bucket = "my-bucket-terraform-state"
key = "my-project/terraform.tfstate"
region = "us-east-1"
dynamodb_table = "my-table-terraform-lock"
}
}