Provision Workspaces
After you create a workspace, you can perform operations against the configuration, including provisioning. This guide walks you through how to create a provision pipeline to run the init
, plan
and apply
command with OpenTofu or Terraform.
- Interactive Guide
- Step-by-Step
- YAML
Follow these instructions to provision a workspace within the Harness Visual Editor.
-
In the Harness project pane, select Pipelines.
-
Click + Create a Pipeline to set up a new pipeline.
-
Click Add Stage and select Infrastructure from the Select Stage Type pane.
-
Enter a stage name, optional description, and tag, then select Set Up Stage.
-
On the Workspace tab, select an existing workspace or click + Create New Workspace to create one.
If set to runtime input
, you can specify the workspace at execution time..
- Go to the Execution tab. Under Common Operations, select Provision.
- Optionally, select Use Strategy to automatically add
init
,plan
, andapply
steps, or customize the pipeline by adding steps manually. - Click Save and then Run Pipeline to execute.
To provision a workspace via YAML, use the template below. Replace bracketed placeholders as needed.
pipeline:
name: <<PIPELINE NAME>>
identifier: <<PIPELINE IDENTIFIER>>
projectIdentifier: <<PROJECT IDENTIFIER>>
orgIdentifier: <<ORG IDENTIFIER>>
tags: {}
stages:
- stage:
name: Provision Stage
identifier: provision_stage
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
- step:
type: IACMTerraformPlugin
name: plan
identifier: plan
spec:
command: plan
- step:
type: IACMTerraformPlugin
name: apply
identifier: apply
spec:
command: apply
tags: {}
Notice the three steps to execute your init
, plan
and apply
commands.
After the plan is created, view resources and Terraform outputs on the Resources tab. Check which resources will be added, modified, or removed.