Skip to main content

Manage IACM Workspace Plugin Reference

The Manage IACM Workspace plugin provides full lifecycle management for Harness IACM workspaces. Use it in your Harness pipelines to create, update, query, or delete IACM workspaces, manage variables and secrets, and perform bulk tag refactoring — all through a single, configurable plugin step.

Important notes

info
  • The plugin requires Python 3.11+ and Docker with buildx support at runtime.
  • The remove operation is destructive and irreversible. Use it only after confirming the correct workspace identifier.
  • Secret variables (PLUGIN_RESOURCE_VARS_SECRETS, PLUGIN_RESOURCE_VARS_ENVS_SECRETS) are passed as Harness secret references and are never logged or exposed in plain text.

Plugin image

harnesssolutionfactory/harness-manage-iacm-workspace:latest

Operation modes

Set the PLUGIN_SWITCH variable to control what the plugin does.

ModeAliasDescription
mainregisterCreate or update an IACM workspace with variables and configuration
viewQuery and retrieve workspace details; supports filtering by tags and attributes
remove⚠️ Delete a workspace by identifier (destructive)
refactorBulk-update workspace tags and source classification

Use in Harness pipelines

Add the plugin as a Plugin step in your stage. The examples below cover each operation mode.

Create or update a workspace

- step:
type: Plugin
name: Provision IACM Workspace
identifier: provision_workspace
description: Create or update IACM workspace with Terraform variables and configuration
spec:
connectorRef: <+input>
image: harnesssolutionfactory/harness-manage-iacm-workspace:latest
settings:
PLUGIN_HARNESS_ENDPOINT: <+pipeline.variables.harness_endpoint>
PLUGIN_HARNESS_ACCOUNT_ID: <+account.identifier>
PLUGIN_API_KEY: <+secrets.getValue("harness_api_key")>
PLUGIN_SWITCH: main
PLUGIN_RESOURCE_NAME: my-workspace
PLUGIN_RESOURCE_OWNER: platform-team
PLUGIN_RESOURCE_VARS: '{"harness_platform_account":"<+account.identifier>","organization_name":"my-org"}'
PLUGIN_RESOURCE_VARS_SECRETS: '{"api_secret":"<+secrets.getValue(\"api_secret\")>"}'
PLUGIN_GIT_REPOSITORY_BRANCH: main
PLUGIN_GIT_REPOSITORY_CONNECTOR: org.harness_template_repo
PLUGIN_GIT_REPOSITORY_NAME: https://git.harness.io/account/org/repo.git
PLUGIN_GIT_REPOSITORY_PATH: workspaces/my-workspace
PLUGIN_HARNESS_PORTAL_RESOURCES: iacm/api/orgs/my-org/projects/my-project/workspaces
PLUGIN_HARNESS_PLATFORM_KEY: org.hsf_platform_api_key
PLUGIN_IAC_PROVISIONER_TYPE: opentofu
PLUGIN_IAC_PROVISIONER_VERSION: "1.10.0"
PLUGIN_WORKSPACE_ORG: my-organization
PLUGIN_WORKSPACE_PROJECT: my-project
PLUGIN_WORKSPACE_TAGS: '{"source":"official","type":"infrastructure"}'
PLUGIN_SHOULD_OVERWRITE_VARIABLES: "false"
PLUGIN_INCLUDE_HARNESS_ENVS: "false"
PLUGIN_DEBUG: "false"

Create a workspace from a template

