nerdexam
HashiCorpHashiCorp

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

Submitted by obi.ng· Apr 18, 2026Work with Terraform Configurations

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

#HCL#Resource Referencing#Attributes#Syntax

Community Discussion

No community discussion yet for this question.

Full TERRAFORM-ASSOCIATE-004 PracticeBrowse All TERRAFORM-ASSOCIATE-004 Questions