To move a resource name in the state from htp to http without destroying the resource, which command would you use?

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

To move a resource name in the state from htp to http without destroying the resource, which command would you use?

Explanation:
Renaming a resource in the state to match a new address without affecting the real resource is done by updating the state itself. Terraform tracks each managed resource by its address in the state file, so when you change the address in your configuration, you need to tell Terraform to move that resource’s entry in the state rather than recreate or destroy it. The command moves the resource from its old address to the new one in the state while leaving the actual AWS security group unchanged. This keeps the resource’s identity intact and prevents an unnecessary destroy-recreate during the next apply. After performing this move, Terraform will recognize the resource under the new address in future plans and applies. Other options don’t achieve this. Applying the configuration would apply changes but won’t fix the state-address mismatch. Refreshing updates the state from real infrastructure but doesn’t rename any resource in the state. So the correct action is to move the resource's state entry to reflect the new name.

Renaming a resource in the state to match a new address without affecting the real resource is done by updating the state itself. Terraform tracks each managed resource by its address in the state file, so when you change the address in your configuration, you need to tell Terraform to move that resource’s entry in the state rather than recreate or destroy it.

The command moves the resource from its old address to the new one in the state while leaving the actual AWS security group unchanged. This keeps the resource’s identity intact and prevents an unnecessary destroy-recreate during the next apply. After performing this move, Terraform will recognize the resource under the new address in future plans and applies.

Other options don’t achieve this. Applying the configuration would apply changes but won’t fix the state-address mismatch. Refreshing updates the state from real infrastructure but doesn’t rename any resource in the state. So the correct action is to move the resource's state entry to reflect the new name.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy