0
0
Terraformcloud~20 mins

Azure Storage backend in Terraform - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Azure Storage Backend Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Configuration
intermediate
2:00remaining
Identify the correct Terraform backend configuration for Azure Storage
Which option correctly configures Terraform to use an Azure Storage Account as the backend with container 'tfstate' and key 'prod.terraform.tfstate'?
A
terraform {
  backend "azure" {
    resource_group = "rg-terraform"
    storage_account = "stterraform"
    container = "tfstate"
    key = "prod.terraform.tfstate"
  }
}
B
terraform {
  backend "azurerm" {
    resource_group_name  = "rg-terraform"
    storage_account_name = "stterraform"
    container_name       = "tfstate"
    key                  = "prod.terraform.tfstate"
  }
}
C
terraform {
  backend "azurerm" {
    resource_group_name  = "rg-terraform"
    storage_account_name = "stterraform"
    container_name       = "terraform"
    key                  = "prod.tfstate"
  }
}
D
}
}  
"etatsft.mrofarret.dorp" =                  yek    
"etatsft" =       eman_reniatnoc    
"mrofarretts" = eman_tnuocca_egarots    
"mrofarret-gr" =  eman_puorg_ecruoser    
{ "mreruza" dnekcab  
{ mrofarret
Attempts:
2 left
💡 Hint
Check the exact backend type name and parameter names required by Terraform for Azure Storage backend.
service_behavior
intermediate
2:00remaining
What happens if the Azure Storage backend container does not exist?
When Terraform initializes with an Azure Storage backend and the specified container does not exist, what is the expected behavior?
ATerraform initialization fails with an error indicating the container does not exist.
BTerraform automatically creates the container in the storage account during initialization.
CTerraform ignores the missing container and proceeds without remote state storage.
DTerraform creates a new storage account with the container automatically.
Attempts:
2 left
💡 Hint
Consider whether Terraform manages Azure Storage containers automatically.
security
advanced
2:00remaining
Securely configuring access to Azure Storage backend
Which option is the most secure way to provide credentials for Terraform to access the Azure Storage backend?
AUse a shared access signature (SAS) token embedded in the backend configuration file.
BHardcode the storage account access key directly in the backend configuration in the Terraform file.
CUse the Azure CLI logged-in user credentials without any environment variables or config.
DSet the environment variables ARM_CLIENT_ID, ARM_CLIENT_SECRET, and ARM_TENANT_ID with a service principal's credentials.
Attempts:
2 left
💡 Hint
Think about best practices for managing secrets and automation.
Architecture
advanced
2:00remaining
Designing a multi-environment Terraform state backend in Azure Storage
You want to manage multiple environments (dev, staging, prod) using a single Azure Storage account for Terraform state. Which backend configuration approach correctly isolates state files per environment?
AUse the same container and key for all environments, e.g., container_name = "tfstate", key = "terraform.tfstate".
BUse different storage accounts per environment with the same container and key names.
CUse the same container but different keys per environment, e.g., container_name = "tfstate", key = "dev.tfstate", "staging.tfstate", "prod.tfstate".
DUse different containers per environment, e.g., container_name = "dev", "staging", "prod" with the same key "terraform.tfstate".
Attempts:
2 left
💡 Hint
Consider how Terraform identifies state files uniquely in the backend.
🧠 Conceptual
expert
2:00remaining
Understanding Terraform state locking with Azure Storage backend
How does Terraform ensure that only one user or process modifies the remote state at a time when using Azure Storage backend?
ATerraform uses Azure Blob Storage's blob lease feature to lock the state file during operations.
BTerraform creates a lock file in the container that users must manually delete after changes.
CTerraform relies on Azure Active Directory permissions to prevent concurrent access.
DTerraform does not support state locking with Azure Storage backend; users must coordinate manually.
Attempts:
2 left
💡 Hint
Think about how Azure Blob Storage supports concurrency control.