Skip to content

Backend

How to configure a backend for Terraform

All backends for Terraform should be configured in the same way. For it, you only need two things: an S3 bucket to store your state file and a DynamoDB table for your Terraform lock.

The S3 bucket used for all repos is the same and is defined in cloud/aws/eu-west-1/cio-giti-network/s3.tf, under the name "prod-standard-terraform-backend-bucket-157b96ad-5574157b96ad".

The DynamoDB table creation is done in cloud/aws/eu-west-1/cio-giti-network/terraform-backend.tf. Please pad the name of your table with a uuid. Note that the name does not handle caps.

⚠ The values for workspace_key_prefix and dynamodb_table need to be changed

terraform {
  backend "s3" {
    bucket               = "prod-standard-terraform-backend-bucket-157b96ad-5574157b96ad"
    key                  = "terraform.tfstate"
    workspace_key_prefix = "my_prefix"
    region               = "eu-west-1"

    dynamodb_table = "my_dynamo_table"
    encrypt        = true
  }
}