Terraform Registry provides a method of installing providers and modules for use with Terraform.
Full documentation on installing terraform
can be found on the Terraform project website.
You can create a proxy repository in Nexus Repository Manager (NXRM) that will cache packages from a remote Terraform registry, like
Terraform Registry. Then, you can make the terraform
client use your Nexus Repository Proxy
instead of the remote repository.
To proxy a Terraform repository, you simply create a new 'terraform (proxy)' as documented in Repository Management in detail. Minimal configuration steps are:
- Define 'Name' - e.g.
terraform-proxy
- Define URL for 'Remote storage' - e.g. https://registry.terraform.io/
- Select a
Blob store
forStorage
Using the terraform
client, you can now download packages from your NXRM Terraform proxy like so:
-
Define a
network-mirror
in your Terraform config file as documented here(NOTE: you must append
/v1/providers/
to the repository URL) e.g.# ~/.terraformrc provider_installation { network_mirror { url = "https://nexus.com/repository/terraform-proxy/v1/providers/" } }
The configuration above tells terraform to fetch (and install) packages from your NXRM Terraform proxy. The NXRM Terraform proxy will download any missing packages from the remote Terraform repository, and cache the packages on the NXRM Terraform proxy. The next time any client requests the same package from your NXRM Terraform proxy, the already cached package will be returned to the client.