-
Notifications
You must be signed in to change notification settings - Fork 104
Support proxied Terraform registry endpoint #1057
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
Conversation
This tests reading a module from the registry.
0ca014d
to
6ce1f50
Compare
1de2250
to
d96eee3
Compare
Datadog ReportBranch report: ✅ 0 Failed, 1422 Passed, 167 Skipped, 19m 22.23s Total Time 🔻 Code Coverage Decreases vs Default Branch (1)
|
registry_module.go
Outdated
@@ -572,6 +636,38 @@ func (r *registryModules) Read(ctx context.Context, moduleID RegistryModuleID) ( | |||
|
|||
return rm, nil | |||
} | |||
|
|||
// ReadRegistry fetches a registry module from the Terraform Registry. | |||
func (r *registryModules) ReadRegistry(ctx context.Context, moduleID RegistryModuleID, version string) (*TerraformRegistryModule, error) { |
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.
Should this be called ReadByVersion
? It's returning a module but the function is called ReadRegistry
.
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.
Using the proxied registry endpoint here always requires that the version be provided, but maybe a better name would be ReadFromRegistry
? Perhaps @hashicorp/tf-core-cloud has an ideal name in mind.
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.
The method takes a version
param, does it read the module or module-version?
A name suggestion would be something like ReadTerraformRegistryModule
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.
It reads the module.
I will update this to be that name instead!
* rename the function * remove unnecessary comment * remove unnecessary call to fetch org in test * update new method comment
Reminder to the contributor that merged this PR: if your changes have added important functionality or fixed a relevant bug, open a follow-up PR to update CHANGELOG.md with a note on your changes. |
Description
This PR adds support for the proxied Terraform Registry endpoint to go-tfe, for fetching modules, documented here.
Testing plan
Run integration tests, setting the TFE_TOKEN, OAUTH_CLIENT_GITHUB_TOKEN, and GITHUB_REGISTRY_NO_CODE_MODULE_IDENTIFIER environment variables.
External links
https://developer.hashicorp.com/terraform/cloud-docs/api-docs/private-registry/modules#hcp-terraform-registry-implementation
Output from tests
Including output from tests may require access to a TFE instance. Ignore this section if you have no environment to test against.