HashiCorp
TA-002-P · Question #247
Given the Terraform configuration below, in which order will the resources be created? 1. resource "aws_instance" "web_server" 2. { 3. ami = "ami-b374d5a5" 4. instance_type = "t2.micro" 5. } 6. resour
The correct answer is D. aws_instance will be created first. See the full explanation below for the reasoning.
Understand Terraform basics
Question
Given the Terraform configuration below, in which order will the resources be created? 1. resource "aws_instance" "web_server" 2. { 3. ami = "ami-b374d5a5" 4. instance_type = "t2.micro" 5. } 6. resource "aws_eip" "web_server_ip" 7. { 8. vpc = true instance = aws_instance.web_server.id 9. }
Options
- Aaws_eip will be created first
- Baws_eip will be created first
- CResources will be created simultaneously
- Daws_instance will be created first
How the community answered
(23 responses)- B9% (2)
- C4% (1)
- D87% (20)
Topics
#Terraform dependencies#Resource creation order#Implicit dependencies#Dependency graph
Community Discussion
No community discussion yet for this question.