Skip to content
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

Run Terraforms "graph" command via cli-redesign experiments "run" not working #3947

Closed
jan-clausen-klickrent opened this issue Feb 28, 2025 · 0 comments · Fixed by #3959
Closed
Assignees
Labels
bug Something isn't working cli-redesign Issues related to the CLI Redesign

Comments

@jan-clausen-klickrent
Copy link

Describe the bug

I recently came accross an old script stored in a repo whose responsibility I took over which was meant to be used for improve the repo's overall documentation automatically. This script was executing the command

terragrunt graph -draw-cycles "${INPUT_DIR}" | dot ... #Convert output to GraphViz and write to SVG file

It took me a while to understand, that this command was failing with error "-draw-cycles is not a valid option" because that after I upgraded to a newer Terragrunt version (v0.72.2) a few weeks ago, the command was not forwarded to Terraform anymore but instead was resolved by Terragrunt as in a previous release the "graph" command was introduced as well (unfortunately with an entirely different functionality)

But I came accross the quite new and currently active "cli-redesign" experiment and thought "well, that might be exactly what I need to make the script work again as before", so I upgraded to (v0.73.15) and tried to execute the previous mentioned command as follows now:

terragrunt --experiment cli-redesign run -- graph -draw-cycles "${INPUT_DIR}" | dot ...

Unfortunately no success, as now I am receiving the following Error Message:

ERROR  Terraform has no command named "". To see all of Terraform's top-level commands, run: terraform -help
ERROR  Unable to determine underlying exit code, so Terragrunt will exit with error code 1

When trying to use the new "run" command with e.g. "plan" everything works as expected, but looking at the error message I got the feeling, that for some reason Terragrunt seems to not forward the "graph" command to Terraform at all and just swallows it along the way, because in the error message it is looking like I did not provide a Terraform command at all. But when providing an actual invalid-command as a cross-check, that is showing up to be unknown in the error message (as expected):

terragrunt --experiment cli-redesign run -- invalid-command
Terraform has no command named "invalid-command". To see all of Terraform's top-level commands, run: terraform -help
Unable to determine underlying exit code, so Terragrunt will exit with error code 1

So there seems to be some special (miss)handling in the current experiment when passing either the graph command or maybe even when overall passing commands, which have an equal name in the Terragrunt CLI

Steps To Reproduce

Just run terragrunt --experiment cli-redesign run -- graph against an arbitrary terragrunt.hcl file

Expected behavior

No matter the command passed over to "run" (esspecially after already seperating it with -- from the terragrunt command flags), it should be forwarded to Terraform as documented

Versions

  • Terragrunt version: v0.73.15
  • OpenTofu/Terraform version: Terraform v1.5.7 on linux_amd64
  • Environment details (Ubuntu 20.04, Windows 10, etc.): Running in Docker container based on Ubuntu 20.04 image
@jan-clausen-klickrent jan-clausen-klickrent added the bug Something isn't working label Feb 28, 2025
@yhakbar yhakbar added the cli-redesign Issues related to the CLI Redesign label Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cli-redesign Issues related to the CLI Redesign
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants