The plan shows `known after apply` on a module output, and every consumer resource now shows "must be replaced".
IntermediateTroubleshootingPlan Errors and Unexpected Replacements
Answer
Likely causes → A change inside the module (or module depends_on) makes an output unknown; consumers using it in forcing arguments (like subnet_id) are planned for replacement because the value might change.
Diagnose → Trace which output is unknown and why: terraform show -json tfplan | jq '.resource_changes[] | select(.change.actions|index("delete")) | .address'.
Fix → Remove the cause of the unknown (often a needless depends_on, or a replacing resource upstream); apply the upstream change first with a targeted apply if needed.
Prevent → Keep module outputs derived from stable attributes, and avoid module-level depends_on.
More on Plan Errors and Unexpected Replacements
`Error: Invalid for_each argument` — `The "for_each" map includes keys derived from resource attributes that cannot be determined until apply`.Intermediate`The given "for_each" argument value is unsuitable: the "for_each" argument must be a map, or set of strings, and you have provided a value of type list of string.`Beginner`Error: Invalid for_each argument` — `Sensitive values, or values derived from sensitive values, cannot be used as for_each arguments.`Intermediate`Error: Invalid count argument` — `The "count" value depends on resource attributes that cannot be determined until apply`.Intermediate`Error: Unsupported attribute` — `This object has no argument, nested block, or exported attribute named "public_ip_address"`.Beginner`Error: Unsupported attribute` on `module.vpc.private_subnets` — `This object does not have an attribute named "private_subnets"`.Beginner