Skip to main content

Provision and destroy workspaces

After you create a workspace, you can perform operations against the configuration, such as provisioning and destroying. You must use a Harness pipeline to provision or destroy a workspace.

Provision a workspace

You can use the Harness Visual Editor or YAML to provision a workspace.

Use the following sample and update the areas in brackets.

pipeline:
name: <<PIPELINE NAME>>
identifier: <<PIPELINE IDENTIFIER>>
projectIdentifier: <<PROJECT IDENTIFIER>>
orgIdentifier: <<ORG IDENTIFER>>
tags: {}
stages:
- stage:
name: testiacm
identifier: testiacm
description: ""
type: IACM
spec:
platform:
os: Linux
arch: Amd64
runtime:
type: Cloud
spec: {}
workspace: <<WORKSPACE ID>>
execution:
steps:
- step:
type: IACMTerraformPlugin
name: init
identifier: init
timeout: 5m
spec:
command: init
- step:
type: IACMTerraformPlugin
name: plan
identifier: plan
timeout: 5m
spec:
command: plan
- step:
type: IACMTerraformPlugin
name: apply
identifier: apply
timeout: 5m
spec:
command: apply
tags: {}

Destroy a workspace

You can use the Harness Visual Editor or YAML to create a pipeline that will tear down (destroy) a workspace.

Use the following sample and update the areas in brackets.

pipeline:
name: <<PIPELINE NAME>>
identifier: <<PIPELINE IDENTIFIER>>
projectIdentifier: <<PROJECT IDENTIFIER>>
orgIdentifier: <<ORG IDENTIFER>>
tags: {}
stages:
- stage:
name: iacstage
identifier: iacstage
description: ""
type: IACM
spec:
workspace: <<WORKSPACE ID>>
platform:
os: Linux
arch: Amd64
runtime:
type: Cloud
spec: {}
execution:
steps:
- step:
type: IACMTerraformPlugin
name: init
identifier: init
spec:
command: init
timeout: 5m
- step:
type: IACMTerraformPlugin
name: plan
identifier: plandestroy
spec:
command: plan-destroy
description: plan destroy
- step:
type: IACMTerraformPlugin
name: destroy
identifier: destroy
spec:
command: destroy
description: destroy
timeout: 5m
tags: {}
tip

Currently, IaCM doesn't support multiple Workspaces in the same pipeline. If you'd like to provision several Workspaces altogether, consider using Pipeline Chaining