Step 6 of 7
GC Provision
Updated Sep 13, 2026 · Harness Admin
Platform Concept: "... As Code" Anywhere
- The UI is a great option, but throughout Harness, everything is backed with an "as code approach".
- Teams can easily switch between visual and yaml views.
Platform Concept: "Standardized Terraform/OpenTofu Harness providers"
- Harness has fully registered terraform providers available that use granular tokens for access.
- Use terraform/opentofu to build a pipeline. Have that pipeline deploy terraform... that uses terraform/opentofu to build another pipeline. That, uh, could deploy more terraform! Honestly, the fun never ends. But please, recurse responsibly. Think of the children. #PleaseDoNotCreateInfiniteLoopsThatDestroyTheWorldThanks
A) Create new workspace "as code"
-
In the left nav scope selector, click projects then your project.

-
In the left nav, click the mega-hamburger button and select Infrastructure as Code Management.

Create a workspace template
-
At the top, click _ + Create a Pipeline_, name it
IaCM-VM
-
Click the + above Add Stage, then Custom Stage, name it
Provision Workspace
-
Click + above Add Step, then Add Step, pick Terraform Plan.
-
Follow the table to configure:
Name
Text Workspace-PlanCommand
Select Apply
Provision Identifier
Text vmcreate<+pipeline.sequenceId>Secret Manager
Select -> Project -> Harness Built-in Secret Manager
Configuration File Repository
Select Github
GitHub Connector
Select -> Account -> GlobalcorpGithub

Repo Name
Text globalcorp-iacmGit Fetch Type
Latest from Branch
Branch
Text mainFolder Path
Text harness/workspace
Optional Configuration
Click to open
Terraform Var Files (optional)
select +Add -> Add Inline
Identifier
Text terraform.tfvarsContent
Text // Platformaccount_id = "<+account.identifier>"org_id = "<+org.identifier>"project_id = "<+project.identifier>"api_key = "<+secrets.getValue("account.Harness_API_Key")>"// Workspaceworkspace_name = "<+pipeline.variables.vm_name>"workspace_provider_connector = "org.GCP_Platform_Connector"workspace_repository_name = "globalcorp-iacm"workspace_repository_path = "harness/gcpvm"workspace_repository_connector = "org.GitHub_Connector"tf_vars = [ { key = "vm_name" value = "<+pipeline.variables.vm_name>" value_type = "string" }, { key = "vm_owner" value = "<+pipeline.variables.requestor_name.replace(".", "_")>" value_type = "string" }]
Export Human Readable representation of Terraform Plan
Click to enable
Store terraform plan on delegate
Click to enable
(top right corner)

-
(top right corner)

Configure Variables
-
On the right sidebar, click Variables.

-
In the top section, click +Add Variable in the Custom Variables line.

-
Follow the table to configure:
Name
Text vm_nameValue
Select the pin and change to Runtime input

Set variable as required during runtime
Click to enable

-
Click +Add Variable again.
-
Follow the table to configure:
Name
Text requestor_nameValue
Select the pin and change to Runtime input

Set variable as required during runtime
Click to enable

-
Follow the table to configure:
Name
Text vm_typeValue
Select the pin and change to Runtime input


-
(top right corner)

-
(top right corner)

Add Workspace Apply Step
-
Click Provision Workspace stage at the top of screen if not selected.
-
Click the + above Add Step, then Add Step, then select Terraform Apply.
-
Follow the table to configure:
Name
Text Workspace-ApplyConfiguration Type
Configuration Type -> Inherit From Plan
Provisioner Identifier
Text vmcreate<+pipeline.sequenceId> -
(top right corner)

-
(top right corner)

-

-
In the run Pipeline screen, for vm_name enter your first name or your favorite pet name. (Let's scoot passed using favoriate children names for purposes of keeping this light and fluffy.)
-
Confirm that requstor_name has a default value and that vm_type is optional.
-

-
Hang tight until the pipeline completes.
Review new workspace
-
In the left-nav click Workspaces.
-
Click your new workspace, then Variables, then OpenTofu Variables. Review what was configured.
-
Click Configuration. Review the connector, workspace type, and version.
-
Scroll to the bottom and click Delete Workspace, then enter name of workspace, then Delete.
B) Build VM with IaCM
-
Return to your pipeline, then at the top of screen click + above Add Stage.
Leverage built-in Harness Steps
-
Select the infrastructure stage type, and name it
Provision VM.
-
Confirm Cloud is selected as infrastructure.

-
Next to the Workspace field, update the little pin to expression.

-
In the Workspace field enter:
Text <+pipeline.variables.vm_name>
-
In the Operations page, click Provision Terraform, then click Use Operation.
-
(top right corner)

-
Hover your cursor between the plan and apply steps, then click the + that appears, then Add Step.

Add automated approval
-
From the IaCM library, click IACM Approval, then follow the table to configure:
Name
Text VM ApprovalAuto approve when the plan does not change
Click to enable
-
(top right corner)

-

-

-
In the Run Pipeline box, enter a vm_name and your first name as requestor.

-
Watch the pipeline execute, when Vm Approval appears, click, then click Review.

-
Review the proposed changes from the plan, then click Approve Now. Or Reject. (You MONSTER!)
C) Check out your new VM
- In your Google Cloud Platform tab, search for vm at the top and select.
- Confirm your new VM is present, then click it.
- Scroll down to the disk type and confirm the ubuntu disk is selected (it is the default in the terraform repository if no choice is made).
- Scroll to the Network tags section and confirm the VM was tagged with your name.