Provision Workspaces
Learn how to provision workspaces using an interactive guide, step-by-step instructions, and YAML.
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 commands with OpenTofu or Terraform.
Before you begin
Before you create a provision pipeline in your workspace, ensure you have the following:
IaCM-enabled Harness account: You need Infrastructure as Code Management available in your Harness project. Go to Get started with IaCM to set up your account and enable the module.
Workspace: You need an existing workspace to provision. Go to Create a workspace to set one up before running a provision pipeline.
Pipeline permissions: You need View, Create/Edit, and Execute permissions on Pipelines. Go to RBAC in Harness to configure roles, and go to the Permissions reference to review the required permissions.
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.

Add infrastructure stage 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.
Go to the Execution tab. Under Common Operations, select Provision. Go to Pipeline operations to learn about other available operations such as drift detection and PR automation.
Optionally, select Use Strategy to automatically add
init,plan, andapplysteps, 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.
Add guardrails before apply
To prevent unverified or non-compliant changes from reaching your infrastructure, you can add some guardrails in your provisioning pipeline.
Approval step: Add a manual approval step after the diff review step so a reviewer can confirm planned changes, policy results, and cost estimates before infrastructure changes apply. Without this gate, unverified changes apply automatically. Go to Pipeline operations to add an approval step to your provisioning pipeline.
OPA (Open Policy Agent) policies: Apply OPA policies to warn or fail the pipeline when a change violates your rules, such as version requirements, resource tagging, or connector restrictions. Without policy enforcement, a non-compliant change reaches production before anyone reviews it. Go to OPA policies for workspaces to configure policy enforcement.
Cost checks (not supported for AWS CDK workspaces): Enable cost estimation and cost policies so a plan that exceeds a cost threshold stops before apply. Without cost controls, a large or mistyped change provisions expensive resources before you see the impact. Go to cost estimation to enable cost visibility, and go to plan and cost policies to set thresholds that block apply.
Troubleshooting
Next steps
Your workspace is now provisioned. You can monitor and manage infrastructure changes with the following operations.
Go to Pipeline operations to add drift detection, PR automation, and queue steps to your pipelines.
Go to Default pipelines to set a shared provision pipeline across all workspaces in a project.
Go to Delete a workspace to destroy and remove a workspace when it is no longer needed.
Last updated
Was this helpful?