Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include and local lookup fails in locals block #1727

Closed
stevie- opened this issue Jun 18, 2021 · 1 comment · Fixed by #1728
Closed

include and local lookup fails in locals block #1727

stevie- opened this issue Jun 18, 2021 · 1 comment · Fixed by #1728

Comments

@stevie-
Copy link
Contributor

stevie- commented Jun 18, 2021

Terragrunt Version 0.30.6
Terraform 0.14.11

When we try to evaluate include and local on some line value is null.

pseudo test code

test/terragrunt.hcl (parent)

locals {
  environment = "dev"
}

test/child/terragrunt.hcl (child)

include {
  path   = find_in_parent_folders()
  expose = true
}

locals {
  datalake_account_id         = "test"
  works1 = "${include.locals.environment}_"
  works2 = "${local.datalake_account_id}_"
  fails = "${include.locals.environment}_${local.datalake_account_id}"
}
cd test/child
❯ terragrunt plan --terragrunt-debug  --terragrunt-log-level trace
DEBU[0000] Found locals block: evaluating the expressions.
DEBU[0000] Found locals block: evaluating the expressions.
DEBU[0000] Evaluated 1 locals (remaining 0): environment
Error: Attempt to get attribute from null value

  on PATHTO/test/child/terragrunt.hcl line 10, in locals:
  10:   fails = "${include.locals.environment}_${local.datalake_account_id}"

This value is null, so it does not have any attributes.

ERRO[0000] Encountered error while evaluating locals.
ERRO[0000] PATHTO/test/child/terragrunt.hcl:10,49-69: Attempt to get attribute from null value; This value is null, so it does not have any attributes.
ERRO[0000] Unable to determine underlying exit code, so Terragrunt will exit with error code 1

Works if used in inputs block.

@yorinasub17
Copy link
Contributor

Fixed in https://github.com/gruntwork-io/terragrunt/releases/tag/v0.30.7 Thanks again for the detailed bug report and repro!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants