@lbrlabs/pulumi-harness
Version:
A Pulumi package for creating and managing Harness resources.
899 lines • 28.3 kB
JavaScript
"use strict";
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.Template = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Resource for creating a Template. Description field is deprecated
*
* ## Remote Pipeline template
*
* resource "harness.platform.Template" "pipelineTemplateRemote" {
* identifier = "identifier"
* orgId = harness_platform_project.test.org_id
* projectId = harness_platform_project.test.id
* name = "name"
* comments = "comments"
* version = "ab"
* isStable = true
* gitDetails {
* branchName = "main"
* commitMessage = "Commit"
* filePath = "filePath"
* connectorRef = "account.connector_ref"
* storeType = "REMOTE"
* repoName = "repoName"
* }
* templateYaml = <<-EOT
* template:
* name: "name"
* identifier: "identifier"
* versionLabel: "ab"
* type: Pipeline
* projectIdentifier: ${harness_platform_project.test.id}
* orgIdentifier: ${harness_platform_project.test.org_id}
* tags: {}
* spec:
* stages:
* - stage:
* identifier: dvvdvd
* name: dvvdvd
* description: ""
* type: Deployment
* spec:
* deploymentType: Kubernetes
* service:
* serviceRef: <+input>
* serviceInputs: <+input>
* environment:
* environmentRef: <+input>
* deployToAll: false
* environmentInputs: <+input>
* serviceOverrideInputs: <+input>
* infrastructureDefinitions: <+input>
* execution:
* steps:
* - step:
* name: Rollout Deployment
* identifier: rolloutDeployment
* type: K8sRollingDeploy
* timeout: 10m
* spec:
* skipDryRun: false
* pruningEnabled: false
* rollbackSteps:
* - step:
* name: Rollback Rollout Deployment
* identifier: rollbackRolloutDeployment
* type: K8sRollingRollback
* timeout: 10m
* spec:
* pruningEnabled: false
* tags: {}
* failureStrategies:
* - onFailure:
* errors:
* - AllErrors
* action:
* type: StageRollback
*
* EOT
* }
*
* ## Remote Pipeline template to create new branch from existing base branch
*
* resource "harness.platform.Template" "pipelineTemplateRemote" {
* identifier = "identifier"
* orgId = harness_platform_project.test.org_id
* projectId = harness_platform_project.test.id
* name = "name"
* comments = "comments"
* version = "ab"
* isStable = true
* gitDetails {
* branchName = "newBranch"
* commitMessage = "Commit"
* filePath = "filePath"
* connectorRef = "account.connector_ref"
* storeType = "REMOTE"
* repoName = "repoName"
* baseBranch = "main"
* }
* templateYaml = <<-EOT
* template:
* name: "name"
* identifier: "identifier"
* versionLabel: "ab"
* type: Pipeline
* projectIdentifier: ${harness_platform_project.test.id}
* orgIdentifier: ${harness_platform_project.test.org_id}
* tags: {}
* spec:
* stages:
* - stage:
* identifier: dvvdvd
* name: dvvdvd
* description: ""
* type: Deployment
* spec:
* deploymentType: Kubernetes
* service:
* serviceRef: <+input>
* serviceInputs: <+input>
* environment:
* environmentRef: <+input>
* deployToAll: false
* environmentInputs: <+input>
* serviceOverrideInputs: <+input>
* infrastructureDefinitions: <+input>
* execution:
* steps:
* - step:
* name: Rollout Deployment
* identifier: rolloutDeployment
* type: K8sRollingDeploy
* timeout: 10m
* spec:
* skipDryRun: false
* pruningEnabled: false
* rollbackSteps:
* - step:
* name: Rollback Rollout Deployment
* identifier: rollbackRolloutDeployment
* type: K8sRollingRollback
* timeout: 10m
* spec:
* pruningEnabled: false
* tags: {}
* failureStrategies:
* - onFailure:
* errors:
* - AllErrors
* action:
* type: StageRollback
*
* EOT
* }
*
* ## Inline Pipeline template
*
* resource "harness.platform.Template" "pipelineTemplateInline" {
* identifier = "identifier"
* orgId = harness_platform_project.test.org_id
* projectId = harness_platform_project.test.id
* name = "name"
* comments = "comments"
* version = "ab"
* isStable = true
* templateYaml = <<-EOT
* template:
* name: "name"
* identifier: "identifier"
* versionLabel: "ab"
* type: Pipeline
* projectIdentifier: ${harness_platform_project.test.id}
* orgIdentifier: ${harness_platform_project.test.org_id}
* tags: {}
* spec:
* stages:
* - stage:
* identifier: dvvdvd
* name: dvvdvd
* description: ""
* type: Deployment
* spec:
* deploymentType: Kubernetes
* service:
* serviceRef: <+input>
* serviceInputs: <+input>
* environment:
* environmentRef: <+input>
* deployToAll: false
* environmentInputs: <+input>
* serviceOverrideInputs: <+input>
* infrastructureDefinitions: <+input>
* execution:
* steps:
* - step:
* name: Rollout Deployment
* identifier: rolloutDeployment
* type: K8sRollingDeploy
* timeout: 10m
* spec:
* skipDryRun: false
* pruningEnabled: false
* rollbackSteps:
* - step:
* name: Rollback Rollout Deployment
* identifier: rollbackRolloutDeployment
* type: K8sRollingRollback
* timeout: 10m
* spec:
* pruningEnabled: false
* tags: {}
* failureStrategies:
* - onFailure:
* errors:
* - AllErrors
* action:
* type: StageRollback
*
* EOT
* }
*
* ## Inline Step template
*
* resource "harness.platform.Template" "stepTemplateInline" {
* identifier = "identifier"
* orgId = harness_platform_project.test.org_id
* projectId = harness_platform_project.test.id
* name = "name"
* comments = "comments"
* version = "ab"
* isStable = true
* templateYaml = <<-EOT
* template:
* name: "name"
* identifier: "identifier"
* versionLabel: "ab"
* type: Step
* projectIdentifier: ${harness_platform_project.test.id}
* orgIdentifier: ${harness_platform_project.test.org_id}
* tags: {}
* spec:
* timeout: 10m
* type: ShellScript
* spec:
* shell: Bash
* onDelegate: true
* source:
* type: Inline
* spec:
* script: <+input>
* environmentVariables: []
* outputVariables: []
*
* EOT
* }
*
* ## Remote Step template
*
* resource "harness.platform.Template" "stepTemplateRemote" {
* identifier = "identifier"
* orgId = harness_platform_project.test.org_id
* projectId = harness_platform_project.test.id
* name = "name"
* comments = "comments"
* version = "ab"
* isStable = true
* gitDetails {
* branchName = "main"
* commitMessage = "Commit"
* filePath = "filePath"
* connectorRef = "account.connector_ref"
* storeType = "REMOTE"
* repoName = "repoName"
* }
* templateYaml = <<-EOT
* template:
* name: "name"
* identifier: "identifier"
* versionLabel: "ab"
* type: Step
* projectIdentifier: ${harness_platform_project.test.id}
* orgIdentifier: ${harness_platform_project.test.org_id}
* tags: {}
* spec:
* timeout: 10m
* type: ShellScript
* spec:
* shell: Bash
* onDelegate: true
* source:
* type: Inline
* spec:
* script: <+input>
* environmentVariables: []
* outputVariables: []
*
* EOT
* }
*
* ## Remote Step template to create new branch from existing branch
*
* resource "harness.platform.Template" "stepTemplateRemote" {
* identifier = "identifier"
* orgId = harness_platform_project.test.org_id
* projectId = harness_platform_project.test.id
* name = "name"
* comments = "comments"
* version = "ab"
* isStable = true
* gitDetails {
* branchName = "newBranch"
* commitMessage = "Commit"
* filePath = "filePath"
* connectorRef = "account.connector_ref"
* storeType = "REMOTE"
* repoName = "repoName"
* baseBranch = "main"
* }
* templateYaml = <<-EOT
* template:
* name: "name"
* identifier: "identifier"
* versionLabel: "ab"
* type: Step
* projectIdentifier: ${harness_platform_project.test.id}
* orgIdentifier: ${harness_platform_project.test.org_id}
* tags: {}
* spec:
* timeout: 10m
* type: ShellScript
* spec:
* shell: Bash
* onDelegate: true
* source:
* type: Inline
* spec:
* script: <+input>
* environmentVariables: []
* outputVariables: []
*
* EOT
* }
*
* ## Inline Stage template
*
* resource "harness.platform.Template" "stageTemplateInline" {
* identifier = "identifier"
* orgId = harness_platform_project.test.org_id
* projectId = harness_platform_project.test.id
* name = "name"
* comments = "comments"
* version = "ab"
* isStable = true
* templateYaml = <<-EOT
* template:
* name: "name"
* identifier: "identifier"
* versionLabel: "ab"
* type: Stage
* projectIdentifier: ${harness_platform_project.test.id}
* orgIdentifier: ${harness_platform_project.test.org_id}
* tags: {}
* spec:
* type: Deployment
* spec:
* deploymentType: Kubernetes
* service:
* serviceRef: <+input>
* serviceInputs: <+input>
* environment:
* environmentRef: <+input>
* deployToAll: false
* environmentInputs: <+input>
* infrastructureDefinitions: <+input>
* execution:
* steps:
* - step:
* type: ShellScript
* name: Shell Script_1
* identifier: ShellScript_1
* spec:
* shell: Bash
* onDelegate: true
* source:
* type: Inline
* spec:
* script: <+input>
* environmentVariables: []
* outputVariables: []
* timeout: <+input>
* rollbackSteps: []
* failureStrategies:
* - onFailure:
* errors:
* - AllErrors
* action:
* type: StageRollback
*
* EOT
* }
*
* ## Remote Stage template
*
* resource "harness.platform.Template" "stageTemplateRemote" {
* identifier = "identifier"
* orgId = harness_platform_project.test.org_id
* projectId = harness_platform_project.test.id
* name = "name"
* comments = "comments"
* version = "ab"
* isStable = true
* gitDetails {
* branchName = "main"
* commitMessage = "Commit"
* filePath = "filePath"
* connectorRef = "account.connector_ref"
* storeType = "REMOTE"
* repoName = "repoName"
* }
* templateYaml = <<-EOT
* template:
* name: "name"
* identifier: "identifier"
* versionLabel: "ab"
* type: Stage
* projectIdentifier: ${harness_platform_project.test.id}
* orgIdentifier: ${harness_platform_project.test.org_id}
* tags: {}
* spec:
* type: Deployment
* spec:
* deploymentType: Kubernetes
* service:
* serviceRef: <+input>
* serviceInputs: <+input>
* environment:
* environmentRef: <+input>
* deployToAll: false
* environmentInputs: <+input>
* infrastructureDefinitions: <+input>
* execution:
* steps:
* - step:
* type: ShellScript
* name: Shell Script_1
* identifier: ShellScript_1
* spec:
* shell: Bash
* onDelegate: true
* source:
* type: Inline
* spec:
* script: <+input>
* environmentVariables: []
* outputVariables: []
* timeout: <+input>
* rollbackSteps: []
* failureStrategies:
* - onFailure:
* errors:
* - AllErrors
* action:
* type: StageRollback
*
* EOT
* }
*
* ## Remote Stage template to create new branch from existing branch
*
* resource "harness.platform.Template" "stageTemplateRemote" {
* identifier = "identifier"
* orgId = harness_platform_project.test.org_id
* projectId = harness_platform_project.test.id
* name = "name"
* comments = "comments"
* version = "ab"
* isStable = true
* gitDetails {
* branchName = "newBranch"
* commitMessage = "Commit"
* filePath = "filePath"
* connectorRef = "account.connector_ref"
* storeType = "REMOTE"
* repoName = "repoName"
* baseBranch = "main"
* }
* templateYaml = <<-EOT
* template:
* name: "name"
* identifier: "identifier"
* versionLabel: "ab"
* type: Stage
* projectIdentifier: ${harness_platform_project.test.id}
* orgIdentifier: ${harness_platform_project.test.org_id}
* tags: {}
* spec:
* type: Deployment
* spec:
* deploymentType: Kubernetes
* service:
* serviceRef: <+input>
* serviceInputs: <+input>
* environment:
* environmentRef: <+input>
* deployToAll: false
* environmentInputs: <+input>
* infrastructureDefinitions: <+input>
* execution:
* steps:
* - step:
* type: ShellScript
* name: Shell Script_1
* identifier: ShellScript_1
* spec:
* shell: Bash
* onDelegate: true
* source:
* type: Inline
* spec:
* script: <+input>
* environmentVariables: []
* outputVariables: []
* timeout: <+input>
* rollbackSteps: []
* failureStrategies:
* - onFailure:
* errors:
* - AllErrors
* action:
* type: StageRollback
*
* EOT
* }
*
* ## Inline StepGroup template
*
* resource "harness.platform.Template" "stepgroupTemplateInline" {
* identifier = "identifier"
* orgId = harness_platform_project.test.org_id
* projectId = harness_platform_project.test.id
* name = "name"
* comments = "comments"
* version = "ab"
* isStable = true
* templateYaml = <<-EOT
* template:
* name: "name"
* identifier: "identifier"
* versionLabel: "ab"
* type: StepGroup
* projectIdentifier: ${harness_platform_project.test.id}
* orgIdentifier: ${harness_platform_project.test.org_id}
* tags: {}
* spec:
* stageType: Deployment
* steps:
* - step:
* type: ShellScript
* name: Shell Script_1
* identifier: ShellScript_1
* spec:
* shell: Bash
* onDelegate: true
* source:
* type: Inline
* spec:
* script: <+input>
* environmentVariables: []
* outputVariables: []
* timeout: 10m
*
* EOT
* }
*
* ## Remote StepGroup template
*
* resource "harness.platform.Template" "stepgroupTemplateRemote" {
* identifier = "identifier"
* orgId = harness_platform_project.test.org_id
* projectId = harness_platform_project.test.id
* name = "name"
* comments = "comments"
* version = "ab"
* isStable = true
* gitDetails {
* branchName = "main"
* commitMessage = "Commit"
* filePath = "filePath"
* connectorRef = "account.connector_ref"
* storeType = "REMOTE"
* repoName = "repoName"
* }
* templateYaml = <<-EOT
* template:
* name: "name"
* identifier: "identifier"
* versionLabel: "ab"
* type: StepGroup
* projectIdentifier: ${harness_platform_project.test.id}
* orgIdentifier: ${harness_platform_project.test.org_id}
* tags: {}
* spec:
* stageType: Deployment
* steps:
* - step:
* type: ShellScript
* name: Shell Script_1
* identifier: ShellScript_1
* spec:
* shell: Bash
* onDelegate: true
* source:
* type: Inline
* spec:
* script: <+input>
* environmentVariables: []
* outputVariables: []
* timeout: 10m
*
* EOT
* }
*
* ## Remote StepGroup template to create new branch from existing branch
*
* resource "harness.platform.Template" "stepgroupTemplateRemote" {
* identifier = "identifier"
* orgId = harness_platform_project.test.org_id
* projectId = harness_platform_project.test.id
* name = "name"
* comments = "comments"
* version = "ab"
* isStable = true
* gitDetails {
* branchName = "newBranch"
* commitMessage = "Commit"
* filePath = "filePath"
* connectorRef = "account.connector_ref"
* storeType = "REMOTE"
* repoName = "repoName"
* baseBranch = "main"
* }
* templateYaml = <<-EOT
* template:
* name: "name"
* identifier: "identifier"
* versionLabel: "ab"
* type: StepGroup
* projectIdentifier: ${harness_platform_project.test.id}
* orgIdentifier: ${harness_platform_project.test.org_id}
* tags: {}
* spec:
* stageType: Deployment
* steps:
* - step:
* type: ShellScript
* name: Shell Script_1
* identifier: ShellScript_1
* spec:
* shell: Bash
* onDelegate: true
* source:
* type: Inline
* spec:
* script: <+input>
* environmentVariables: []
* outputVariables: []
* timeout: 10m
*
* EOT
* }
*
* ## Inline Monitered Service template
*
* resource "harness.platform.Template" "moniteredServiceTemplateInline" {
* identifier = "identifier"
* orgId = harness_platform_project.test.org_id
* projectId = harness_platform_project.test.id
* name = "name"
* comments = "comments"
* version = "ab"
* isStable = true
* templateYaml = <<-EOT
* template:
* name: "name"
* identifier: "identifier"
* versionLabel: "ab"
* type: MonitoredService
* projectIdentifier: ${harness_platform_project.test.id}
* orgIdentifier: ${harness_platform_project.test.org_id}
* tags: {}
* spec:
* serviceRef: <+input>
* environmentRef: <+input>
* type: Application
* sources:
* changeSources:
* - name: Harness CD Next Gen
* identifier: harnessCdNextGen
* type: HarnessCDNextGen
* enabled: true
* category: Deployment
* spec: {}
* healthSources:
* - name: health
* identifier: health
* type: AppDynamics
* spec:
* applicationName: <+input>
* tierName: <+input>
* metricData:
* Errors: true
* Performance: true
* metricDefinitions: []
* feature: Application Monitoring
* connectorRef: <+input>
* metricPacks:
* - identifier: Errors
* - identifier: Performance
*
* EOT
* }
*
* ## Artifact Source template
*
* resource "harness.platform.Template" "artifactSourceTemplate" {
* identifier = "identifier"
* orgId = harness_platform_project.test.org_id
* projectId = harness_platform_project.test.id
* name = "name"
* comments = "comments"
* version = "ab"
* isStable = true
* templateYaml = <<-EOT
* template:
* name: "name"
* identifier: "identifier"
* versionLabel: "ab"
* type: ArtifactSource
* projectIdentifier: ${harness_platform_project.test.id}
* orgIdentifier: ${harness_platform_project.test.org_id}
* tags: {}
* spec:
* type: DockerRegistry
* spec:
* imagePath: library/nginx
* tag: <+input>
* connectorRef: account.Harness_DockerHub
*
* EOT
* }
*
* ## Deployment template
*
* resource "harness.platform.Template" "deploymentTemplate" {
* identifier = "identifier"
* orgId = harness_platform_project.test.org_id
* projectId = harness_platform_project.test.id
* name = "name"
* comments = "comments"
* version = "ab"
* isStable = true
* templateYaml = <<-EOT
* template:
* name: "name"
* identifier: "identifier"
* versionLabel: "ab"
* type: CustomDeployment
* projectIdentifier: ${harness_platform_project.test.id}
* orgIdentifier: ${harness_platform_project.test.org_id}
* tags: {}
* spec:
* infrastructure:
* variables:
* - name: kubeConnector
* type: Connector
* value: <+input>
* description: ""
* fetchInstancesScript:
* store:
* type: Inline
* spec:
* content: |
* #
* # Script is expected to query Infrastructure and dump json
* # in $INSTANCE_OUTPUT_PATH file path
* #
* # Harness is expected to initialize ${INSTANCE_OUTPUT_PATH}
* # environment variable - a random unique file path on delegate,
* # so script execution can save the result.
* #
* /opt/harness-delegate/client-tools/kubectl/v1.19.2/kubectl get pods --namespace=harness-delegate-ng -o json > $INSTANCE_OUTPUT_PATH
* instanceAttributes:
* - name: instancename
* jsonPath: metadata.name
* description: ""
* instancesListPath: items
* execution:
* stepTemplateRefs: []
*
* EOT
* }
*
* ## Import
*
* Import account level template
*
* ```sh
* $ pulumi import harness:platform/template:Template example <template_id>
* ```
*
* Import org level template
*
* ```sh
* $ pulumi import harness:platform/template:Template example <ord_id>/<template_id>
* ```
*
* Import project level template
*
* ```sh
* $ pulumi import harness:platform/template:Template example <org_id>/<project_id>/<template_id>
* ```
*/
class Template extends pulumi.CustomResource {
/**
* Get an existing Template resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new Template(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Template. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Template.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["comments"] = state ? state.comments : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["forceDelete"] = state ? state.forceDelete : undefined;
resourceInputs["gitDetails"] = state ? state.gitDetails : undefined;
resourceInputs["identifier"] = state ? state.identifier : undefined;
resourceInputs["isStable"] = state ? state.isStable : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["orgId"] = state ? state.orgId : undefined;
resourceInputs["projectId"] = state ? state.projectId : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["templateYaml"] = state ? state.templateYaml : undefined;
resourceInputs["version"] = state ? state.version : undefined;
}
else {
const args = argsOrState;
if ((!args || args.identifier === undefined) && !opts.urn) {
throw new Error("Missing required property 'identifier'");
}
if ((!args || args.templateYaml === undefined) && !opts.urn) {
throw new Error("Missing required property 'templateYaml'");
}
if ((!args || args.version === undefined) && !opts.urn) {
throw new Error("Missing required property 'version'");
}
resourceInputs["comments"] = args ? args.comments : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["forceDelete"] = args ? args.forceDelete : undefined;
resourceInputs["gitDetails"] = args ? args.gitDetails : undefined;
resourceInputs["identifier"] = args ? args.identifier : undefined;
resourceInputs["isStable"] = args ? args.isStable : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["orgId"] = args ? args.orgId : undefined;
resourceInputs["projectId"] = args ? args.projectId : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["templateYaml"] = args ? args.templateYaml : undefined;
resourceInputs["version"] = args ? args.version : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Template.__pulumiType, name, resourceInputs, opts);
}
}
exports.Template = Template;
/** @internal */
Template.__pulumiType = 'harness:platform/template:Template';
//# sourceMappingURL=template.js.map