UNPKG

@lbrlabs/pulumi-harness

Version:

A Pulumi package for creating and managing Harness resources.

178 lines 8.77 kB
"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.InfrastructureDefinition = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Resource for creating am infrastructure definition. This resource uses the config-as-code API's. When updating the `name` or `path` of this resource you should typically also set the `createBeforeDestroy = true` lifecycle setting. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as harness from "@lbrlabs/pulumi-harness"; * * // Creating a Kubernetes infrastructure definition * const devKubernetes = new harness.cloudprovider.Kubernetes("devKubernetes", {authentication: { * delegateSelectors: ["k8s"], * }}); * const example = new harness.Application("example", {}); * const devEnvironment = new harness.Environment("devEnvironment", { * appId: example.id, * type: "NON_PROD", * }); * // Creating a infrastructure of type KUBERNETES * const k8s = new harness.InfrastructureDefinition("k8s", { * appId: example.id, * envId: devEnvironment.id, * cloudProviderType: "KUBERNETES_CLUSTER", * deploymentType: "KUBERNETES", * kubernetes: { * cloudProviderName: devKubernetes.name, * namespace: "dev", * releaseName: "${service.name}", * }, * }); * // Creating a Deployment Template for CUSTOM infrastructure type * const exampleYaml = new harness.YamlConfig("exampleYaml", { * path: "Setup/Template Library/Example Folder/deployment_template.yaml", * content: `harnessApiVersion: '1.0' * type: CUSTOM_DEPLOYMENT_TYPE * fetchInstanceScript: |- * set -ex * curl http://${url}/${file_name} > ${INSTANCE_OUTPUT_PATH} * hostAttributes: * hostname: host * hostObjectArrayPath: hosts * variables: * - name: url * - name: file_name * `, * }); * // Creating a infrastructure of type CUSTOM * const custom = new harness.InfrastructureDefinition("custom", { * appId: example.id, * envId: devEnvironment.id, * cloudProviderType: "CUSTOM", * deploymentType: "CUSTOM", * deploymentTemplateUri: pulumi.interpolate`Example Folder/${exampleYaml.name}`, * custom: { * deploymentTypeTemplateVersion: "1", * variables: [ * { * name: "url", * value: "localhost:8081", * }, * { * name: "file_name", * value: "instances.json", * }, * ], * }, * }); * ``` * * ## Import * * Import using the Harness application id, environment id, and infrastructure definition id * * ```sh * $ pulumi import harness:index/infrastructureDefinition:InfrastructureDefinition example <app_id>/<env_id>/<infradef_id> * ``` */ class InfrastructureDefinition extends pulumi.CustomResource { /** * Get an existing InfrastructureDefinition 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 InfrastructureDefinition(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of InfrastructureDefinition. 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'] === InfrastructureDefinition.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["appId"] = state ? state.appId : undefined; resourceInputs["awsAmi"] = state ? state.awsAmi : undefined; resourceInputs["awsEcs"] = state ? state.awsEcs : undefined; resourceInputs["awsLambda"] = state ? state.awsLambda : undefined; resourceInputs["awsSsh"] = state ? state.awsSsh : undefined; resourceInputs["awsWinrm"] = state ? state.awsWinrm : undefined; resourceInputs["azureVmss"] = state ? state.azureVmss : undefined; resourceInputs["azureWebapp"] = state ? state.azureWebapp : undefined; resourceInputs["cloudProviderType"] = state ? state.cloudProviderType : undefined; resourceInputs["custom"] = state ? state.custom : undefined; resourceInputs["datacenterSsh"] = state ? state.datacenterSsh : undefined; resourceInputs["datacenterWinrm"] = state ? state.datacenterWinrm : undefined; resourceInputs["deploymentTemplateUri"] = state ? state.deploymentTemplateUri : undefined; resourceInputs["deploymentType"] = state ? state.deploymentType : undefined; resourceInputs["envId"] = state ? state.envId : undefined; resourceInputs["kubernetes"] = state ? state.kubernetes : undefined; resourceInputs["kubernetesGcp"] = state ? state.kubernetesGcp : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["provisionerName"] = state ? state.provisionerName : undefined; resourceInputs["scopedServices"] = state ? state.scopedServices : undefined; resourceInputs["tanzu"] = state ? state.tanzu : undefined; } else { const args = argsOrState; if ((!args || args.appId === undefined) && !opts.urn) { throw new Error("Missing required property 'appId'"); } if ((!args || args.cloudProviderType === undefined) && !opts.urn) { throw new Error("Missing required property 'cloudProviderType'"); } if ((!args || args.deploymentType === undefined) && !opts.urn) { throw new Error("Missing required property 'deploymentType'"); } if ((!args || args.envId === undefined) && !opts.urn) { throw new Error("Missing required property 'envId'"); } resourceInputs["appId"] = args ? args.appId : undefined; resourceInputs["awsAmi"] = args ? args.awsAmi : undefined; resourceInputs["awsEcs"] = args ? args.awsEcs : undefined; resourceInputs["awsLambda"] = args ? args.awsLambda : undefined; resourceInputs["awsSsh"] = args ? args.awsSsh : undefined; resourceInputs["awsWinrm"] = args ? args.awsWinrm : undefined; resourceInputs["azureVmss"] = args ? args.azureVmss : undefined; resourceInputs["azureWebapp"] = args ? args.azureWebapp : undefined; resourceInputs["cloudProviderType"] = args ? args.cloudProviderType : undefined; resourceInputs["custom"] = args ? args.custom : undefined; resourceInputs["datacenterSsh"] = args ? args.datacenterSsh : undefined; resourceInputs["datacenterWinrm"] = args ? args.datacenterWinrm : undefined; resourceInputs["deploymentTemplateUri"] = args ? args.deploymentTemplateUri : undefined; resourceInputs["deploymentType"] = args ? args.deploymentType : undefined; resourceInputs["envId"] = args ? args.envId : undefined; resourceInputs["kubernetes"] = args ? args.kubernetes : undefined; resourceInputs["kubernetesGcp"] = args ? args.kubernetesGcp : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["provisionerName"] = args ? args.provisionerName : undefined; resourceInputs["scopedServices"] = args ? args.scopedServices : undefined; resourceInputs["tanzu"] = args ? args.tanzu : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(InfrastructureDefinition.__pulumiType, name, resourceInputs, opts); } } exports.InfrastructureDefinition = InfrastructureDefinition; /** @internal */ InfrastructureDefinition.__pulumiType = 'harness:index/infrastructureDefinition:InfrastructureDefinition'; //# sourceMappingURL=infrastructureDefinition.js.map