Comments (9)
hey @levkohimins, I am usure if this is the correct thing to do, but I noticed changing config_path
in b
to "${get_terragrunt_dir()}/../a"
seems to work in both c
and d
from terragrunt.
I aggree! Same issue at my side at the same process.
Versions
- Terragrunt version: 0.57.13
- Terrafrom version: 1.8.2
from terragrunt.
Hey @ben-dov,
I wasn't able to repro the issue, the test config I used https://github.com/levkohimins/terragrunt-issue-3080. Can you confirm that the issue is resolved? If not, please provide test configs to reproduce it.
from terragrunt.
Hey @levkohimins, I tested and found what is missing in your repo to match my case (I probably was unclear).
in order to encounter my bug you just need to change the path in first/b/terragrunt.hcl
from ../../second/a
to ../a
(use relative path of C to A).
after changing, you will see that plans running on C work fine, but plans on D have a warning (but otherwise seem to work).
from terragrunt.
Hey @ben-dov, Thanks for clarifying. I dare say, just the opposite, the previous behavior before v0.55.6 was incorrect. It makes sense and is intuitive when the relative path is calculated from the location of the included file, not from where it is included. In your case, you need to use the path_relative_to_include()
function.
dependency "a" {
config_path = "${path_relative_to_include()}/../a"
}
Please let me know if this doesn't solve your problem.
from terragrunt.
hey @levkohimins, if so, it is still weird that runnning C directly causes no warning,
Anyway, I attempted the change and it works in this simple scenario, but not it in others.
New example changes
- in
b
, hangeconfig_path
to${path_relative_to_include()}/../a
(as per your suggestion) - Add the directory
second
under another parent namedinto_second
- Fix path in
c
, changeinclude "b"
path
from../../first/b/terragrunt.hcl
to../../../first/b/terragrunt.hcl
Expected behavior
Runing terragrunt plan
in C or D works.
What actually happens
C returns an error:
ERRO[0000] <project-root>/into_second/into_second/second/a does not exist
ERRO[0000] Unable to determine underlying exit code, so Terragrunt will exit with error code 1
D also errors with:
WARN[0000] Error reading file <project-root>/into_second/into_second/second/a: open <project-root>/into_second/into_second/second/a: no such file or directory
ERRO[0000] open <project-root>/into_second/into_second/second/a: no such file or directory
ERRO[0000] Unable to determine underlying exit code, so Terragrunt will exit with error code 1
from terragrunt.
hi @ben-dov,
I missed one point, since path_relative_to_include()
returns a relative path from the b
dir, config_path
is assigned to ../../into_second/second/c/
+ ../a
, but including is happening from c
directory and when we actually include the dependency a
, we calculate the absolute path from the directory c
and it looks like this
into_second/second/c/
+ ../../into_second/second/c/
+ ../a
=> into_second/into_second/second/a
.
Thus, we have to build the relative path from the c
directory, for this we need to use another func, path_relative_from_include()
, and in the end it should look like this:
dependency "a" {
config_path = "${path_relative_from_include()}/${path_relative_to_include()}/../a"
}
into_second/second/c/
+ ../../../first/b/
+ ../../into_second/second/c/
+ ../a
=> into_second/second/a
I hope this helped you solve the issue.
from terragrunt.
THX @levkohimins for the quick response,
Running terragrunt plan
on c
works without issues,
but running on d
prints the warning (but does not fail), kinda like the first problem:
WARN[0000] Error reading file <partial-absolute-path>/into_second/second/a: open <partial-absolute-path>/into_second/second/a: no such file or directory
WARN[0000] Error reading partial config for dependency c: open <partial-absolute-path>/into_second/second/a: no such file or directory
what seems to be missing now is the parent the project directory in partial-absolute-path
I attempted to add another directory pre_into
that will contain into_second
, but the project directory was still missing from the path when running from d
from terragrunt.
hey @ben-dov
Running
terragrunt plan
onc
works without issues, but running ond
prints the warning (but does not fail), kinda like the first problem:WARN[0000] Error reading file <partial-absolute-path>/into_second/second/a: open <partial-absolute-path>/into_second/second/a: no such file or directory WARN[0000] Error reading partial config for dependency c: open <partial-absolute-path>/into_second/second/a: no such file or directory
This is a bug. I will try to fix it in a while.
I am usure if this is the correct thing to do, but I noticed changing config_path in b to "${get_terragrunt_dir()}/../a" seems to work in both c and d.
It's great that you found a workaround.
from terragrunt.
Related Issues (20)
- Terragrunt swallows error output HOT 2
- Pre-releases break version constraints
- Unable to download terraform modules from Jfrog artifactory private registry using tfr or https
- forward terraform graph command HOT 2
- Terragrunt catalog returns git error after second download HOT 3
- handle empty string env vars more gracefully HOT 1
- Release signing and key ? HOT 3
- --terragrunt-log-disable hides terraform errors HOT 2
- terragrunt run-all graph plan/apply
- Dependencies output lookup does not use download_dir path
- Add `--terragrunt-queue-include-units-reading` flag to Terragrunt HOT 1
- New log shows STDERR with Terragrunt Provider Cache
- Terragrunt Provider Cache discovers registry names URLs instead of mirror servers URLs HOT 1
- Terragrunt crashes with no useful information if terraform version is not determined HOT 1
- terragrunt does not support provider functions and fails during input-validate
- Create multiple resources using same terragrunt.hcl file HOT 1
- `run-all show -json` mangles output for very large plans HOT 2
- Issue with module path logging HOT 9
- 423 Locked error since version 0.67.5 HOT 2
- Simplify maintaining pre 0.67.0 output format HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terragrunt.