Skip to main content

CLI Deployments

The Tharsis CLI provides flags for deploying Terraform modules directly from the command line. You can deploy from a local directory or a remote module source.

tip

You can also manage deployments via AI assistants using the CLI's built-in MCP server.

Local modules​

Upload and apply a local Terraform configuration directory:

Apply a local module
tharsis apply -directory-path /path/to/terraform/config my-group/my-workspace

Remote modules​

Deploy a module from a registry without writing Terraform configuration locally. This works with the plan, apply, and destroy commands.

Plan a remote module
tharsis plan \
-module-source https://registry.example.com/org/network/aws \
-module-version "2.3.0" \
my-group/my-workspace
Apply a remote module
tharsis apply \
-module-source https://registry.example.com/org/network/aws \
-module-version "2.3.0" \
-auto-approve \
my-group/my-workspace
Destroy resources from a remote module
tharsis destroy \
-module-source https://registry.example.com/org/network/aws \
-module-version "2.3.0" \
-auto-approve \
my-group/my-workspace

For private registries, pass the credential token as an environment variable:

Apply from a private registry
tharsis apply \
-env-var "TF_TOKEN_registry_example_com=<access_token>" \
-module-source https://registry.example.com/org/network/aws \
-module-version "2.3.0" \
my-group/my-workspace

See Module Sources for details on registry authentication.

Flags​

FlagDescriptionRequired
-directory-pathPath to a local Terraform configuration directory. Conflicts with -module-source.No
-module-sourceURI to a remote module. Conflicts with -directory-path.No
-module-versionModule version. Defaults to latest.No
-env-varEnvironment variable as a key=value pair. Can be specified multiple times.No
-env-var-filePath to a file containing environment variables.No
-tf-varTerraform variable as a key=value pair. Can be specified multiple times.No
-tf-var-filePath to a .tfvars file. Supports HCL variables.No
-auto-approveSkip the confirmation prompt and automatically apply after planning.No
don't forget the managed identity!

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