Which operation is used to bring an existing resource under Terraform management?

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

Which operation is used to bring an existing resource under Terraform management?

Explanation:
Importing a resource brings something that already exists into Terraform's state so Terraform can manage it going forward. Importing does not create or modify the real resource on its own—the resource remains as-is in the infrastructure—but Terraform records it in its state and associates it with a matching resource block in your configuration. After import, Terraform can plan and apply changes to bring the real resource in line with your configuration, or confirm that they already match. In practice, you use an import command to map the existing resource to a Terraform resource address (like aws_instance.web) and the provider-specific ID (such as an AWS instance ID). Once the resource is in the state, Terraform can track drift and apply updates as needed. The other operations serve different purposes: planning shows what would happen, applying executes changes, and destroying removes resources.

Importing a resource brings something that already exists into Terraform's state so Terraform can manage it going forward. Importing does not create or modify the real resource on its own—the resource remains as-is in the infrastructure—but Terraform records it in its state and associates it with a matching resource block in your configuration. After import, Terraform can plan and apply changes to bring the real resource in line with your configuration, or confirm that they already match.

In practice, you use an import command to map the existing resource to a Terraform resource address (like aws_instance.web) and the provider-specific ID (such as an AWS instance ID). Once the resource is in the state, Terraform can track drift and apply updates as needed. The other operations serve different purposes: planning shows what would happen, applying executes changes, and destroying removes resources.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy