Interview Prep/Terraform/Import, Already Exists and State Surgery

`terraform plan -generate-config-out=generated.tf` fails with `Conflicting configuration arguments` in the generated file.

IntermediateTroubleshootingImport, Already Exists and State Surgery
Answer

Likely causes → The generator writes every attribute it reads, including mutually exclusive ones (for example ipv6_cidr_block and ipv6_ipam_pool_id, or both name and name_prefix).

Diagnose → Read each error's attribute pair.

Fix → Delete the conflicting/computed arguments from generated.tf (keep the one you actually set), then run terraform plan again. The file remains; re-running with the same -generate-config-out path errors because the file exists.

Prevent → Treat generated config as a draft. Refactor it into variables and modules before merge.

All Terraform questions Roadmap: Terraform in production

More on Import, Already Exists and State Surgery