TA-002-P · Question #69
What is the name assigned by Terraform to reference this resource?
The correct answer is A. compute_instance. Terraform references a resource using its resource type and a local name defined within the resource block. In the provided configuration, google_compute_instance is the type and compute_instance is the local name used for referencing.
Question
What is the name assigned by Terraform to reference this resource?
Options
- Acompute_instance
- Bmain
- Cgoogle
- Dteat
How the community answered
(62 responses)- A87% (54)
- B6% (4)
- C3% (2)
- D3% (2)
Why each option
Terraform references a resource using its resource type and a local name defined within the resource block. In the provided configuration, `google_compute_instance` is the type and `compute_instance` is the local name used for referencing.
In Terraform's resource block syntax, `resource "<RESOURCE_TYPE>" "<LOCAL_NAME>" { ... }`, the local name `compute_instance` is assigned by the user to uniquely identify and reference this specific instance of the `google_compute_instance` resource within the configuration.
"main" is commonly a filename for Terraform configurations, not the name assigned to reference a resource itself.
"google" typically refers to the cloud provider block or the provider itself, not a specific resource name.
"teat" is not present in the provided Terraform configuration block and is irrelevant to resource naming.
Concept tested: Terraform resource addressing and naming
Source: https://developer.hashicorp.com/terraform/language/resources
Topics
Community Discussion
No community discussion yet for this question.