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

Prepare for the HashiCorp Terraform Associate Exam. Utilize flashcards and multiple-choice questions with detailed hints and explanations. Boost your confidence and be ready for success!

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