nerdexam
HashiCorp

TA-002-P · Question #49

What is the name assigned by Terraform to reference this resource?

The correct answer is D. test. In a Terraform resource block, the local name is used to reference that specific instance of a resource within the configuration.

Understand Terraform basics

Question

What is the name assigned by Terraform to reference this resource?

Options

  • Adev
  • Bazurerm_resource_group
  • Cazurerm
  • Dtest

How the community answered

(43 responses)
  • A
    7% (3)
  • B
    2% (1)
  • C
    2% (1)
  • D
    88% (38)

Why each option

In a Terraform resource block, the local name is used to reference that specific instance of a resource within the configuration.

Adev

`dev` is not a standard component or identifier for referencing a resource based on the common Terraform resource block structure.

Bazurerm_resource_group

`azurerm_resource_group` refers to the *resource type*, which specifies what kind of resource is being managed, not the unique local name of a specific instance.

Cazurerm

`azurerm` refers to the *provider name*, which indicates the cloud or service Terraform is interacting with, not the local name of a resource.

DtestCorrect

In a Terraform resource block like `resource "type" "name" { ... }`, the string `"name"` (in this case, 'test') is the local name assigned by the user to reference that specific resource instance throughout the configuration.

Concept tested: Terraform resource block naming and referencing

Source: https://developer.hashicorp.com/terraform/language/resources/syntax

Topics

#Terraform syntax#Resource block#Resource naming#Configuration basics

Community Discussion

No community discussion yet for this question.

Full TA-002-P Practice