A team has written import blocks for 40 legacy resources but has no resource blocks for them yet. They want Terraform to draft the resource configuration so they do not have to write every argument by hand. Which workflow is correct?
Select an answer to reveal the explanation.
Short Explanation
Think of generated configuration as a first draft written by a fast but careless intern. It saves you hours of typing, but you'd never ship it without reading it. Point it at a brand-new file, too; aim it at your existing main.tf and Terraform just errors out.
Full Explanation
When import blocks exist without matching resource blocks, terraform plan with -generate-config-out asks Terraform to write HCL for those resources, using the attribute values the provider returns. The path must not already exist; pointing it at main.tf or any existing file makes Terraform error rather than append. HashiCorp marks configuration generation as experimental and tells you to review and update the output: generated code can contain conflicting arguments that the provider will reject, hardcoded values that should become variables or references, and, for complex schemas, incomplete settings. Applying the draft unchanged in the same run skips that review and can fail or encode values nobody intended to keep. terraform show -json prints a JSON representation of state or a saved plan; it neither emits HCL nor knows about objects that are not yet tracked. Exam caveat: generation applies only to resources named by import blocks; it does not discover anything on its own. Operational check: after editing, run terraform plan again and confirm each resource shows only an import, with no create, replace or unexpected update, before applying.