Skip to content

Harness Cloud Run Delegate

Goal

Easily deploy the Harness Delegate in Google Cloud Run using Harness IaCM.

Prerequisites

  • Harness Infrastructure as Code Management and Code Repository (on by default) enabled in your Harness Account
  • Access to public GitHub.com repositories
  • Sufficient permissions to create a project, provision a service account, and deploy new Google Cloud Run services

Guided Setup

A) Import the terraform delegate repository

  1. In Harness Code Repository, click Repositories, the dropdown next to +New Repository, then Import Repository. newrepo

  2. in the new repository window, enter the settings below, then click Import Repository.

    SettingValue
    GitHub ProviderGitHub
    Organizationsuchcodewow
    Repositoryglobalcorp-iacm
    Name (leave default)globalcorp-iacm

    reposettings

  3. Hang tight for a second while Harness imports the repository for you.

B) Create a Harness Google Connector

In Google Cloud:

  1. (optional) create a new project in Google Cloud for the delegate.
  2. (optional, but recommended) create a service account in the project with project administrator.
  3. Create (or retrieve existing) service account key json file.

Before continuing, make sure to have the following handy:

  • the project ID
  • service account email address
  • credential key json file for service account

In Harness:

  1. Click Projects on the left blue menu, then Connectors. connectorcreate

  2. Click +New Connector in the top left, then under Cloud Providers click GCP.

  3. Name the connector something like GCP-[yourprojectID]-admin and click next.

  4. Click Specify Credentials Here and then Create or select a Secret.

  5. Click on (1) New Secret File then steps below to create the secret.

    SettingValue
    Secrets ManagerHarness Secret Manager
    (2) Secret NameGCP-projectid-secret (swap in your project identifer!)
    (3) Select File(click browse and select the json file from above)
    (4) Click Save

    createsecret

  6. Ensure your new secret is selected then click Apply Selected.

  7. Click Connect through Harness Platform then Save and Continue.

  8. Confirm that you receive a successful validation, then click Finish.

C) Import your token as a variable

  1. CLick on Project Settings in the left blue bar, then delegates under Project-level resources.
  2. Click

D) Create and configure a Delegate Workspace

  1. In Harness IaCM, select workspaces and then* +New Workspace*.
    workspace

  2. On the configuration page, enter the settings as shown below.

    SettingValue
    (1) Name the workspacecloudrun-delegate
    (2) Click and select the connector in B)GCP-[yourprojectID]-admin
    (3) use OpenTofu and select version1.8.1
    (4) Choose Repository typeHarness Code Repository
    (5) Enter repository`globalcorp-iacm’
    (6) Specify Folder’delegate/gcp-cloudrun’
    (7) Click Save

workspace

  1. Click on your new workspace, then Variables, and OpenTofu Variables. For each variable below, click +New OpenTofu Variable and enter key/value.

    KeyValue
    accountId<+account.identifier>
    delegateManagerUrlhttps://app.harness.io
    googleProject(your google project ID)
    googleRegioni.e. us-central1
    googleServiceAccount(email of service account created above)
    uniqueIdentifierprimary

workspace