Skip to main content

Overview

To integrate smoothly with Fast Foundation, each Terragrunt unit requires specific configuration blocks in its terragrunt.hcl file. These ensure that parameter management, resource orchestration, and naming conventions remain consistent across environments.

Required Components

Your terragrunt.hcl should always include:
  1. Includes blocks
  2. Locals block
    • Secret management variables (if the Unit makes use of them)
    • Variables from inputs.hcl and shared config files can be defined here for improved readability.
  3. Inputs block
    • Values passed into the Terraform module
    • Typically merged with environment and service variables defined higher in the repo hierarchy

Example terragrunt.hcl

terraform {
  source = "${dirname(find_in_parent_folders("root.hcl"))}/_modules/my-module"
}

include "root" {
  path   = find_in_parent_folders("root.hcl")
  expose = true
}

locals {
  # Shared Configurations
  region_vars          = include.root.locals.region_vars.locals
  service_vars         = include.root.locals.service_vars.locals
  account_vars         = include.root.locals.account_vars.locals
  environment_vars     = include.root.locals.environment_vars.locals
  
  # Unit Inputs from inputs.hcl
  inputs = try(read_terragrunt_config("${get_terragrunt_dir()}/inputs.hcl").locals, {})
}

inputs = {
  # Resource naming (best practice)
  name = basename(get_terragrunt_dir())
  # Add your module-specific inputs here
}

Naming Best Practice

If possible, use the folder name as the resource name. This keeps the repository intuitive: the folder you are working in directly reflects the deployed resource. It simplifies navigation, debugging, and collaboration across teams.

Want to dive deeper?

Ready to explore these concepts in more detail? Check out our hands-on workshops: