-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve error reporting for external data sources #3711
Comments
Hey @antspy , Take a look at HCL functions like the following:
They're designed to help you work out paths consistently when using Terragrunt, regardless of where you're using it. The error that you're getting is coming from Terraform, not Terragrunt, which is why you might be having trouble troubleshooting it. For what it's worth, you don't need to use a You can resolve it with run_cmd, then pass it in as an input. I personally find it easier to reason about what's going on when I don't use things like |
Thanks a lot! I am now using get_repo_root, and it's working nicely :) [0]
I see, thank you! It was indeed hard to troubleshoot. The issue turned out to be related to the fact that I was running the command using the terragrunt action, which runs the scripts inside a docker container where the environment is not what I expected it to be :) Anyway, thanks a lot! :) [0] Btw since it's a terragrunt-only function, I have added it as a terraform variable and in the inputs = {
repo_root = get_repo_root()
} Is this the intended way to use it? |
If it works, it is! 😂 Terragrunt functions are meant to be used within Terragrunt HCL configurations. There are a couple ways that data can be pass to OpenTofu/Terraform configurations, and one of those is by setting In this example, setting |
It does work! :D Great, thanks for the explanation! :) |
Hi,
I am having trouble debugging an external data source error using terragrunt.
The first problem is that terragrunt moves and executes the scripts in a temporary directory, so I cannot reference other scripts using relative paths. This was hard to debug already, but now I am trying to use absolute paths - with the caveat that I need them to run both locally and on github actions.
My
main.tf
file contains the following:While the
get_container_sha.sh
script contains the following:So the local script is just a way to compute the absolute path of the real script, passing the right arguments.
Anyway - everything works fine locally -
terragrunt plan & apply
all work fine, find the scripts, return the correct results, etc.On github actions, the external data source breaks in a way that's impossible to debug - there is virtually no information given, simply 'script didn't work'. The output is not printed anywhere at any log level.
My github actions file:
The error message (see below) only says that something went wrong, but I cannot figure out what. How can I debug the script execution to understand what went wrong?
Calling the script by itself in a separate stage works fine and returns the correct results, it only breaks when terragrunt runs it (on github actions - it also works fine locally). I need to debug it from terragrunt perspective - but how?
Error message:
The text was updated successfully, but these errors were encountered: