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

fix: ignore parent terragrunt.hcl files in a Terragrunt directory #2334

Merged
merged 1 commit into from
Mar 7, 2023

Conversation

hugorut
Copy link
Contributor

@hugorut hugorut commented Mar 7, 2023

Resolves issue when a parent terragrunt.hcl file was using any find or get functions. These functions are called relative to the original Terragrunt config (the child terragrunt.hcl file). Thus any file include would fail with a not exists error. We now ignore parent terragrunt.hcl from initial evaluation and only read it when it is included by a child terragrunt.hcl (expected behaviour).

@hugorut hugorut requested a review from a team as a code owner March 7, 2023 10:55
@hugorut hugorut force-pushed the fix/terragrunt-auto-detect branch from c75c3b7 to bde8191 Compare March 7, 2023 11:44
@hugorut hugorut removed the request for review from a team March 7, 2023 11:45
@hugorut hugorut self-assigned this Mar 7, 2023
@hugorut hugorut requested a review from vdmgolub March 7, 2023 11:45
@hugorut
Copy link
Contributor Author

hugorut commented Mar 7, 2023

I have an open pr here #2335 for the intermitently failing golangci-lint errors, so please ignore

continue
}

file, err := os.Open(file)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to close these files? Or should it not be that many to care as the execution is usually quick?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we should, for some reason the file.Close wasn't being recognized with my specific build tags so it got removed with go fmt I'm adding back in. Good spot.

@hugorut hugorut force-pushed the fix/terragrunt-auto-detect branch 3 times, most recently from 2d1955f to d01bf76 Compare March 7, 2023 14:23
Resolves issue when a parent `terragrunt.hcl` file was using any `find` or `get` functions. These functions are called relative to the original Terragrunt config (the child `terragrunt.hcl` file). Thus any file include would fail with a not exists error. We now ignore parent `terragrunt.hcl` from initial evaluation and only read it when it is included by a child `terragrunt.hcl` (expected behaviour).
@hugorut hugorut force-pushed the fix/terragrunt-auto-detect branch from d01bf76 to 8b4a4dc Compare March 7, 2023 14:58
@hugorut hugorut merged commit b4c3220 into master Mar 7, 2023
@hugorut hugorut deleted the fix/terragrunt-auto-detect branch March 7, 2023 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants