Which of the following best describes the purpose of backing up Terraform state files?
Think about what happens if the state file is lost or damaged.
Backing up Terraform state files is critical because they hold the current infrastructure mapping. Losing them can cause Terraform to lose track of resources, leading to potential duplication or deletion.
Which Terraform backend configuration snippet correctly enables remote state storage with versioning in AWS S3 for disaster recovery?
terraform {
backend "s3" {
bucket = "my-terraform-state"
key = "prod/terraform.tfstate"
region = "us-east-1"
# Missing versioning configuration
}
}Think about how S3 versioning is managed.
S3 bucket versioning is a property set on the bucket itself, not configured inside Terraform backend. Terraform backend config does not support versioning flags.
You manage infrastructure with Terraform using a remote backend in AWS S3. Which architecture best supports disaster recovery for your Terraform state?
Consider geographic redundancy and automatic recovery options.
Enabling versioning and cross-region replication on S3 buckets ensures state files are protected against accidental deletion and regional failures, supporting disaster recovery.
Which practice improves security and disaster recovery readiness for Terraform state stored in AWS S3?
Think about protecting sensitive data and controlling access.
Encrypting state files and restricting access ensures sensitive information is protected and reduces risk of unauthorized changes or data loss.
After accidental corruption of the Terraform state file stored in a versioned S3 bucket, what is the expected behavior when you run terraform apply?
Consider how Terraform uses the state file to track resources.
Terraform relies on the state file to know current infrastructure. Corruption causes errors. Restoring a previous version is necessary to continue safely.