terragrunt icon indicating copy to clipboard operation
terragrunt copied to clipboard

Terragrunt run-all requires a "terragrunt.hcl" in current folder

Open Fran-Rg opened this issue 3 years ago • 3 comments

From https://terragrunt.gruntwork.io/docs/reference/cli-options/#run-all:

Example:
terragrunt run-all apply

This will recursively search the current working directory for any folders that contains Terragrunt modules and run apply in each one, concurrently, while respecting ordering defined via dependency and dependencies blocks.

I'm trying to run it from this tree (at demo/nonprod/):

.
├── bucket_role
│   └── terragrunt.hcl
├── env.hcl
├── iam_policy
│   └── terragrunt.hcl
└── iam_test_policy
    └── terragrunt.hcl

First bug: When I run:

terragrunt run-all destroy

Nothing displays. The next time I run any terragrunt command:

terragrunt ouput
WARNING: Are you sure you want to run `terragrunt destroy` in each folder of the stack described above? There is no undo! (y/n) time=2021-02-10T16:23:48Z level=error msg=Error reading file at path demo/nonprod/terragrunt.hcl: open demo/nonprod/terragrunt.hcl: no such file or directory
time=2021-02-10T16:23:48Z level=error msg=Unable to determine underlying exit code, so Terragrunt will exit with error code 1

First Bug: Similarly to the "warn" issue and the new logging, nothing displays if it errors 1 Second bug: Why is it looking for a terragrunt.hcl in my current folder where they are all in sub-folders.

I'm on:

> terragrunt --version
terragrunt version v0.28.3

Fran-Rg avatar Feb 10 '21 17:02 Fran-Rg

First bug may be a dupe of the logging issues being worked on in https://github.com/gruntwork-io/terragrunt/pull/1541.

As for being able to run run-all without a terragrunt.hcl in the current folder, that does feel like something we should add support for. Is anyone up for a PR to make this change?

brikis98 avatar Feb 11 '21 09:02 brikis98

Hi, I just hit this issue too today with older version of terrragrunt (v0.23.8). I was expected this to behave like terragrunt apply-all, which works even if there is no terragrunt.hcl in the root folder.

giom-l avatar Feb 09 '22 18:02 giom-l

I ran into this problem as well, on 0.31.11 (I am currently in a multi-week process of upgrading to new versions of Terraform and Terragrunt). We had not seen this before because we were using terragrunt apply-all like @giom-l , but I received the deprecation warnings saying I needed to change to terragrunt run-all apply. Like others here have stated, this caused a new issue for us, because not every level of our directory has terragrunt.hcl files.

I assume I can just add blank ones and it will resolve the issue, but definitely was an unexpected issue since the old command this supposedly "replaced" didn't have this problem

jon-flowers avatar May 25 '22 22:05 jon-flowers