Can I use Terraform CLI to deploy a module hosted on Terraform Enterprise module registry?

I have a module hosted on Terraform Enterprise module registry.

Can I use the Terraform CLI command line to supply a tfvar file to the module and deploy it?

Thank you,

Hi @hspecter758,

For any registry other than the public one at registry.terraform.io, the module source addresses will include an additional component to specify the registry hostname. For Terraform Enterprise, that’ll be the same hostname you use when you authenticate to Terraform Enterprise from the CLI – the hostname you’d provide to terraform login, if you use that.

If your Terraform Enterprise instance were at tf.example.com then a suitable module call might look like this:

module "example" {
  source = "tf.example.com/organization/name/vendor"

  # ...
}

For Terraform Cloud and Terraform Enterprise, the name and vendor components of the source address come from the repository name in a similar way as on the public registry, so for example if your repository were named terraform-aws-example and the module belonged to the organization foo then the source address would be tf.example.com/foo/example/aws.

There’s more detail on this in the documentation section Using Private Modules, which in particular describes how you can use the private registry web UI to find the exact source address to use for any module that’s already published, in the “Provision Instructions” box.

1 Like