Interview Prep/Terraform/State and Backends in Production

How do you manage the state bucket with Terraform itself?

AdvancedProductionState and Backends in Production
Answer

Bootstrap with local state, apply, add the backend "s3" block and migrate. Protect with prevent_destroy, deny deletion in bucket policy and keep the stack in its own, rarely-changed repo path with extra approvers. If you ever destroy it you lose everything, so we also snapshot the bucket's configuration in documentation.

All Terraform questions Roadmap: Terraform in production

More on State and Backends in Production