Which command adds existing resources to the Terraform state?

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

Which command adds existing resources to the Terraform state?

Explanation:
To bring resources that already exist into Terraform’s management, you import them into the state. The command that does this associates a real-world resource with a resource block in your configuration and updates the state file accordingly. It doesn’t create or modify the resource by itself; instead, it makes Terraform aware of the existing resource so you can manage it going forward. After importing, you’ll typically run plan to see what Terraform would do next and adjust your configuration to reflect the actual attributes. The other commands serve different tasks: validate checks syntax and references, plan shows what changes would occur, and apply makes those changes. Import is the one that adds an existing resource to the state, enabling Terraform to manage it.

To bring resources that already exist into Terraform’s management, you import them into the state. The command that does this associates a real-world resource with a resource block in your configuration and updates the state file accordingly. It doesn’t create or modify the resource by itself; instead, it makes Terraform aware of the existing resource so you can manage it going forward. After importing, you’ll typically run plan to see what Terraform would do next and adjust your configuration to reflect the actual attributes. The other commands serve different tasks: validate checks syntax and references, plan shows what changes would occur, and apply makes those changes. Import is the one that adds an existing resource to the state, enabling Terraform to manage it.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy