HashiCorp
TA-002-P · Question #235
Consider the following Terraform 0.12 configuration snippet: 1. variable "vpc_cidrs" { 2. type = map 3. default = { 4. us-east-1 = "10.0.0.0/16" 5. us-east-2 = "10.1.0.0/16" 6. us-west-1 = "10.2.0.0/1
Sign in or unlock TA-002-P to reveal the answer and full explanation for question #235. The question stem and answer options stay visible for context.
Read, generate, and modify configuration
Question
Consider the following Terraform 0.12 configuration snippet: 1. variable "vpc_cidrs" { 2. type = map 3. default = { 4. us-east-1 = "10.0.0.0/16" 5. us-east-2 = "10.1.0.0/16" 6. us-west-1 = "10.2.0.0/16" 7. us-west-2 = "10.3.0.0/16" 8. } 9. } 10. 11. resource "aws_vpc" "shared" { 12. cidr_block = _____________ 13. } How would you define the cidr_block for us-east-1 in the aws_vpc resource using a variable?
Options
- Avar.vpc_cidrs.0
- Bvpc_cidrs["us-east-1"]
- Cvar.vpc_cidrs["us-east-1"]
- Dvar.vpc_cidrs[0]
Unlock TA-002-P to see the answer
You've previewed enough free TA-002-P questions. Unlock TA-002-P for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.
Topics
#Terraform variables#Map type#Accessing map elements#HCL syntax