Globalcorp

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"

  1. In the left nav scope selector, click projects then your project. Project Select

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

    Create a workspace template

  3. At the top, click _ + Create a Pipeline_, name it IaCM-VM Project Select

  4. Click the + above Add Stage, then Custom Stage, name it Provision Workspace Project Select

  5. Click + above Add Step, then Add Step, pick Terraform Plan.

  6. Follow the table to configure:

    Name

    Text
    Workspace-Plan

    Command

    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 Project Select Project Select

    Repo Name

    Text
    globalcorp-iacm

    Git Fetch Type

    Latest from Branch

    Branch

    Text
    main

    Folder Path

    Text
    harness/workspace

    Project Select

    Optional Configuration

    Click to open

    Terraform Var Files (optional)

    select +Add -> Add Inline

    Identifier

    Text
    terraform.tfvars

    Content

    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"    }]

    Project Select

    Export Human Readable representation of Terraform Plan

    Click to enable

    Store terraform plan on delegate

    Click to enable

    (top right corner) Project Select

  7. (top right corner) Project Select

    Configure Variables

  8. On the right sidebar, click Variables. Project Select

  9. In the top section, click +Add Variable in the Custom Variables line. Project Select

  10. Follow the table to configure:

    Name

    Text
    vm_name

    Value

    Select the pin and change to Runtime input Project Select

    Set variable as required during runtime

    Click to enable Project Select

  11. Click +Add Variable again.

  12. Follow the table to configure:

    Name

    Text
    requestor_name

    Value

    Select the pin and change to Runtime input Project Select

    Set variable as required during runtime

    Click to enable Project Select

  13. Follow the table to configure:

    Name

    Text
    vm_type

    Value

    Select the pin and change to Runtime input Project Select

    Project Select

  14. (top right corner) Project Select

  15. (top right corner) Project Select

    Add Workspace Apply Step

  16. Click Provision Workspace stage at the top of screen if not selected.

  17. Click the + above Add Step, then Add Step, then select Terraform Apply.

  18. Follow the table to configure:

    Name

    Text
    Workspace-Apply

    Configuration Type

    Configuration Type -> Inherit From Plan

    Provisioner Identifier

    Text
    vmcreate<+pipeline.sequenceId>
  19. (top right corner) Project Select

  20. (top right corner) Project Select

  21. Project Select

  22. 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.)

  23. Confirm that requstor_name has a default value and that vm_type is optional.

  24. Project Select

  25. Hang tight until the pipeline completes.

    Review new workspace

  26. In the left-nav click Workspaces.

  27. Click your new workspace, then Variables, then OpenTofu Variables. Review what was configured.

  28. Click Configuration. Review the connector, workspace type, and version.

  29. Scroll to the bottom and click Delete Workspace, then enter name of workspace, then Delete.

B) Build VM with IaCM

  1. Return to your pipeline, then at the top of screen click + above Add Stage.

    Leverage built-in Harness Steps

  2. Select the infrastructure stage type, and name it Provision VM.

  3. Confirm Cloud is selected as infrastructure.

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

  5. In the Workspace field enter:

    Text
    <+pipeline.variables.vm_name>

  6. In the Operations page, click Provision Terraform, then click Use Operation.

  7. (top right corner)

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

    Add automated approval

  9. From the IaCM library, click IACM Approval, then follow the table to configure:

    Name

    Text
    VM Approval

    Auto approve when the plan does not change

    Click to enable

  10. (top right corner)

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

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

  13. Review the proposed changes from the plan, then click Approve Now. Or Reject. (You MONSTER!)

C) Check out your new VM

  1. In your Google Cloud Platform tab, search for vm at the top and select.
  2. Confirm your new VM is present, then click it.
  3. 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).
  4. Scroll to the Network tags section and confirm the VM was tagged with your name.