You've transitioned from a single Terraform user to a team of DevOps engineers all using Terraform for various projects. The team has decided to utilize a remote backend for maintaining Terraform state. They've opted for Azure Blob Storage and require state locking. Which of the following Terraform backend configurations fulfills these requirements?
tap to flip
Answer
backend "s3" { bucket = "azure-tfstate-bucket" key = "project.terraform.tfstate" region = "eastus" }
backend "azurerm" { resource_group_name = "tfstate-resources" storage_account_name = "terraformstateacc" container_name = "tfstate-container" key = "project.terraform.tfstate" }
backend "azurerm" { resource_group_name = "tfstate-resources" storage_account_name = "terraformstateacc" container_name = "tfstate-container" key = "project.terraform.tfstate" arm_client_id = "client-id" arm_client_secret = "client-secret" }
backend "azurerm" { resource_group_name = "tfstate-resources" storage_account_name = "terraformstateacc" container_name = "tfstate-container" key = "project.terraform.tfstate" state_locking = false }
Explanation
The configuration uses the "azurerm" backend, specifies all required parameters, and provides credentials for Azure. The first incorrect option uses backend "s3" which is for AWS. The second is missing Azure credentials. The last one explicitly turns off state locking.