I’m working on a Terraform project that uses an S3 remote backend for our production pipeline. The configuration looks like this:
terraform {
backend "s3" {
bucket = "my-terraform-state"
key = "infrastructure/terraform.tfstate"
region = "us-west-2"
}
}
For local development and testing, I want to use a local state file instead of the remote S3 backend. I tried using terraform init -backend=false but this doesn’t create any backend at all. I also looked into using terraform init -backend-config=file but I’m not sure what configuration to put in the file for local backend.
What’s the proper way to temporarily switch from remote backend to local state management during development? I want to make sure I’m following best practices here.