> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Supporting Files accountregionenvcommonhcl

> Centralizing account, region, environment, and common HCL files to reuse configuration and improve maintainability in Terragrunt repositories

Supporting files make Terragrunt repositories more maintainable by centralizing account-, region-, environment-, and global-level configuration. In a Terragrunt-driven workflow these files typically expose `locals` that multiple `terragrunt.hcl` modules can read with `read_terragrunt_config` and `find_in_parent_folders`, avoiding duplication and making updates predictable across many modules.

A quick summary of each file's role:

* account.hcl: account-specific values (for example account name or account ID).
* region.hcl: region-specific values (for example region name or geolocation).
* env.hcl: environment-specific values (project name, environment tags, etc.).
* common.hcl: global, cross-cutting configuration (global tags, company name, resource prefixes).

![A slide showing four supporting .hcl configuration files — account.hcl, region.hcl, env.hcl, and common.hcl — each depicted as a colored circular icon within a card. Below each card are short descriptions of their contents (name/account ID, region/geolocation, project tags, and global tags/resource prefixes).](https://mintcdn.com/kodekloud-c4ac6d9a/guoie6wQNxAcGKSL/images/Terragrunt-for-Beginners/Terragrunt-Configuration/Supporting-Files-accountregionenvcommonhcl/hcl-config-account-region-env-common.jpg?fit=max\&auto=format\&n=guoie6wQNxAcGKSL\&q=85\&s=4bfeacf7bd166909dfbad7e7dc34f5df)

Why HCL (and when to use YAML)

* HCL is native to Terraform/Terragrunt and works directly with `read_terragrunt_config`. If your toolchain prefers YAML you can store configuration in YAML, but Terragrunt does not parse YAML automatically — you must read the file with `file()` and convert it with `yamldecode()` in your `terragrunt.hcl`. When possible prefer HCL to reduce boilerplate and keep configs consistent with Terraform usage.

Where to place these supporting files

* Place each supporting file at a level in your repo where child `terragrunt.hcl` files can discover them using `find_in_parent_folders` (commonly in the repository root or an `environments/` directory).
* Use consistent filenames and key names so `find_in_parent_folders("account.hcl")` works reliably from modules and environments.
* Keep secrets out of these files. Use a secrets manager (e.g., Vault, AWS Secrets Manager) and reference secrets at runtime.

Use supporting files to centralize and reuse non-secret configuration. Store secrets in a secure secrets manager and reference them at runtime rather than putting them in these files.

Example supporting files (concise HCL patterns)

* Store each of the following examples as `account.hcl`, `region.hcl`, `env.hcl`, and `common.hcl` so `terragrunt.hcl` can read them.

account.hcl

```hcl theme={null}
locals {
  account = {
    name = "production"
    id   = "123456789012"
  }
}
```

region.hcl

```hcl theme={null}
locals {
  region = {
    name = "us-east-1"
    geo  = "us-east"
  }
}
```

env.hcl

```hcl theme={null}
locals {
  env = {
    name    = "prod"
    project = "my-app"
    tags = {
      Environment = "prod"
      Project     = "my-app"
    }
  }
}
```

common.hcl

```hcl theme={null}
locals {
  common = {
    company     = "AcmeCorp"
    global_tags = {
      Company   = "AcmeCorp"
      ManagedBy = "Terragrunt"
    }
    prefix = "acme"
  }
}
```

How a Terragrunt config consumes supporting files

* Read supporting files with `read_terragrunt_config(find_in_parent_folders(...))` and merge the values into `inputs` for Terraform modules. The example below shows a typical `terragrunt.hcl` that collects all four supporting files and merges tags and core inputs.

terragrunt.hcl

```hcl theme={null}
locals {
  account = read_terragrunt_config(find_in_parent_folders("account.hcl")).locals.account
  region  = read_terragrunt_config(find_in_parent_folders("region.hcl")).locals.region
  env     = read_terragrunt_config(find_in_parent_folders("env.hcl")).locals.env
  common  = read_terragrunt_config(find_in_parent_folders("common.hcl")).locals.common
}

inputs = merge(
  local.common.global_tags,
  {
    account_id = local.account.id
    region     = local.region.name
    project    = local.env.project
  }
)
```

Quick reference table

| File | Use case | Example snippet |
| - | - | - |
| `account.hcl` | Account-specific identifiers and metadata | `locals { account = { name = "production", id = "123456789012" } }` |
| `region.hcl` | Region and geolocation details | `locals { region = { name = "us-east-1", geo = "us-east" } }` |
| `env.hcl` | Environment/project-specific tags and names | `locals { env = { name = "prod", project = "my-app", tags = { Environment = "prod" } } }` |
| `common.hcl` | Cross-cutting/global settings and tags | `locals { common = { company = "AcmeCorp", prefix = "acme" } }` |

Best practices and tips

* Keep supporting files small and focused: one responsibility per file (account, region, env, common).
* Use predictable keys (e.g., `local.account`, `local.region`, `local.env`, `local.common`) so consumption is straightforward.
* Avoid hardcoding credentials or secrets — use a secrets manager. Reference secrets at runtime using Terragrunt’s built-in integrations or external data sources.
* Document each supporting file at the repository root so teams know what to edit and where.
* If you need YAML for other tools, store it alongside the HCL files but ensure your `terragrunt.hcl` explicitly parses YAML with `file()` + `yamldecode()`.

Never commit plaintext secrets or credentials into supporting files. Use a dedicated secrets manager (Vault, AWS Secrets Manager, etc.) and read secrets securely at deployment time.

Links and references

* [Terragrunt documentation — read\_terragrunt\_config](https://terragrunt.gruntwork.io/docs/reference/inputs/#read_terragrunt_config)
* [Terraform HCL language documentation](https://www.terraform.io/docs/language/index.html)
* [Terraform functions — file() and yamldecode()](https://www.terraform.io/docs/language/functions/index.html)

By organizing account-, region-, env-, and common-level configuration into dedicated supporting files you reduce duplicate configuration, simplify updates across modules, and improve the maintainability and consistency of your Terragrunt/Terraform repo.

> **[Watch Video](https://learn.kodekloud.com/user/courses/terragrunt-for-beginners/module/52cf8076-030b-430e-9a8b-273697ad3399/lesson/81a5a81a-bb12-46cb-b72b-e1f93f3aee90)**


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.