You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
terragrunt validate - issues with root terragrunt.hcl #40
Where the child includes the parent via find_in_parent_folders().
If the parent has many read_terraform_config(find_in_parent_folders("common.hcl")) type includes it will fail when terragrunt validate runs against it in singular. As the dir traversal fails to find the file.
Also, this is sort of expected behavior since terragrunt validate actually means to run terraform validate for the given terragrunt configuration, and the root terragrunt config doesn't point to a terraform module (by definition), so even if we get past the syntax error, it will fail later in the pipeline when terragrunt checks for the existence of terraform code.
The pre-commit hook for a terragrunt validate call needs to be sure to ignore the root terragrunt config for this reason.
@yorinasub17 I got around this in the end by adding rules to the pre-commit cmd for terragrunt/terraform validate so that the root .hcl is ignored and that only files named terragrunt.hcl elsewhere where tested. example below
Activity
yorinasub17 commentedon Nov 10, 2020
Just to confirm, is this an issue with a pre-commit hook you are using, or are you manually running
terragrunt validate?davehewy commentedon Nov 10, 2020
pre-commit. although it could be replicated using
terragrunt validateyorinasub17 commentedon Nov 10, 2020
Can you point to which
pre-commithook runsterragrunt validate? I don't see one in our list that runsterragrunt validate(onlyterraform validate).In any case, I think this is a terragrunt issue so I will most likely migrate this over to that repo.
yorinasub17 commentedon Nov 10, 2020
Also, this is sort of expected behavior since
terragrunt validateactually means to runterraform validatefor the given terragrunt configuration, and the root terragrunt config doesn't point to a terraform module (by definition), so even if we get past the syntax error, it will fail later in the pipeline when terragrunt checks for the existence of terraform code.The
pre-commithook for aterragrunt validatecall needs to be sure to ignore the root terragrunt config for this reason.davehewy commentedon Nov 12, 2020
@yorinasub17 I got around this in the end by adding rules to the pre-commit cmd for terragrunt/terraform validate so that the root .hcl is ignored and that only files named terragrunt.hcl elsewhere where tested. example below
happy for this to be closed off