TA-002-P · Question #395
Resources in terraform can have same identifiers(Resource type + Block name).
The correct answer is B. False. In Terraform, every resource block must have a unique combination of resource type and local name within a module; duplicate identifiers are not permitted and cause an immediate parse error.
Question
Resources in terraform can have same identifiers(Resource type + Block name).
Options
- ATrue
- BFalse
How the community answered
(37 responses)- A8% (3)
- B92% (34)
Why each option
In Terraform, every resource block must have a unique combination of resource type and local name within a module; duplicate identifiers are not permitted and cause an immediate parse error.
True is incorrect because Terraform enforces uniqueness of the resource type and block name pair within a module, and duplicate identifiers result in an immediate configuration parsing failure.
Terraform requires that each resource be uniquely addressed by its type and name combination (e.g., aws_instance.web). If two resources shared the same type and block name, Terraform could not distinguish them and would produce a configuration error at parse time, so the statement that they can share identifiers is false.
Concept tested: Terraform resource identifier uniqueness requirement
Source: https://developer.hashicorp.com/terraform/language/resources/syntax
Topics
Community Discussion
No community discussion yet for this question.