gruntwork-io / terragrunt

Terragrunt is a flexible orchestration tool that allows Infrastructure as Code written in OpenTofu/Terraform to scale.
https://terragrunt.gruntwork.io/
MIT License
7.94k stars 965 forks source link

Issue with find_in_parent_folders function #3185

Open yadamovych opened 3 months ago

yadamovych commented 3 months ago

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

dhanbdrkarki1 commented 1 month ago

+1

dhanbdrkarki1 commented 1 month ago

@yadamovych Did you found solution to this issue?

yadamovych commented 1 month ago

@yadamovych Did you found solution to this issue?

No, still facing this issue.

yadamovych commented 1 month ago

As a workaround, use version 0.55.1.

yadamovych commented 1 month ago

@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.

dhanbdrkarki1 commented 1 month ago

@yadamovych version 0.55.1 didn't work for me.

lynicis commented 5 days ago

same on v0.67.4