Terraform take note
How Terraform modules and variables interact is spot on. 1. The “Contract” (The Module): Inside the ../../modules/app-common-infra folder, there are variable “xxx” {} blocks. These act like a function signature in programming. They define: What information is required (e.g., vpc_cidr, resource_prefix). The data type (string, list, map). Any default values. 2. The “Implementation” (The .tf files inside the modules): Files like iam.tf, lambda.tf, and lb.tf inside that module folder don’t use hardcoded values. Instead, they use var.xxx. Example: If iam.tf needs to name a role, it might use name = "${var.resource_prefix}-role". This makes the module reusable because it doesn’t care what the prefix is until you tell it. ...