0
0
Terraformcloud~20 mins

State disaster recovery in Terraform - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Terraform State Recovery Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Terraform State Backup

Which of the following best describes the purpose of backing up Terraform state files?

ATo automatically update Terraform modules to their latest versions.
BTo speed up Terraform plan operations by caching previous runs.
CTo store user credentials securely for Terraform providers.
DTo ensure infrastructure can be restored or recreated accurately after accidental deletion or corruption.
Attempts:
2 left
💡 Hint

Think about what happens if the state file is lost or damaged.

Configuration
intermediate
2:00remaining
Configuring Remote State with Versioning

Which Terraform backend configuration snippet correctly enables remote state storage with versioning in AWS S3 for disaster recovery?

Terraform
terraform {
  backend "s3" {
    bucket = "my-terraform-state"
    key    = "prod/terraform.tfstate"
    region = "us-east-1"
    # Missing versioning configuration
  }
}
AEnable versioning on the S3 bucket outside Terraform; no config needed in backend block.
BAdd 'versioning { enabled = true }' inside the backend block.
CAdd 'enable_versioning = true' inside the backend block.
DAdd 'versioning = true' inside the backend block.
Attempts:
2 left
💡 Hint

Think about how S3 versioning is managed.

Architecture
advanced
2:00remaining
Designing a Disaster Recovery Plan for Terraform State

You manage infrastructure with Terraform using a remote backend in AWS S3. Which architecture best supports disaster recovery for your Terraform state?

AStore state in a single S3 bucket with versioning enabled and replicate the bucket to another AWS region.
BStore state locally on developer machines and back up manually to external drives.
CUse Terraform Cloud remote backend without any additional backups or replication.
DStore state in an S3 bucket without versioning but enable lifecycle rules to delete old states.
Attempts:
2 left
💡 Hint

Consider geographic redundancy and automatic recovery options.

security
advanced
2:00remaining
Securing Terraform State for Disaster Recovery

Which practice improves security and disaster recovery readiness for Terraform state stored in AWS S3?

ADisable encryption to improve performance and rely on network security only.
BMake the S3 bucket public for easy access and enable versioning.
CEnable server-side encryption with AWS KMS and restrict bucket access with IAM policies.
DStore state files in plaintext on an EC2 instance volume.
Attempts:
2 left
💡 Hint

Think about protecting sensitive data and controlling access.

service_behavior
expert
2:00remaining
Terraform State Recovery Behavior After State File Corruption

After accidental corruption of the Terraform state file stored in a versioned S3 bucket, what is the expected behavior when you run terraform apply?

ATerraform will automatically detect and fix the corrupted state file without user intervention.
BTerraform will fail to apply changes due to state mismatch unless the corrupted state is restored from a previous version.
CTerraform will ignore the corrupted state and create all resources from scratch.
DTerraform will delete all existing resources to match the corrupted state.
Attempts:
2 left
💡 Hint

Consider how Terraform uses the state file to track resources.