0
0
Terraformcloud~10 mins

Backend initialization and migration in Terraform - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to initialize the Terraform backend.

Terraform
terraform [1]
Drag options to blanks, or click blank then click option'
Ainit
Bapply
Cplan
Ddestroy
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'terraform apply' before initializing the backend.
Confusing 'terraform plan' with initialization.
2fill in blank
medium

Complete the code to migrate the Terraform state to a new backend.

Terraform
terraform [1] -migrate-state
Drag options to blanks, or click blank then click option'
Aapply
Bplan
Crefresh
Dinit
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to migrate state with 'terraform apply'.
Forgetting the '-migrate-state' flag.
3fill in blank
hard

Fix the error in the backend configuration block by completing the missing backend type.

Terraform
terraform {
  backend "[1]" {
    bucket = "my-terraform-state"
    region = "us-west-2"
  }
}
Drag options to blanks, or click blank then click option'
Agcs
Blocal
Cs3
Dazurerm
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'local' backend when remote storage is intended.
Confusing 'gcs' (Google Cloud Storage) with AWS S3.
4fill in blank
hard

Fill both blanks to configure a remote backend with encryption and versioning enabled.

Terraform
terraform {
  backend "s3" {
    bucket         = "my-terraform-state"
    region         = "us-east-1"
    [1] = true
    [2] = true
  }
}
Drag options to blanks, or click blank then click option'
Aencrypt
Bversioning
Ckms_key_id
Dforce_destroy
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'kms_key_id' instead of 'encrypt' for encryption flag.
Confusing 'force_destroy' with versioning.
5fill in blank
hard

Fill all three blanks to write a backend block for Azure Blob Storage with container and key specified.

Terraform
terraform {
  backend "[1]" {
    storage_account_name = "mystorageaccount"
    container_name       = "[2]"
    key                  = "[3]"
  }
}
Drag options to blanks, or click blank then click option'
Aazurerm
Btfstate
Cterraform.tfstate
Dstatefiles
Attempts:
3 left
💡 Hint
Common Mistakes
Using 's3' instead of 'azurerm' for Azure backend.
Incorrect container or key names causing state file errors.