- step:
type: Plugin
name: Create Workspace from Template
identifier: create_templated_workspace
description: Create IACM workspace from a Harness workspace template
spec:
connectorRef: <+input>
image: harnesssolutionfactory/harness-manage-iacm-workspace:latest
settings:
PLUGIN_HARNESS_ENDPOINT: <+pipeline.variables.harness_endpoint>
PLUGIN_HARNESS_ACCOUNT_ID: <+account.identifier>
PLUGIN_API_KEY: <+secrets.getValue("harness_api_key")>
PLUGIN_SWITCH: main
PLUGIN_RESOURCE_NAME: template-workspace
PLUGIN_RESOURCE_OWNER: platform-team
PLUGIN_WORKSPACE_ORG: my-organization
PLUGIN_WORKSPACE_PROJECT: my-project
PLUGIN_WORKSPACE_TEMPLATE_IDENTIFIER: base-infrastructure
PLUGIN_WORKSPACE_TEMPLATE_VERSION: "1.0"
PLUGIN_RESOURCE_VARS: '{"environment":"production"}'

Query workspaces by tags

- step:
type: Plugin
name: Get Workspaces by Tags
identifier: get_workspaces_by_tags
description: Retrieve workspace identifiers filtered by tags
spec:
connectorRef: <+input>
image: harnesssolutionfactory/harness-manage-iacm-workspace:latest
settings:
PLUGIN_HARNESS_ENDPOINT: <+pipeline.variables.harness_endpoint>
PLUGIN_HARNESS_ACCOUNT_ID: <+account.identifier>
PLUGIN_API_KEY: <+secrets.getValue("harness_api_key")>
PLUGIN_SWITCH: view
PLUGIN_WORKSPACE_TAGS: '{"source":"official","type":"infrastructure"}'
PLUGIN_RETURN_KEY: identifier
PLUGIN_IGNORE_HSF_SYSTEM: "true"

Filter workspaces by attribute

- step:
type: Plugin
name: Filter Workspaces by Attribute
identifier: filter_workspaces
description: Query a specific workspace by identifier
spec:
connectorRef: <+input>
image: harnesssolutionfactory/harness-manage-iacm-workspace:latest
settings:
PLUGIN_HARNESS_ENDPOINT: <+pipeline.variables.harness_endpoint>
PLUGIN_HARNESS_ACCOUNT_ID: <+account.identifier>
PLUGIN_API_KEY: <+secrets.getValue("harness_api_key")>
PLUGIN_SWITCH: view
PLUGIN_FILTER_KEY: identifier
PLUGIN_FILTER_VALUE: my-workspace
PLUGIN_RETURN_KEY: identifier

Find workspaces tagged for decommission

- step:
type: Plugin
name: Get Workspaces for Decommission
identifier: get_workspaces_decomm
description: Find all workspaces marked for decommissioning
spec:
connectorRef: <+input>
image: harnesssolutionfactory/harness-manage-iacm-workspace:latest
settings:
PLUGIN_HARNESS_ENDPOINT: <+pipeline.variables.harness_endpoint>
PLUGIN_HARNESS_ACCOUNT_ID: <+account.identifier>
PLUGIN_API_KEY: <+secrets.getValue("harness_api_key")>
PLUGIN_SWITCH: view
PLUGIN_WORKSPACE_TAGS: '{"decommission":"true"}'
PLUGIN_RETURN_KEY: identifier

Delete a workspace

danger

This is a destructive, irreversible operation. Double-check PLUGIN_RESOURCE_NAME before running.

- step:
type: Plugin
name: Remove IACM Workspace
identifier: remove_workspace
description: Permanently delete an IACM workspace by identifier
spec:
connectorRef: <+input>
image: harnesssolutionfactory/harness-manage-iacm-workspace:latest
settings:
PLUGIN_HARNESS_ENDPOINT: <+pipeline.variables.harness_endpoint>
PLUGIN_HARNESS_ACCOUNT_ID: <+account.identifier>
PLUGIN_API_KEY: <+secrets.getValue("harness_api_key")>
PLUGIN_SWITCH: remove
PLUGIN_RESOURCE_NAME: workspace-to-delete

Settings reference

Connection and authentication

