Rationale for Correct Answer: To bring existing infrastructure under Terraform management, Terraform needs both a matching resource block in the configuration and an import declaration or import command that maps the real cloud object to the Terraform resource address. With modern configuration-driven import, you add an import block and a corresponding resource block, then run Terraform to import the object into state.
Analysis of Incorrect Options (Distractors):
A. Pick the two correct responses below. Incorrect. This is an instruction, not an action.
B. Run terraform state pull. Incorrect. This only downloads and displays the current state. It does not import existing cloud resources.
E. Run terraform apply -refresh-only. Incorrect. Refresh-only updates Terraform state for resources already managed in state. It does not import unmanaged VMs.
Key Concept: Existing infrastructure must be imported into Terraform state and represented in Terraform configuration before Terraform can manage it.
[Reference: Terraform Objective Domain: Use Terraform to Manage Infrastructure, ====================, ]
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit