Skip to main content

Private Registries

In addition to using local modules, Tharsis also supports deploying them from a third-party Terraform registry. It supports any registry that adheres to the Terraform Module Registry Protocol.

Using the Tharsis CLI​

The CLI includes some built-in flags which make deploying remote Terraform modules possible. The same is possible with the destroy command.

Apply command​

Apply a remote Terraform module in workspace hero
tharsis apply \
--env-var "TF_TOKEN_<example_com>=<access_token>" \
--module-source https://example.com/some-module \
--module-version "2.3.2" \
--auto-approve \
top-level/mid-level/hero
Expand for explanation
  • --tf-var and --env-var: quickly allow creating simple key=value Terraform and environment variable pairs respectively. Use --tf-var-file or --env-var-file for variable files which also support HCL Terraform variables. Optional.

  • --module-source: URI to the module. Required for module source, optional otherwise.

  • --module-version: module version, defaults to the latest. Optional.

  • --auto-approve: bypass the need to confirm changes to the Terraform configuration and automatically run the apply stage after planning is complete. Optional.

note

Tharsis expects the TF_TOKEN_<domain_name>=<access_token> environment variable to authenticate with the private registry. Learn more.

don't forget the managed identity!

If deploying to AWS or Azure, be sure to assign a managed identity to the target workspace!