SettingTypeRequiredDefaultDescription
PLUGIN_HARNESS_ENDPOINTStringYesBase URL of the Harness platform. Example: https://app.harness.io
PLUGIN_HARNESS_ACCOUNT_IDStringYesYour Harness account identifier. Example: uZuUmmrnT4qQRx5XF0ZtkQ
PLUGIN_HARNESS_PORTAL_RESOURCESStringYesAPI path to the workspace resources endpoint. Example: iacm/api/orgs/my-org/projects/my-project/workspaces
PLUGIN_HARNESS_PLATFORM_KEYStringYesorg.hsf_platform_api_keyPlatform API key identifier used for authentication.
PLUGIN_API_KEYStringYesAPI key for authenticating requests. Example: pat.xxxxx.xxxxx

Operation control

SettingTypeRequiredDefaultDescription
PLUGIN_SWITCHStringNomainOperation mode. One of: main, view, remove, refactor.
PLUGIN_DEBUGBooleanNofalseSet to true to enable verbose debug logging.

Workspace configuration

SettingTypeRequiredDefaultDescription
PLUGIN_RESOURCE_NAMEStringYesWorkspace identifier. Example: my-workspace
PLUGIN_RESOURCE_OWNERStringYesTeam or individual that owns the workspace. Example: platform-team
PLUGIN_WORKSPACE_ORGStringNoHarness_Platform_ManagementOrganization identifier within Harness.
PLUGIN_WORKSPACE_PROJECTStringNoSolutions_FactoryProject identifier within the organization.
PLUGIN_WORKSPACE_TAGSString (JSON)No{}Key-value tags applied to the workspace. Used for filtering in view and refactor modes. Example: {"source":"official","type":"infrastructure"}
PLUGIN_WORKSPACE_TEMPLATE_IDENTIFIERStringNoskippedWorkspace template ID. Required when provisioning from a template. Example: base-infrastructure
PLUGIN_WORKSPACE_TEMPLATE_VERSIONStringNoskippedVersion of the workspace template to use. Example: 1.0

Git repository settings

SettingTypeRequiredDefaultDescription
PLUGIN_GIT_REPOSITORY_BRANCHStringYesmainGit branch to use for the workspace.
PLUGIN_GIT_REPOSITORY_CONNECTORStringYesorg.Harness_Template_Library_RepoHarness connector identifier for the Git repository.
PLUGIN_GIT_REPOSITORY_NAMEStringYesFull URL of the Git repository. Example: https://git.harness.io/account/org/repo.git
PLUGIN_GIT_REPOSITORY_PATHStringNoSubdirectory path within the repository. Example: workspaces/my-workspace

IaC configuration

SettingTypeRequiredDefaultDescription
PLUGIN_IAC_PROVISIONER_TYPEStringNoopentofuIaC provisioner to use. Accepted values: opentofu, terraform.
PLUGIN_IAC_PROVISIONER_VERSIONStringNo1.8.0Version of the provisioner. Example: 1.10.0
PLUGIN_IAC_PROVIDER_CONNECTORStringNo""Harness connector for the IaC provider. Example: org.hsf_solutions_factory_connector

Variable management

SettingTypeRequiredDefaultDescription
PLUGIN_RESOURCE_VARSString (JSON)No{}Terraform input variables passed to the workspace. Example: {"key":"value","env":"prod"}
PLUGIN_RESOURCE_VARS_SECRETSString (JSON)No{}Terraform variables sourced from Harness secrets. Example: {"api_key":"secret_value"}
PLUGIN_RESOURCE_VARS_FILESString (JSON Array)No[]List of variable files to include. Example: ["terraform.tfvars","prod.tfvars"]
PLUGIN_RESOURCE_VARS_ENVSString (JSON)No{}Environment variables passed to the provisioner. Example: {"LOG_LEVEL":"info"}
PLUGIN_RESOURCE_VARS_ENVS_SECRETSString (JSON)No{}Environment variables sourced from Harness secrets. Example: {"API_SECRET":"secret"}
PLUGIN_OVERRIDESString (JSON)No{}Environment-specific variable overrides. Example: {"prod":{"key":"terraform_key"}}
PLUGIN_SHOULD_OVERWRITE_VARIABLESBooleanNofalseWhen true, replaces all existing variables. When false, merges with existing values.

