Skip to content

get_working_dir

unit

Usage

get_working_dir() --> string

Terragrunt copies the unit’s module into .terragrunt-cache and runs OpenTofu/Terraform there, even when the unit sets no source. get_working_dir returns that directory, e.g. /repo/app/.terragrunt-cache/xbSzpJsW/i_cfJmj8:

app/terragrunt.hcl
terraform {
source = "../modules/app"
}
inputs = {
lambda_zip = "${get_working_dir()}/lambda.zip"
}

Examples

In a repository checked out at /home/me/infra.

app/terragrunt.hcl
locals {
# "/home/me/infra/app/.terragrunt-cache/xbSzpJsW/i_cfJmj8"
working_dir = get_working_dir()
}