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
-
In Harness Code Repository, click Repositories, the dropdown next to +New Repository, then Import Repository.
-
in the new repository window, enter the settings below, then click Import Repository.
Setting Value GitHub Provider GitHub Organization suchcodewow
Repository globalcorp-iacm
Name (leave default) globalcorp-iacm
-
Hang tight for a second while Harness imports the repository for you.
B) Create a Harness Google Connector
In Google Cloud:
- (optional) create a new project in Google Cloud for the delegate.
- (optional, but recommended) create a service account in the project with project administrator.
- 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:
-
Click Projects on the left blue menu, then Connectors.
-
Click +New Connector in the top left, then under Cloud Providers click GCP.
-
Name the connector something like GCP-[yourprojectID]-admin and click next.
-
Click Specify Credentials Here and then Create or select a Secret.
-
Click on (1) New Secret File then steps below to create the secret.
Setting Value Secrets Manager Harness Secret Manager (2) Secret Name GCP-projectid-secret
(swap in your project identifer!)(3) Select File (click browse and select the json file from above) (4) Click Save -
Ensure your new secret is selected then click Apply Selected.
-
Click Connect through Harness Platform then Save and Continue.
-
Confirm that you receive a successful validation, then click Finish.
C) Import your token as a variable
- CLick on Project Settings in the left blue bar, then delegates under Project-level resources.
- Click
D) Create and configure a Delegate Workspace
-
In Harness IaCM, select workspaces and then* +New Workspace*.
-
On the configuration page, enter the settings as shown below.
Setting Value (1) Name the workspace cloudrun-delegate
(2) Click and select the connector in B) GCP-[yourprojectID]-admin (3) use OpenTofu and select version 1.8.1 (4) Choose Repository type Harness Code Repository (5) Enter repository `globalcorp-iacm’ (6) Specify Folder ’delegate/gcp-cloudrun’ (7) Click Save
-
Click on your new workspace, then Variables, and OpenTofu Variables. For each variable below, click +New OpenTofu Variable and enter key/value.
Key Value accountId <+account.identifier>
delegateManagerUrl https://app.harness.io
googleProject (your google project ID) googleRegion i.e. us-central1 googleServiceAccount (email of service account created above) uniqueIdentifier primary