Terraform
Add public providers and modules to your private registry
Providers and modules are the building blocks of Terraform configuration, and the Terraform ecosystem has a robust library of each for you to use. As you develop your infrastructure, you may rely on more modules and providers to provision your resources, and a growing library of components can make it hard to find the modules and providers you need. HCP Terraform's private registry allows you to curate the modules and providers your organization uses, which make approved modules and providers easier to find.
Curating public modules and providers in your private registry lets you define a list of approved components for your organization to use. It also lets your team find all documentation related to those components in one place, and makes it easier to track new releases and changes.
In this tutorial, you will add a public Terraform module and provider to your organization's private registry. You will review the details for these components in the private registry and how to remove the provider and module from your registry. In the process, you will learn how to use the registry to curate your organization's resources and adopt a consistent development workflow.
Prerequisites
For this tutorial, you will need an HCP Terraform account and organization owner access.
Add public provider to private registry
In your HCP Terraform dashboard, click on Registry in the top menu bar, then click on Search public registry.
In the search bar, type aws
, then select the aws
provider.
On the provider details page, you will find:
- The provider name (
aws
) and description. - The badge indicating that this provider is public.
- The provider version and publication date, which show whether the provider is actively maintained. You can also select and review older versions of the provider.
- The provider owner responsible for maintenance and updates. HashiCorp owns the
aws
provider. - The number of provisions. A higher number correlates with broader community adoption.
- A link to the provider's source code repository.
- Tabs for the documentation and example configuration.
To add the provider to your private registry, click on Add to HCP Terraform.
Confirm by clicking Add to organization.
You have now added the provider to your private registry.
Add public module to private registry
You can use a similar workflow to curate modules in your private registry.
Navigate back to your HCP Terraform Registry, then click on Search public registry.
Enter vpc
into the search bar, then click on the Modules tab.
Select terraform-aws-modules/vpc
.
On the module page, you will find:
- The module name (
vpc
) and description. - The badge indicating that this module is public.
- The version and publication date.
- The Submodules and Example dropdowns, which show the submodules this module uses and examples of configurations that use the module.
- Tabs for the module's README, inputs, outputs, dependencies, and resources. These sections offer guidance for how to use the module in your configuration.
- The box on the right allows you to add this module to your registry. It also contains an example configuration that you can use, and a module download count. Refer to the Examples dropdown or the source repository for additional example configurations.
Once you have reviewed this module, click the Add to HCP Terraform button to add this vpc
module to your organization's private registry.
Confirm by clicking Add to organization.
Tip
HCP Terraform Plus Edition lets you publish modules that users deploy without referencing them in Terraform configuration. Follow the Create and Use No-Code Modules tutorial to create a no-code ready module that follows architecture best practices.
Review registry contents
Your registry now contains both the aws
provider and vpc
module in one
place, with centralized access to documentation and configuration examples for your
organization to use. Navigate back to your registry's landing page.
Under the Providers tab, you will find your AWS provider. The Modules tab has your vpc
module.
Remove module from private registry
Navigate to the vpc
module details page. Notice that the Add to HCP Terraform button now says Manage Module for Organization. This confirms that the module is currently in your private registry.
Click on Manage Module for Organization, then Delete module.
Enter the module name (vpc
) and click the Delete button to confirm removing the vpc
module from your private registry.
Remove provider from private registry
Similarly to the module, navigate to the aws
provider page in your registry, and select Delete from organization under the Manage Provider for Organization dropdown.
Enter the provider name (aws
) and confirm removing the provider from your organization by clicking Remove.
Next steps
In this tutorial, you learned how to curate providers and modules in your HCP Terraform private registry. You searched for providers and modules, reviewed their details, and added and removed them from your registry. Curating providers and modules allows you to establish your HCP Terraform private registry the source for Terraform configuration components for your organization, and give your team a consistent workflow as they scale their use of Terraform.
For more information on topics covered in this tutorial, review the following resources:
- Read more about the registry in the Private Registry documentation.
- Learn how to add customized private modules to the private registry in the Share Modules in the Private Module Registry tutorial.
- Share a no-code ready module by following the Create and Use No-Code Modules tutorial.
- Read more about HCP Terraform's cross-organization module sharing.