0
0
Terraformcloud~20 mins

Provider configuration block in Terraform - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Provider Configuration Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding provider alias usage in Terraform

In Terraform, when you configure multiple provider blocks with aliases, what is the main purpose of using the alias attribute?

ATo allow using multiple configurations of the same provider within a single Terraform configuration.
BTo rename the provider globally across all Terraform modules.
CTo specify the version of the provider to use.
DTo enable automatic provider installation.
Attempts:
2 left
💡 Hint

Think about scenarios where you need to connect to different accounts or regions using the same provider.

Configuration
intermediate
2:00remaining
Identifying correct provider block syntax

Which of the following Terraform provider blocks is correctly configured to use AWS provider version 4.0 with region us-west-2?

A
provider "aws" {
  version = "~> 4.0"
  region  = "us-west-2"
}
B
provider "aws" {
  required_version = "~> 4.0"
  region = "us-west-2"
}
C
provider "aws" {
  version = "4.0"
  region = "us-west-2"
}
D
provider "aws" {
  version = "^4.0"
  region = "us-west-2"
}
Attempts:
2 left
💡 Hint

Check the correct attribute name for specifying provider version inside the provider block.

Architecture
advanced
2:30remaining
Choosing provider configuration for multi-region deployment

You want to deploy resources in two AWS regions: us-east-1 and eu-central-1, using Terraform. Which provider configuration setup allows you to manage resources in both regions within the same Terraform project?

ADefine a single provider block with region set to eu-central-1 and use environment variables to switch regions.
BDefine a single provider block with region set to us-east-1, and override region in each resource.
CDefine two provider blocks without aliases, each with a different region, and Terraform will auto-select based on resource location.
DDefine two provider blocks with aliases, each specifying a different region, and reference the alias in resources.
Attempts:
2 left
💡 Hint

Think about how Terraform distinguishes between multiple provider configurations of the same type.

security
advanced
2:00remaining
Securing provider credentials in Terraform

Which of the following is the best practice for managing sensitive credentials in a Terraform provider configuration?

AUse environment variables or external secret management tools to supply credentials at runtime.
BEmbed credentials in resource tags for easy access.
CStore credentials in plain text files checked into version control.
DHardcode credentials directly in the provider block in the Terraform configuration file.
Attempts:
2 left
💡 Hint

Consider security risks of exposing credentials in code repositories.

service_behavior
expert
2:00remaining
Effect of missing provider block on resource deployment

What happens if you define an AWS resource in Terraform but do not include any AWS provider block in your configuration?

ATerraform will automatically use default provider settings and deploy the resource in the default region.
BTerraform will raise an error during plan/apply stating the provider configuration is missing.
CTerraform will deploy the resource using the last used provider configuration from cache.
DTerraform will deploy the resource but with no authentication, causing runtime failure.
Attempts:
2 left
💡 Hint

Think about how Terraform knows which provider to use for resources.