Skip to content

Instantly share code, notes, and snippets.

@rssnyder
Last active July 1, 2025 21:36
Show Gist options
  • Save rssnyder/82a2cd762b931fd390df0b7b2bac6adb to your computer and use it in GitHub Desktop.
Save rssnyder/82a2cd762b931fd390df0b7b2bac6adb to your computer and use it in GitHub Desktop.
hsf workflow template for custom templates
apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
name: external-template-test
title: external-template-test
description: external-template-test
tags:
- solutions-factory
- harness
spec:
owner: group:default/harness_account_all_users
type: test
parameters:
- title: external-template-test
properties:
name:
title: Template Name
type: string
org_id:
title: Org Identifier
description: Harness Organization Identifier
type: string
ui:field: HarnessOrgPicker
project_id:
title: Project Identifier
description: Harness Project Identifier
type: string
ui:field: HarnessProjectPicker
token:
title: Harness Token
type: string
ui:widget: password
ui:field: HarnessAuthToken
- title: Solutions Factory Connection
properties:
solutions_factory_details:
title: Solutions Factory Details
type: object
description: |
---
Harness URL : <+variable.account.solutions_factory_endpoint>
Harness Account : <+account.identifier>
Solutions Factory Org : <+variable.account.solutions_factory_org>
Solutions Factory Project : <+variable.account.solutions_factory_project>
properties:
harness_account_url:
type: string
default: <+variable.account.solutions_factory_endpoint>
ui:widget: hidden
harness_account_id:
type: string
default: <+account.identifier>
ui:widget: hidden
harness_org_id:
type: string
default: <+variable.account.solutions_factory_org>
ui:widget: hidden
harness_project_id:
type: string
default: <+variable.account.solutions_factory_project>
ui:widget: hidden
template_library_connector:
type: string
default: <+variable.account.solutions_factory_template_library_connector>
ui:widget: hidden
template_library_repo:
type: string
default: <+variable.account.solutions_factory_template_library_repo>
ui:widget: hidden
template_library_branch:
type: string
default: main
ui:widget: hidden
steps:
- id: configure_workspace
name: Configuring Harness Workspace
action: trigger:harness-custom-pipeline
input:
url: ${{ parameters.solutions_factory_details.harness_account_url }}/ng/account/${{ parameters.solutions_factory_details.harness_account_id }}/all/orgs/${{ parameters.solutions_factory_details.harness_org_id }}/projects/${{ parameters.solutions_factory_details.harness_project_id }}/pipelines/Create_and_Manage_IACM_Workspaces/pipeline-studio?storeType=INLINE
inputset:
# Git details for external terraform template
GIT_REPOSITORY_CONNECTOR: account.buildfarm_source_code_manager_cloud
GIT_REPOSITORY_NAME: terraform-aws-modules/terraform-aws-eks
GIT_REPOSITORY_BRANCH: master
# Leave out if root directory is where the TF code lives
GIT_REPOSITORY_PATH: "tf-code-dir"
# Project where we want the workspace provisioned
WORKSPACE_ORG: ${{ parameters.org_id }}
WORKSPACE_PROJECT: ${{ parameters.project_id }}
# Cloud connector to use for workspace
# Leave out if no connector needed
IAC_PROVIDER_CONNECTOR: "account.harness_impeng_play"
# Workspace name and owner
RESOURCE_NAME: ${{ parameters.name|replace(" ", "_")|replace("-", "_") }}
RESOURCE_OWNER: group:default/harness_account_all_users
# YAML of Terraform variables of type 'String' mapped to their IDP parameters
RESOURCE_VARS: {}
RESOURCE_VARS_SECRETS: {}
# YAML of Environment variables of type 'String' mapped to their IDP parameters
RESOURCE_VARS_ENVS: {}
# YAML of Environment variables of type 'Secret' Reference mapped to their IDP parameters
RESOURCE_VARS_ENVS_SECRET: {}
# Should the workspace automatically include the default Harness Connector environment variables
INCLUDE_HARNESS_ENVS: "false"
apikey: ${{ parameters.token }}
showOutputVariables: true
- id: provision_workspace
name: Provisioning your Harness Workspace
action: trigger:harness-custom-pipeline
input:
# Reuires a pipeline to be provisioned into the project where the workspace is created
url: ${{ parameters.solutions_factory_details.harness_account_url }}/ng/account/${{ parameters.solutions_factory_details.harness_account_id }}/all/orgs/${{ parameters.org_id }}/projects/${{ parameters.project_id }}/pipelines/Execute_IACM_Workspaces/pipeline-studio?storeType=INLINE
inputset:
# Value should match the `RESOURCE_NAME` in the `Configuring Harness Workspace` step
workspace: ${{ parameters.name|replace(" ", "_")|replace("-", "_") }}
apikey: ${{ parameters.token }}
showOutputVariables: true
output:
links:
- title: Harness Workspace Configured - Execution Link
url: ${{ steps.configure_workspace.output.PipelineUrl }}
- title: Harness Workspace Provisioned - Execution Link
url: ${{ steps.provision_workspace.output.PipelineUrl }}
- title: Harness Workspace
url: ${{ parameters.solutions_factory_details.harness_account_url }}/ng/account/${{ parameters.solutions_factory_details.harness_account_id }}/all/iacm/orgs/${{ parameters.org_id }}/projects/${{ parameters.project_id }}/workspaces/${{ parameters.name|replace(" ", "_")|replace("-", "_") }}/resources
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment