Repository: gruntwork-io/terragrunt (language: go)

Issue:
`find_in_parent_folders` throws errors and warnings in some cases when used from a dependency
**Describe the bug**
`find_in_parent_folders` used in dependencies throws errors and warnings. It seems that in dependencies, instead of being searched from the dependency, `find_in_parent_folders` is searching from the current project instead and throws errors.

This appeared in 0.55.2 and does not appear in 0.55.1.

The project still works but error messages appear which pollute the output:

```
ERRO[0000] Error: Error in function call

ERRO[0000]   on /<REDACTED>/foo/test/terragrunt.hcl line 4, in include "foo":
ERRO[0000]    4: include "foo" { path = find_in_parent_folders("foo.hcl") }
ERRO[0000]
ERRO[0000] Call to function "find_in_parent_folders" failed:
ParentFileNotFoundError: Could not find a foo.hcl in any
of the parent folders of
/<REDACTED>/bar/terragrunt.hcl.
Cause: Traversed all the way to the root..

ERRO[0000] Error: Unsuitable value type

ERRO[0000]   on /<REDACTED>/foo/test/terragrunt.hcl line 4, in include "foo":
ERRO[0000]    4: include "foo" { path = find_in_parent_folders("foo.hcl") }
ERRO[0000]
ERRO[0000] Unsuitable value: value must be known

WARN[0000] Error reading partial config  for dependency foo: /<REDACTED>/foo/test/terragrunt.hcl:4,24-47: Error in function call; Call to function "find_in_parent_folders" failed: ParentFileNotFoundError: Could not find a foo.hcl in any of the parent folders of /<REDACTED>/foo/test/terragrunt.hcl. Cause: Traversed all the way to the root.., and 1 other diagnostic(s)
```

**To Reproduce**
You need the following tree:
* `foo/`
  * `test/`
    * `terragrunt.hcl`
  * `foo.hcl`
* `bar/`
  * `terragrunt.hcl`

`foo/test/terragrunt.hcl`:
```hcl
include "foo" {
  path = find_in_parent_folders("foo.hcl")
}
```

`bar/terragrunt.hcl`:
```hcl
dependency "foo" {
  config_path = find_in_parent_folders("foo/test")
}
```

**Expected behavior**
Planning the `bar/` project should work without any warnings or errors.

**Versions**
- Terragrunt version: 0.55.2
- Terraform version: 1.3.6
- Environment details (Ubuntu 20.04, Windows 10, etc.): MacOS 14.1.1 (23B81)

**Additional context**
Works in 0.55.1


Discussion / hints:

Fix patch:
diff --git a/config/dependency.go b/config/dependency.go
index f51218f4c8..93e1f8c516 100644
--- a/config/dependency.go
+++ b/config/dependency.go
@@ -200,7 +200,7 @@ func decodeAndRetrieveOutputs(ctx *ParsingContext, file *hclparse.File) (*cty.Va
 				dep.Inputs = &inputsCty
 
 			} else {
-				ctx.TerragruntOptions.Logger.Warnf("Error reading partial config  for dependency %s: %v", dep.Name, err)
+				ctx.TerragruntOptions.Logger.Warnf("Error reading partial config for dependency %s: %v", dep.Name, err)
 			}
 		}
 


Test patch:
diff --git a/test/fixture-skip-dependencies/first/foo.hcl b/test/fixture-skip-dependencies/first/foo.hcl
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/test/fixture-skip-dependencies/first/terragrunt.hcl b/test/fixture-skip-dependencies/first/terragrunt.hcl
index 49129f0e89..d428343c2a 100644
--- a/test/fixture-skip-dependencies/first/terragrunt.hcl
+++ b/test/fixture-skip-dependencies/first/terragrunt.hcl
@@ -4,6 +4,10 @@ terraform {
   source = "../module"
 }
 
+include "foo" {
+  path = "foo.hcl"
+}
+
 inputs = {
   input = "first"
 }
\ No newline at end of file
diff --git a/test/integration_test.go b/test/integration_test.go
index 428c20ac57..0a03b55227 100644
--- a/test/integration_test.go
+++ b/test/integration_test.go
@@ -6712,6 +6712,10 @@ func TestTerragruntSkipDependenciesWithSkipFlag(t *testing.T) {
 
 	output := fmt.Sprintf("%s %s", stderr.String(), stdout.String())
 
+	assert.NotContains(t, output, "Error reading partial config for dependency")
+	assert.NotContains(t, output, "Call to function \"find_in_parent_folders\" failed")
+	assert.NotContains(t, output, "ParentFileNotFoundError")
+
 	assert.Contains(t, output, "first/terragrunt.hcl due to skip = true")
 	assert.Contains(t, output, "second/terragrunt.hcl due to skip = true")
 	// check that no test_file.txt was created in module directory