Challenge - 5 Problems
Terraform JSON Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Configuration
intermediate2:00remaining
Identify the correct JSON equivalent of a Terraform resource block
Given the following Terraform HCL resource block, which JSON configuration correctly represents it?
resource "aws_s3_bucket" "example" {
bucket = "my-bucket"
acl = "private"
}Attempts:
2 left
💡 Hint
Remember that Terraform JSON uses nested objects under "resource" with resource type and name keys.
✗ Incorrect
Terraform JSON configuration requires a top-level "resource" key, then resource type, then resource name as nested objects. The properties must match the HCL keys exactly.
❓ service_behavior
intermediate1:30remaining
What happens if a required attribute is missing in Terraform JSON config?
If you omit a required attribute like "bucket" in the JSON configuration for an aws_s3_bucket resource, what will Terraform do when you run apply?
Attempts:
2 left
💡 Hint
Think about how Terraform validates required fields before creating resources.
✗ Incorrect
Terraform validates required attributes before applying. Missing required attributes cause errors and prevent apply.
❓ Architecture
advanced2:30remaining
How to represent multiple resources in Terraform JSON configuration?
You want to define two aws_s3_bucket resources named "bucket1" and "bucket2" in Terraform JSON. Which JSON snippet correctly represents this?
Attempts:
2 left
💡 Hint
Remember JSON keys must be unique; multiple resources of the same type are nested under the same resource type key.
✗ Incorrect
Terraform JSON groups multiple resources of the same type under one resource type key with unique resource names as keys.
❓ security
advanced2:00remaining
How to securely manage sensitive variables in Terraform JSON configuration?
You have a sensitive variable like a database password. Which approach is best to avoid exposing it directly in Terraform JSON configuration files?
Attempts:
2 left
💡 Hint
Think about how Terraform handles sensitive data securely without exposing it in config files.
✗ Incorrect
Terraform recommends using environment variables or remote workspace variables to keep sensitive data out of config files.
🧠 Conceptual
expert1:30remaining
What is the main difference between Terraform HCL and JSON configuration formats?
Which statement best describes the key difference between Terraform's HCL and JSON configuration formats?
Attempts:
2 left
💡 Hint
Consider readability and syntax features of both formats.
✗ Incorrect
HCL is designed for humans with comments and simpler syntax. JSON is strict, no comments, and more verbose.