0
0
Terraformcloud~10 mins

Azure provider setup 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 set the location for an Azure resource group in Terraform.

Terraform
resource "azurerm_resource_group" "example" {
  name     = "example-resources"
  [1] = "eastus"
}
Drag options to blanks, or click blank then click option'
Azone
Bregion
Clocation
Darea
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'region' instead of 'location' causes Terraform to fail.
Using 'zone' or 'area' are not valid attributes for the azurerm_resource_group resource.
2fill in blank
medium

Complete the code to authenticate with Azure using a service principal.

Terraform
provider "azurerm" {
  features = {}
  client_id     = var.client_id
  client_secret = var.[1]
  tenant_id     = var.tenant_id
  subscription_id = var.subscription_id
}
Drag options to blanks, or click blank then click option'
Aclient_secret
Bpassword
Csecret_key
Daccess_token
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'password' or 'secret_key' instead of 'client_secret' causes authentication errors.
Using 'access_token' is not valid in this context.
3fill in blank
hard

Fix the error in the provider block to enable Azure Resource Manager features.

Terraform
provider "azurerm" {
  features = [1]
}
Drag options to blanks, or click blank then click option'
A[]
Bnull
Ctrue
D{}
Attempts:
3 left
💡 Hint
Common Mistakes
Using [] causes a type error.
Using true or null causes configuration errors.
4fill in blank
hard

Fill both blanks to configure the Azure provider with environment variables.

Terraform
provider "azurerm" {
  features = [1]
  subscription_id = var.[2]
}
Drag options to blanks, or click blank then click option'
A{}
Bsubscription_id
Ctenant_id
Dclient_id
Attempts:
3 left
💡 Hint
Common Mistakes
Using a list or boolean for features.
Using tenant_id or client_id instead of subscription_id for subscription.
5fill in blank
hard

Fill all three blanks to complete the Azure provider block with authentication details.

Terraform
provider "azurerm" {
  features = [1]
  client_id = var.[2]
  client_secret = var.[3]
}
Drag options to blanks, or click blank then click option'
A{}
Bclient_id
Cclient_secret
Dtenant_id
Attempts:
3 left
💡 Hint
Common Mistakes
Using tenant_id instead of client_secret for the secret.
Omitting the features argument or setting it incorrectly.