0
0
Terraformcloud~20 mins

AWS provider setup in Terraform - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
AWS Provider Setup Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Configuration
intermediate
2:00remaining
Identify the correct AWS provider configuration for a specific region
Which AWS provider configuration will correctly set the region to us-west-2 and use the default profile from your AWS credentials file?
A
provider "aws" {
  region = "us-west-2"
  profile = "default-profile"
}
B
}
"tluafed" = eliforp  
"2-tsew-su" = noiger  
{ "swa" redivorp
C
provider "aws" {
  region = "us-west-2"
  profile = "default"
}
D
provider "aws" {
  region = "us-west-2"
  access_key = "default"
}
Attempts:
2 left
💡 Hint
Remember that region and profile values must be strings enclosed in quotes.
service_behavior
intermediate
2:00remaining
Determine the effect of missing AWS provider region in Terraform
What happens if you configure the AWS provider in Terraform without specifying a region and no environment variables or default region are set?
ATerraform will deploy resources to a random AWS region.
BTerraform will default to us-east-1 region automatically.
CTerraform will use the region from the AWS CLI configuration file regardless of environment variables.
DTerraform will throw an error during plan/apply stating that region is not configured.
Attempts:
2 left
💡 Hint
Think about what Terraform requires to know where to deploy resources.
security
advanced
2:00remaining
Choose the safest way to provide AWS credentials to Terraform
Which option is the most secure and recommended way to provide AWS credentials to Terraform when running on a developer's local machine?
AUse AWS CLI configured profiles and specify the profile in the provider block.
BUse environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY set in the shell.
CHardcode AWS access key and secret key directly in the Terraform provider block.
DStore credentials in a shared Terraform variables file checked into version control.
Attempts:
2 left
💡 Hint
Think about avoiding exposing secrets in code or version control.
Architecture
advanced
2:00remaining
Select the correct Terraform AWS provider configuration for multi-account setup
You manage multiple AWS accounts and want to deploy resources to two accounts using Terraform. Which provider configuration allows you to switch between accounts using profiles named 'dev' and 'prod'?
A
provider "aws" {
  profile = "dev"
  region = "us-east-1"
}

provider "aws" {
  profile = "prod"
  region = "us-east-1"
}
B
provider "aws" {
  alias = "dev"
  profile = "dev"
  region = "us-east-1"
}

provider "aws" {
  alias = "prod"
  profile = "prod"
  region = "us-east-1"
}
C
provider "aws" {
  profile = "dev,prod"
  region = "us-east-1"
}
D
provider "aws" {
  alias = "dev-prod"
  profile = "dev-prod"
  region = "us-east-1"
}
Attempts:
2 left
💡 Hint
Think about how Terraform handles multiple provider configurations with aliases.
🧠 Conceptual
expert
2:00remaining
Understand the impact of provider version constraints in Terraform AWS provider
Given the following Terraform provider block, what is the effect of the version constraint on provider installation and upgrades? provider "aws" { version = ">= 4.0, < 5.0" region = "us-east-1" }
ATerraform will install any AWS provider version from 4.0 up to but not including 5.0, allowing minor and patch upgrades but preventing major upgrades.
BTerraform will only install version 4.0 exactly, no other versions.
CTerraform will install the latest AWS provider version regardless of version number.
DTerraform will install any version including 5.0 and above.
Attempts:
2 left
💡 Hint
Think about semantic versioning and how version constraints work in Terraform.