Skip to main content

tharsis_apply_module

Defines and manages tharsis_apply_module resources, which launch runs in other workspaces.

Example Usage​

resource "tharsis_apply_module" "this" {
workspace_id = tharsis_workspace.this.id
module_source = "tharsis.example.com/my-group/my-module/aws"
module_version = "1.0.0"

variables = [
{
category = "terraform"
key = "region"
value = "us-east-1"
}
]
}

Behavior​

  • Creating the resource runs a plan and apply of the module in the target workspace and waits for the run to finish.
  • Destroying the resource launches a destroy run, which removes the deployed resources without deleting the workspace.
  • variables are passed to the run. The variables the run actually used, including inherited ones, are reported in resolved_variables.

Permissions​

Only owners and deployers can launch runs.

Schema​

Required​

  • module_source (String) The source of the module.

Optional​

  • module_version (String) The version identifier of the module.
  • refresh (Boolean) Whether to do a Terraform refresh to update the state based on all managed remote objects.
  • variables (Attributes List) Optional list of variables for the run in the target workspace. (see below for nested schema)
  • wait_timeout (String) How long to wait for a run blocked on a policy gate to be approved, overridden or discarded in the Tharsis UI, as a Go duration string (e.g. "30m", "2h"). The run applies its plan without a separate approval, so only a policy gate can block it, and the provider cannot approve a gate itself. Defaults to "1h".
  • workspace_id (String) The ID or TRN of the workspace. Moving to a different workspace forces replacement; switching between the ID, the TRN or workspace_path of the same workspace is an in-place update that starts no run.
  • workspace_path (String, Deprecated) The full path of the workspace.

Read-Only​

  • id (String) An ID for this tharsis_apply_module resource.
  • resolved_variables (Attributes List) The variables that were used by the run. (see below for nested schema)

Nested Schema for variables​

Required:

  • category (String) Category of this variable, 'terraform' or 'environment'.
  • key (String) Key or name of this variable.
  • value (String) Value of the variable.

Nested Schema for resolved_variables​

Read-Only:

  • category (String) Category of this variable, 'terraform' or 'environment'.
  • key (String) Key or name of this variable.
  • namespace_path (String) Namespace path of the variable.
  • value (String) Value of the variable.