0
0
Terraformcloud~20 mins

Backend initialization and migration in Terraform - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Terraform Backend Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
What happens during Terraform backend initialization?
When you run terraform init with a configured backend, what is the main action Terraform performs?
ATerraform validates the syntax of all Terraform files without any network activity.
BTerraform applies all infrastructure changes defined in the configuration.
CTerraform destroys all existing resources to prepare for a fresh deployment.
DTerraform downloads provider plugins and configures the backend to store state remotely.
Attempts:
2 left
💡 Hint
Think about what terraform init does before any changes happen.
service_behavior
intermediate
1:30remaining
Effect of backend migration on Terraform state
You have a Terraform project using a local backend. You configure a new remote backend and run terraform init -migrate-state. What is the expected result?
ATerraform copies the existing local state file to the new remote backend and updates the configuration to use it.
BTerraform deletes the local state file and starts with an empty remote state.
CTerraform ignores the local state and creates a new remote state from scratch.
DTerraform fails with an error because state migration is not supported.
Attempts:
2 left
💡 Hint
Consider what the -migrate-state flag is designed to do.
Configuration
advanced
2:00remaining
Identify the correct Terraform backend configuration for migration
Given this Terraform backend block for local state:
terraform {
  backend "local" {
    path = "terraform.tfstate"
  }
}
You want to migrate to an S3 backend. Which backend configuration block correctly sets up the S3 backend for migration?
A
terraform {
  backend "s3" {
    bucket = "my-terraform-state"
    path   = "state/terraform.tfstate"
    region = "us-west-2"
  }
}
B
terraform {
  backend "s3" {
    bucket = "my-terraform-state"
    key    = "state/terraform.tfstate"
    region = "us-west-2"
  }
}
C
terraform {
  backend "s3" {
    bucket = "my-terraform-state"
    key    = "terraform.tfstate"
    zone   = "us-west-2"
  }
}
D
terraform {
  backend "s3" {
    bucket = "my-terraform-state"
    key    = "state/terraform.tfstate"
    region = "us-east-1"
  }
}
Attempts:
2 left
💡 Hint
Check the correct attribute names and region for S3 backend.
security
advanced
1:30remaining
Security best practice during backend migration
When migrating Terraform state from a local backend to a remote backend like S3, which practice best protects sensitive state data?
AEnable server-side encryption on the S3 bucket and restrict access with IAM policies.
BStore the state file publicly to allow easy access for all team members.
CDisable encryption to improve performance during migration.
DKeep the state file only on local machines to avoid cloud exposure.
Attempts:
2 left
💡 Hint
Think about how to keep state data safe in cloud storage.
Architecture
expert
2:00remaining
Impact of backend migration on Terraform workflow in a team
Your team migrates Terraform state from local files to a remote backend with state locking enabled. Which change in workflow behavior should the team expect?
ATerraform automatically merges conflicting state changes from multiple users.
BAll team members can apply changes simultaneously without any state conflicts.
COnly one team member can run Terraform commands that modify state at a time, preventing concurrent state changes.
DState locking disables Terraform plan commands for all users.
Attempts:
2 left
💡 Hint
Consider what state locking is designed to prevent.