terragrunt-atlantis-config
terragrunt-atlantis-config copied to clipboard
Fails when there is a dependency in a before/after hook
Running terragrunt-atlantis-config on a file that has a before_hook
or an after_hook
that contains a reference to a terragrunt dependency fails with error message: Unknown variable; There is no variable named "dependency".
.
$ terragrunt-atlantis-config version
terragrunt-atlantis-config '1.6.0'
running with:
$ terragrunt-atlantis-config generate --create-workspace --create-project-name --output "atlantis.yaml" --parallel --autoplan
Example file and error:
terraform {
source = "{my_module_path}"
before_hook "before_hook" {
commands = ["apply"]
execute = [
"packer",
"build",
"-var", "assumed_role=${local.account_vars.locals.iam_role}",
"-var", "vpc_id=${dependency.vpc.outputs.vpc_id}",
"image/main.pkr.hcl",
]
}
}
locals {
account_vars = read_terragrunt_config(find_in_parent_folders("account.hcl"))
}
dependency "vpc" {
config_path = "../../vpc/vpc-shared"
}
include {
path = find_in_parent_folders()
}
inputs = {
{various_inputs_for_my_module}
}
terragrunt.hcl:9,25-35: Unknown variable; There is no variable named "dependency".
FAIL: 1
Other info: Local terragrunt version: v0.28.18 Local terraform version: v0.14.9 Similar to https://github.com/transcend-io/terragrunt-atlantis-config/issues/102
fyi @jeromepin @dmattia
We're running into this issue as well. Makes us sad pandas.
Noted 😢
I use Terragrunt's parser for this part, but I use a partial parse in many cases, which doesn't evaluate all of the terragrunt blocks, and might be why this is happening?
Can you confirm that terragrunt can normally apply
this type of file?
just ran into this as well when setting an env var in a terraform block's extra_argments
input. confirmed that terragrunt will happily apply this configuration without issue
same in 1.18.0, it fails for both hooks and extra_arguments
:(