1. A developer writes the following Terraform configuration: ```hcl variable "enable_monitoring" { type = bool default = false } resource "aws_instance" "web" { ami = "ami-0abcdef1234567890" instance_type = var.enable_monitoring ? "t3.large" : "t3.micro" } ``` The developer runs `terraform apply` without passing any variable values. What instance type will be used?
- A. t3.large, because bool variables default to true
- B. t3.micro, because the default value of enable_monitoring is false✓ Correct
- C. An error occurs because conditional expressions require explicit variable values
- D. t3.large, because the ternary operator always evaluates the first branch first
Explanation
**t3.micro** is correct. The variable `enable_monitoring` defaults to `false`, so the conditional expression `false ? "t3.large" : "t3.micro"` evaluates to `"t3.micro"`. **t3.large** (first option) is wrong because `bool` variables do not default to `true` unless explicitly set. **An error occurs** is wrong — Terraform's ternary/conditional expression works perfectly with default variable values; no explicit value is required. **t3.large** (last option) is wrong — the ternary operator evaluates the condition, not just the first branch unconditionally.