Skip to main content

Bootstrap remote state

Remote state is a prerequisite. Atlas does not treat local Terraform state as a valid operating mode for shared infrastructure.

Step 1: create the backend resources

Run the bootstrap helper once:

export AWS_REGION=us-east-1
bash scripts/bootstrap-state.sh

The script creates the S3 bucket and DynamoDB lock table used by the Terraform backend.

Step 2: update the backend block

After the script prints the backend resource names, update the relevant root backend file:

  • terraform/staging/backend.tf
  • terraform/prod/backend.tf

Each root uses its own state key and its own backend resources.

Step 3: initialize the root

cd terraform/staging
terraform init -migrate-state

Current backend layout

RootBackend key
terraform/stagingstaging/terraform.tfstate
terraform/prodprod/terraform.tfstate
warning

Do not point both roots to the same backend key. Root separation is part of the environment model, not just a folder naming choice.