HashiCorp
TA-002-P · Question #202
Dawn has created the below child module. Without changing the module, can she override the instance_type from t2.micro to t2.large form her code while calling this module? 1. resource "aws_instance"…
The correct answer is B. No. As the instance_type is hard-coded in source module, you will not be able to change its value from destination module. Instead of hard-coding you should use variable with default values.
Interact with Terraform modules
Question
Dawn has created the below child module. Without changing the module, can she override the instance_type from t2.micro to t2.large form her code while calling this module? 1. resource "aws_instance" "myec2" 2. { 3. ami = "ami-082b5a644766e0e6f" 4. instance_type = "t2.micro 5. }
Options
- AYES
- BNo
How the community answered
(20 responses)- A10% (2)
- B90% (18)
Explanation
As the instance_type is hard-coded in source module, you will not be able to change its value from destination module. Instead of hard-coding you should use variable with default values.
Topics
#Terraform modules#Module input variables#Resource configuration#Hardcoded values
Community Discussion
No community discussion yet for this question.