-
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
Support for authenticated tf module download #658
Conversation
Codecov Report
@@ Coverage Diff @@
## master #658 +/- ##
==========================================
- Coverage 75.13% 74.97% -0.16%
==========================================
Files 110 110
Lines 3028 3061 +33
==========================================
+ Hits 2275 2295 +20
- Misses 582 592 +10
- Partials 171 174 +3
|
pkg/downloader/module-download.go
Outdated
return registry.NewClient(nil, nil) | ||
} | ||
// TODO: Need to add support for Windows %APPDIR%/terraform.rc | ||
terraformrc := filepath.Join(homedir, "/.terraformrc") |
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.
Though the end result would be same, adding the path separator is not required before .terraformrc
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.
thx - I was originally using sprintf and forgot to change...
pkg/downloader/module-download.go
Outdated
|
||
hostCredentialMap := convertCredentialMapToHostMap(result.Credentials) | ||
if hostCredentialMap == nil { | ||
return nil, err |
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.
err
would be nil
here, we would need to create an error to return.
@@ -542,3 +542,68 @@ func TestGetVersionToDownload(t *testing.T) { | |||
}) | |||
} | |||
} | |||
|
|||
func TestAuthenticatedRegistryClient(t *testing.T) { | |||
testDirPath := "testdata/run-test" |
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 use filepath.Join()
here.
name: "invalid terraformrc file", | ||
filename: "badterraformrc", | ||
}, | ||
} |
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.
May be we can add a test with non existing file and a test with a file that doesn't have valid data?
Also, there should be a test that verifies the behavior for nil
input to convertCredentialMapToHostMap
.
It will increase the code coverage
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Adding support to use credentials in
~/.terraformrc
when downloading tf modules from a private registry. This fixes #631