\n## Why Collection Functions Matter\n\nAs soon as your Terraform configuration moves beyond a few hardcoded resources, you start working with collections of values rather than isolated strings.\n\nTypical examples include:\n\n- a list of subnet CIDR blocks\n- a map of environment settings\n- a set of allowed regions\n- a list of bucket definitions\n- merged tags from multiple sources\n\nTerraform collection functions help you shape that data into the exact form your resources, modules, and outputs need. They are especially important because cloud infrastructure is often repetitive but not perfectly uniform. You may need to combine lists, remove duplicates, merge maps, convert input types, or build a new collection dynamically from an old one.\n\nOnce you understand these functions, Terraform starts to feel far more expressive. Instead of repeating logic manually, you can transform data declaratively and keep your configuration compact.\n\nA useful mental model is that collection functions sit between raw input and final resource arguments. Variables, module inputs, and data sources often provide values in a shape that is convenient for humans but not ideal for direct use in resources. Collection functions help you clean, combine, filter, and restructure that data so the rest of the configuration stays easier to read.\n\n## List Functions\n\nLists are ordered collections. Terraform includes several functions that help you combine, filter, inspect, and reorganize them.\n\n## concat()\n\nconcat() combines multiple lists into one list.\n\n```hcl\nconcat(["subnet-a"], ["subnet-b", "subnet-c\
Learn Terraform dynamic blocks: generate repeated nested blocks from a collection, with security group and IAM policy examples and the limits to respect.
Learn how Terraform workspaces separate state, the workspace new, select and list commands, terraform.workspace in code, and when to avoid them.
Configure the Terraform AWS provider, authenticate without long-lived keys using assume role and OIDC, manage regions and accounts, and tag everything.