What is the name assigned by Terraform to reference this resource? (Example in the configuration)

Prepare for the HashiCorp Terraform Associate Exam with quizzes, flashcards, and multiple-choice questions. Each question includes hints and explanations. Boost your confidence and ace your exam!

Multiple Choice

What is the name assigned by Terraform to reference this resource? (Example in the configuration)

Explanation:
Terraform assigns a local name to each resource block, and that local name is what you use to reference the resource in the rest of the configuration. The syntax is resource "<provider>_<resource_type>" "<local_name>" { ... }. In your example, the resource is defined with the local name main, so you reference it as google_compute_instance.main (for attributes like id or IP). The other strings shown are not the reference name—they’re the provider/resource type and a non-used local name. So the name assigned to reference this resource is main.

Terraform assigns a local name to each resource block, and that local name is what you use to reference the resource in the rest of the configuration. The syntax is resource "_" "" { ... }. In your example, the resource is defined with the local name main, so you reference it as google_compute_instance.main (for attributes like id or IP). The other strings shown are not the reference name—they’re the provider/resource type and a non-used local name. So the name assigned to reference this resource is main.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy