Skip to main content

tharsis_workspace

Defines and manages a workspace.

Example Usage​

resource "tharsis_workspace" "this" {
name = "my-workspace"
description = "A workspace managed by Terraform."
group_id = tharsis_group.top_level.id
terraform_version = "1.9.0"
max_job_duration = 720
prevent_destroy_plan = false
}

Behavior​

  • A workspace holds a Terraform deployment. It plans, applies, or destroys the infrastructure defined by a Terraform module, and stores the resulting state, variables, outputs, and run history.
  • A workspace runs one job at a time, in first-in, first-out order.
  • Variables, managed identities, service accounts, and VCS providers set on a parent group are inherited by the workspace.
  • A name may contain digits, lowercase letters, hyphens, and underscores, and cannot start or end with a hyphen or underscore. It cannot be changed after creation.

Deletion​

Deleting a workspace is irreversible. It permanently removes the workspace's runs, state files, and outputs.

Schema​

Required​

  • description (String) A description of the workspace.
  • name (String) The name of the workspace.

Optional​

  • group_id (String) The ID or TRN of the parent group.
  • group_path (String) Path of the parent group.
  • max_job_duration (Number) Maximum job duration in minutes.
  • prevent_destroy_plan (Boolean) Whether a destroy plan would be prevented.
  • terraform_version (String) Terraform version for this workspace.

Read-Only​

  • full_path (String) The path of the parent namespace plus the name of the workspace.
  • id (String) String identifier of the workspace.
  • last_updated (String) Timestamp when this workspace was most recently updated by Terraform.

Import​

Import is supported using the following syntax:

In Terraform v1.5.0 and later, the import block can be used with the id attribute, for example:

# A workspace can be imported by its TRN, which is "trn:workspace:" followed by
# the group path and the workspace name.
import {
to = tharsis_workspace.this
id = "trn:workspace:my-group/my-workspace"
}

# The workspace's ID also works as the id, shown by the "id" attribute or in the
# Tharsis UI.