Advanced settings

SettingTypeRequiredDefaultDescription
PLUGIN_INCLUDE_HARNESS_ENVSBooleanNofalseWhen true, injects standard Harness environment variables into the workspace.
PLUGIN_IS_EPHEMERALBooleanNofalseWhen true, marks the workspace as ephemeral (short-lived, for temporary environments).

Filtering and query options (view mode)

SettingTypeRequiredDefaultDescription
PLUGIN_FILTER_KEYStringNoWorkspace attribute to filter by. Example: identifier, repository_connector
PLUGIN_FILTER_VALUEStringNoValue to match against the filter key. Example: my-workspace
PLUGIN_RETURN_KEYStringNoWorkspace attribute to return in query results. Example: identifier
PLUGIN_IGNORE_HSF_SYSTEMBooleanNofalseWhen true, excludes internal HSF system workspaces from results.

Local development

Docker examples

The plugin can be run directly with Docker for local testing.

Create or update a workspace:

docker run --rm \
-e PLUGIN_HARNESS_ENDPOINT=https://app.harness.io \
-e PLUGIN_HARNESS_ACCOUNT_ID=your_account_id \
-e PLUGIN_API_KEY=your_api_key \
-e PLUGIN_SWITCH=main \
-e PLUGIN_RESOURCE_NAME=my-workspace \
-e PLUGIN_RESOURCE_OWNER=platform-team \
-e PLUGIN_RESOURCE_VARS='{"harness_platform_account":"your_account","organization_name":"my-org"}' \
-e PLUGIN_GIT_REPOSITORY_BRANCH=main \
-e PLUGIN_GIT_REPOSITORY_CONNECTOR=org.harness_template_repo \
-e PLUGIN_GIT_REPOSITORY_NAME=https://git.harness.io/account/org/repo.git \
-e PLUGIN_GIT_REPOSITORY_PATH=workspaces/my-workspace \
-e PLUGIN_HARNESS_PORTAL_RESOURCES=iacm/api/orgs/my-org/projects/my-project/workspaces \
-e PLUGIN_HARNESS_PLATFORM_KEY=org.hsf_platform_api_key \
-e PLUGIN_IAC_PROVISIONER_TYPE=opentofu \
-e PLUGIN_IAC_PROVISIONER_VERSION=1.10.0 \
-e PLUGIN_WORKSPACE_ORG=Harness_Platform_Management \
-e PLUGIN_WORKSPACE_PROJECT=Solutions_Factory \
-e PLUGIN_WORKSPACE_TAGS='{"source":"official","type":"infrastructure"}' \
-e PLUGIN_SHOULD_OVERWRITE_VARIABLES=false \
harnesssolutionfactory/harness-manage-iacm-workspace:latest

Query workspaces by tags:

docker run --rm \
-e PLUGIN_HARNESS_ENDPOINT=https://app.harness.io \
-e PLUGIN_HARNESS_ACCOUNT_ID=your_account_id \
-e PLUGIN_API_KEY=your_api_key \
-e PLUGIN_SWITCH=view \
-e PLUGIN_WORKSPACE_TAGS='{"source":"official","type":"infrastructure"}' \
-e PLUGIN_RETURN_KEY=identifier \
-e PLUGIN_IGNORE_HSF_SYSTEM=true \
harnesssolutionfactory/harness-manage-iacm-workspace:latest

Delete a workspace:

docker run --rm \
-e PLUGIN_HARNESS_ENDPOINT=https://app.harness.io \
-e PLUGIN_HARNESS_ACCOUNT_ID=your_account_id \
-e PLUGIN_API_KEY=your_api_key \
-e PLUGIN_SWITCH=remove \
-e PLUGIN_RESOURCE_NAME=workspace-to-delete \
harnesssolutionfactory/harness-manage-iacm-workspace:latest