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

Prevent parsing of excluded modules #2664

Merged
merged 3 commits into from
Aug 15, 2023
Merged

Conversation

levkohimins
Copy link
Contributor

Description

Prevent parsing of excluded modules. For example, these modules may have invalid syntax or incomplete configuration, causing terragrunt to fail when parsed.

Related Issues

Fixes #2167

@levkohimins levkohimins marked this pull request as ready for review August 14, 2023 21:46
globPath = filepath.Join(basePath, globPath)
}

matches, err := zglob.Glob(globPath)
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the desired behavior here if err is not nil?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just skip this globPath as it was before

matches, err := zglob.Glob(absoluteDir)
// Skip globs that can not be expanded
if err == nil {
includeGlobMatches = append(includeGlobMatches, matches...)
}

Perhaps there is a reason for this behaviour, I don't know, but I would check the correctness of this path and return an error in cases of non-existence.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you think we should change this behaviour?

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense, no worries! Let's leave it for now

Copy link
Contributor

@MoonMoon1919 MoonMoon1919 left a comment

Choose a reason for hiding this comment

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

One minor comment, otherwise LGTM

@levkohimins
Copy link
Contributor Author

Thanks for the review @MoonMoon1919!

@levkohimins levkohimins merged commit da33415 into master Aug 15, 2023
3 checks passed
@levkohimins
Copy link
Contributor Author

Resolved in v0.50.1 release.

RaphSku pushed a commit to RaphSku/terragrunt that referenced this pull request Aug 16, 2023
* fix: prevent parsing of excluded modules

* fix: unit tests

* chore: add unit test

---------

Co-authored-by: Levko Himins <levkohimins@beid.lan>
@denis256 denis256 deleted the bug/flag-exclude-dir branch August 16, 2023 19:00
hugorut pushed a commit to infracost/terragrunt that referenced this pull request Oct 10, 2023
* fix: prevent parsing of excluded modules

* fix: unit tests

* chore: add unit test

---------

Co-authored-by: Levko Himins <levkohimins@beid.lan>
hugorut pushed a commit to infracost/terragrunt that referenced this pull request Oct 10, 2023
* fix: prevent parsing of excluded modules

* fix: unit tests

* chore: add unit test

---------

Co-authored-by: Levko Himins <levkohimins@beid.lan>
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.

An excluded-dir causes a failure on run-all apply
2 participants