Interview Prep/Terraform/Plan Errors and Unexpected Replacements

`Error: Unsupported attribute` on `module.vpc.private_subnets` — `This object does not have an attribute named "private_subnets"`.

BeginnerTroubleshootingPlan Errors and Unexpected Replacements
Answer

Likely causes → The module doesn't declare that output, or it's named differently (private_subnet_ids), or you upgraded the module and the output was renamed.

Diagnose → grep -rn '^output' .terraform/modules/vpc/outputs.tf (for registry modules) or the module's README.

Fix → Use the correct output name, or add the output to your module.

Prevent → Treat module outputs as an API; changing them is a breaking change with a major version bump.

All Terraform questions

More on Plan Errors and Unexpected Replacements