Skip to main content

Provision Workspaces

Last updated on

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.


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

Harness IaCM provision pipeline plan step fails with connector or authentication error

Verify that the connector attached to your workspace has valid credentials and the correct permissions for your cloud provider. Go to the workspace Variables and Connectors tab to inspect and update the connector.

Harness IaCM provision pipeline apply step times out or fails mid-run

Check the apply step logs for the specific resource that failed. Common causes are insufficient cloud provider permissions, resource conflicts, or a state lock held by another run. Resolve the underlying error and re-run the pipeline.

IaCM approval step does not show cost estimates after plan

Verify that cost estimation is enabled on the workspace Configuration tab. Cost estimates only appear when a plan step precedes the approval step and cost estimation is toggled on for the workspace.


review resources

After the pipeline completes, go to the workspace Resources tab to view all provisioned resources, data sources, and outputs managed by your workspace.


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.