Let's think about it this way for a second
Local state (the default) only lives on one laptop — other team members can't see it, and if two people apply at the same time the state file can get split apart. A Remote Backend (`backend "s3" { ... }`) stores the state file in a shared location (an S3 bucket, Terraform Cloud), so every team member always sees the latest state. State Locking (typically a DynamoDB table paired with an S3 backend) locks things so no one else can apply while someone else's apply is in progress — protecting against state corruption.
Let's connect this to a real scenario
If you configure `terraform { backend "s3" { bucket = "my-terraform-state"; key = "prod/terraform.tfstate"; region = "us-east-1"; dynamodb_table = "terraform-locks" } }`, running `terraform init` migrates the state from local to S3 — after that, any team member running `terraform apply` from the same config folder will always get the latest state.
Let's look at it together
terraform {
backend "s3" {
bucket = "my-terraform-state"
key = "prod/terraform.tfstate"
region = "us-east-1"
dynamodb_table = "terraform-locks"
encrypt = true
}
}$ terraform init
Initializing the backend...
Successfully configured the backend "s3"! Terraform will
automatically use this backend unless the backend configuration
changes.5-minute try-it
Write a remote backend config (S3 or whichever provider you're familiar with) and study Terraform's prompts/output when it configures the backend — don't actually create cloud resources, just do a dry-run/documentation review.
A quick word of caution
If the S3 bucket (state storage) accidentally becomes publicly accessible, every bit of sensitive data (passwords, secrets) inside can leak — keep the bucket private and enable encryption.