-
Notifications
You must be signed in to change notification settings - Fork 507
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: added validation for module local source dir #793
fix: added validation for module local source dir #793
Conversation
Codecov Report
@@ Coverage Diff @@
## master #793 +/- ##
==========================================
+ Coverage 74.75% 74.87% +0.11%
==========================================
Files 111 111
Lines 3324 3339 +15
==========================================
+ Hits 2485 2500 +15
Misses 654 654
Partials 185 185
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have some minor comments, approving this PR
var pathToModule string | ||
var err error | ||
var moduleDirDiags hcl.Diagnostics |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These can go in a single var block, just makes the code tidier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll make this change .
@@ -321,6 +321,7 @@ func (t TerraformDirectoryLoader) buildUnifiedConfig(rootMod *hclConfigs.Module, | |||
// figure out path sub module directory, if it's remote then download it locally | |||
var pathToModule string | |||
var err error | |||
var moduleDirDiags hcl.Diagnostics | |||
if downloader.IsLocalSourceAddr(req.SourceAddr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering, if it is time to get rid of this if-else ladder and move to a switch case?
833ac05
@@ -344,6 +347,15 @@ func (t TerraformDirectoryLoader) buildUnifiedConfig(rootMod *hclConfigs.Module, | |||
} | |||
} | |||
|
|||
// verify whether the module source directory has any .tf config files | |||
if !t.parser.IsConfigDir(pathToModule) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should modify this check because this will also modify the error message for non existing directories.
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
#782
Fix: Added check for the module source local directory.