Interview Prep/Terraform/Modules, Variables, Sensitive Values and Workspaces

Two module instances in the same account fail on second create with `already exists` errors for IAM roles and log groups.

IntermediateTroubleshootingModules, Variables, Sensitive Values and Workspaces
Answer

Likely causes → The module hardcodes names (name = "app-role") instead of building them from inputs; each instance tries the same name.

Diagnose → grep -rn 'name\s*=\s*"' modules/app/

Fix → Build names from a name/env input or use name_prefix.

Prevent → Module guideline: every globally or account-unique name must derive from inputs.

All Terraform questions Roadmap: Terraform

More on Modules, Variables, Sensitive Values and Workspaces