terragrunt
terragrunt copied to clipboard
Issue with find_in_parent_folders function
Describe the bug
Hi everyone,
I'm still experiencing this issue with find_in_parent_folders in the latest version.
Seems this is a duplication of #2941
Error:
ERRO[0001] Error: Error in function call
ERRO[0001] on infrastructure/template/main/general/stage/customer-features/eks/k8s/terragrunt.hcl line 6, in locals:
ERRO[0001] 6: account_vars = read_terragrunt_config(find_in_parent_folders("account.hcl"))
ERRO[0001] Call to function "find_in_parent_folders" failed: ParentFileNotFoundError: Could not find an account.hcl in any of the parent folders of saas-test1/infrastructure/template/main/general/stage/network/terragrunt.hcl. Traversed all the way to the root.
Could someone please assist in resolving this?
Thanks for your help!
Steps To Reproduce
In the root of our Git repository, there are folders for deployment and infrastructure. When I execute one of the deployment configurations, it contains a dependency on infrastructure.
dependency "eks" {
config_path = "../../../../../../../infrastructure/accounts/qa-dev/eu-central-1/devx/customer-features/eks/k8s-main"
}
The dependent infrastructure module includes a template file:
include "template" {
path = "infrastructure/template/main/general/stage/customer-features/eks/k8s/terragrunt.hcl"
}
The Terragrunt configuration template includes a local block that utilizes the find_in_parent_folders function, which leads to Issues following Terraform version 0.55.1.
locals {
account_vars = read_terragrunt_config(find_in_parent_folders("account.hcl"))
region_vars = read_terragrunt_config(find_in_parent_folders("regional.hcl"))
stage_vars = read_terragrunt_config(find_in_parent_folders("stage.hcl"))
}
Config files are located here: saas-test1/infrastructure/accounts/qa-dev/eu-central-1/devx/stage.hcl saas-test1/infrastructure/accounts/qa-dev/eu-central-1/regional.hcl saas-test1/infrastructure/accounts/qa-dev/account.hcl
Expected behavior
Expected the same as in 0.55.1
Versions
- Terragrunt version: 0.58.14
- OpenTofu/Terraform version: v1.3.4
- Environment details (Ubuntu 20.04, Windows 10, etc.): Ubuntu 20.04
+1
@yadamovych Did you found solution to this issue?
@yadamovych Did you found solution to this issue?
No, still facing this issue.
As a workaround, use version 0.55.1.
@denis256, have you had the opportunity to examine the issue?
It appears that the "find_in_parent_folders" function is attempting to locate files from the inclusion location rather than from the execution folder as in the previous version of Terragrunt.
@yadamovych version 0.55.1 didn't work for me.
Any news ?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for raising this issue.
@denis256, have you had the opportunity to examine the issue?
It appears that the "find_in_parent_folders" function is attempting to locate files from the inclusion location rather than from the execution folder as in the previous version of Terragrunt.
Is this still actual for everyone? Will any type of fix be implemented in the upcoming releases?
Hey folks,
To my understanding, it's not a bug that find_in_parent_folders() resolves relative to the unit (where the configuration is included), rather than resolving relative to the include (where the included configuration is). It's intended behavior.
I understand that it can be frustrating to have to adjust configurations accordingly, but I don't see us adjusting this behavior in a future release unless there's good justification that it's improved behavior.
Hey folks,
To my understanding, it's not a bug that
find_in_parent_folders()resolves relative to the unit (where the configuration is included), rather than resolving relative to the include (where the included configuration is). It's intended behavior.I understand that it can be frustrating to have to adjust configurations accordingly, but I don't see us adjusting this behavior in a future release unless there's good justification that it's improved behavior.
Hello, thank you for your prompt response.
Could you please clarify whether the find_in_parent_folder() function has always behaved this way, or if its behavior changed in a specific version?
Additionally, could you expand on your previous answer by providing a few simple examples?
Finally, what configuration adjustments would you recommend to better align with the behavior of the find_in_parent_folder() function?