Remote State Intro

View saved

Local state limits

A lone terraform.tfstate on one laptop does not scale to teammates and CI. Two applies at once can corrupt state.

Remote state idea

Backends such as Terraform Cloud, S3 + DynamoDB locking, or Azure Storage hold state centrally and often lock during apply.

# Conceptual backend sketch (do not invent credentials):
# terraform {
#   backend "s3" {
#     bucket = "my-tf-state"
#     key    = "demo/terraform.tfstate"
#     region = "us-east-1"
#   }
# }

State can contain secrets

Treat state as sensitive. Restrict who can read remote state.

When to add it

Solo local file demos are fine. Add a remote backend before sharing applies with others or automating CI.

Comments

One comment per signed-in account. Comments are saved with this page’s URL.