TERRAFORM-ASSOCIATE-004 · Question #214
TERRAFORM-ASSOCIATE-004 Question #214: Real Exam Question with Answer & Explanation
The correct answer is B: kubernetes_namespace.example.name. In Terraform, the correct way to reference a resource attribute is: resource_type.resource_name.attribute For example, if the resource block is: resource "kubernetes_namespace" "example" { name = "my-namespace" To reference the name attribute, use: kubernetes_namespace.example.na
Question
A resource block is shown in the Exhibit section of this page. How would you reference the attribute name of this resource in HCL?
Options
- Aresource.kubernetes_namespace.example.name
- Bkubernetes_namespace.example.name
- Cdata.kubernetes.namespace.name
- Dkubernetes_namespace.test.name
Explanation
In Terraform, the correct way to reference a resource attribute is: resource_type.resource_name.attribute For example, if the resource block is: resource "kubernetes_namespace" "example" { name = "my-namespace" To reference the name attribute, use: kubernetes_namespace.example.name Explanation of incorrect answers: A (resource.kubernetes_namespace.example.name) - Incorrect. Terraform does not use the resource. prefix when referencing resources. C (data.kubernetes.namespace.name) - Incorrect. This syntax is used for data sources, not D (kubernetes_namespace.test.name) - Incorrect. The resource name is";exampl";, not";tes";.
Topics
Community Discussion
No community discussion yet for this question.