UNPKG

@spacelift-io/pulumi-spacelift

Version:

A Pulumi package for creating and managing Spacelift resources.

284 lines 15.5 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.Stack = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * `spacelift.Stack` combines source code and configuration to create a runtime environment where resources are managed. In this way it's similar to a stack in AWS CloudFormation, or a project on generic CI/CD platforms. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as spacelift from "@spacelift-io/pulumi-spacelift"; * * // Terraform stack using Bitbucket Cloud as VCS * const k8s_cluster_bitbucket_cloud = new spacelift.Stack("k8s-cluster-bitbucket-cloud", { * administrative: true, * autodeploy: true, * bitbucketCloud: { * namespace: "SPACELIFT", * }, * branch: "master", * description: "Provisions a Kubernetes cluster", * projectRoot: "cluster", * repository: "core-infra", * terraformVersion: "1.3.0", * }); * // Terraform stack using Bitbucket Data Center as VCS * const k8s_cluster_bitbucket_datacenter = new spacelift.Stack("k8s-cluster-bitbucket-datacenter", { * administrative: true, * autodeploy: true, * bitbucketDatacenter: { * namespace: "SPACELIFT", * }, * branch: "master", * description: "Provisions a Kubernetes cluster", * projectRoot: "cluster", * repository: "core-infra", * terraformVersion: "1.3.0", * }); * // Terraform stack using a GitHub Custom Application. See the following page for more info: https://docs.spacelift.io/integrations/source-control/github#setting-up-the-custom-application * const k8s_cluster_github_enterprise = new spacelift.Stack("k8s-cluster-github-enterprise", { * administrative: true, * autodeploy: true, * branch: "master", * description: "Provisions a Kubernetes cluster", * githubEnterprise: { * namespace: "spacelift", * }, * projectRoot: "cluster", * repository: "core-infra", * terraformVersion: "1.3.0", * }); * // Terraform stack using GitLab as VCS * const k8s_cluster_gitlab = new spacelift.Stack("k8s-cluster-gitlab", { * administrative: true, * autodeploy: true, * branch: "master", * description: "Provisions a Kubernetes cluster", * gitlab: { * namespace: "spacelift", * }, * projectRoot: "cluster", * repository: "core-infra", * terraformVersion: "1.3.0", * }); * // Terraform stack using github.com as VCS and enabling external state access * const k8s_cluster = new spacelift.Stack("k8s-cluster", { * administrative: true, * autodeploy: true, * branch: "master", * description: "Provisions a Kubernetes cluster", * projectRoot: "cluster", * repository: "core-infra", * terraformExternalStateAccess: true, * terraformVersion: "1.3.0", * }); * // CloudFormation stack using github.com as VCS * const k8s_cluster_cloudformation = new spacelift.Stack("k8s-cluster-cloudformation", { * autodeploy: true, * branch: "master", * cloudformation: { * entryTemplateFile: "main.yaml", * region: "eu-central-1", * stackName: "k8s-cluster", * templateBucket: "s3://bucket", * }, * description: "Provisions a Kubernetes cluster", * projectRoot: "cluster", * repository: "core-infra", * }); * // Pulumi stack using github.com as VCS * const k8s_cluster_pulumi = new spacelift.Stack("k8s-cluster-pulumi", { * autodeploy: true, * branch: "master", * description: "Provisions a Kubernetes cluster", * projectRoot: "cluster", * pulumi: { * loginUrl: "s3://pulumi-state-bucket", * stackName: "kubernetes-core-services", * }, * repository: "core-infra", * runnerImage: "public.ecr.aws/t0p9w2l5/runner-pulumi-javascript:latest", * }); * // Kubernetes stack using github.com as VCS * const k8s_core_kubernetes = new spacelift.Stack("k8s-core-kubernetes", { * autodeploy: true, * beforeInits: ["aws eks update-kubeconfig --region us-east-2 --name k8s-cluster"], * branch: "master", * description: "Shared cluster services (Datadog, Istio etc.)", * kubernetes: { * kubectlVersion: "1.26.1", * namespace: "core", * }, * projectRoot: "core-services", * repository: "core-infra", * }); * // Ansible stack using github.com as VCS * const ansible_stack = new spacelift.Stack("ansible-stack", { * ansible: { * playbook: "main.yml", * }, * autodeploy: true, * branch: "master", * description: "Provisioning EC2 machines", * repository: "ansible-playbooks", * runnerImage: "public.ecr.aws/spacelift/runner-ansible:latest", * }); * ``` * * ## Import * * ```sh * $ pulumi import spacelift:index/stack:Stack k8s_core $STACK_ID * ``` */ class Stack extends pulumi.CustomResource { /** * Get an existing Stack 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 Stack(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Stack. 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'] === Stack.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["additionalProjectGlobs"] = state ? state.additionalProjectGlobs : undefined; resourceInputs["administrative"] = state ? state.administrative : undefined; resourceInputs["afterApplies"] = state ? state.afterApplies : undefined; resourceInputs["afterDestroys"] = state ? state.afterDestroys : undefined; resourceInputs["afterInits"] = state ? state.afterInits : undefined; resourceInputs["afterPerforms"] = state ? state.afterPerforms : undefined; resourceInputs["afterPlans"] = state ? state.afterPlans : undefined; resourceInputs["afterRuns"] = state ? state.afterRuns : undefined; resourceInputs["ansible"] = state ? state.ansible : undefined; resourceInputs["autodeploy"] = state ? state.autodeploy : undefined; resourceInputs["autoretry"] = state ? state.autoretry : undefined; resourceInputs["awsAssumeRolePolicyStatement"] = state ? state.awsAssumeRolePolicyStatement : undefined; resourceInputs["azureDevops"] = state ? state.azureDevops : undefined; resourceInputs["beforeApplies"] = state ? state.beforeApplies : undefined; resourceInputs["beforeDestroys"] = state ? state.beforeDestroys : undefined; resourceInputs["beforeInits"] = state ? state.beforeInits : undefined; resourceInputs["beforePerforms"] = state ? state.beforePerforms : undefined; resourceInputs["beforePlans"] = state ? state.beforePlans : undefined; resourceInputs["bitbucketCloud"] = state ? state.bitbucketCloud : undefined; resourceInputs["bitbucketDatacenter"] = state ? state.bitbucketDatacenter : undefined; resourceInputs["branch"] = state ? state.branch : undefined; resourceInputs["cloudformation"] = state ? state.cloudformation : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["enableLocalPreview"] = state ? state.enableLocalPreview : undefined; resourceInputs["githubActionDeploy"] = state ? state.githubActionDeploy : undefined; resourceInputs["githubEnterprise"] = state ? state.githubEnterprise : undefined; resourceInputs["gitlab"] = state ? state.gitlab : undefined; resourceInputs["importState"] = state ? state.importState : undefined; resourceInputs["importStateFile"] = state ? state.importStateFile : undefined; resourceInputs["kubernetes"] = state ? state.kubernetes : undefined; resourceInputs["labels"] = state ? state.labels : undefined; resourceInputs["manageState"] = state ? state.manageState : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["projectRoot"] = state ? state.projectRoot : undefined; resourceInputs["protectFromDeletion"] = state ? state.protectFromDeletion : undefined; resourceInputs["pulumi"] = state ? state.pulumi : undefined; resourceInputs["rawGit"] = state ? state.rawGit : undefined; resourceInputs["repository"] = state ? state.repository : undefined; resourceInputs["runnerImage"] = state ? state.runnerImage : undefined; resourceInputs["showcase"] = state ? state.showcase : undefined; resourceInputs["slug"] = state ? state.slug : undefined; resourceInputs["spaceId"] = state ? state.spaceId : undefined; resourceInputs["terraformExternalStateAccess"] = state ? state.terraformExternalStateAccess : undefined; resourceInputs["terraformSmartSanitization"] = state ? state.terraformSmartSanitization : undefined; resourceInputs["terraformVersion"] = state ? state.terraformVersion : undefined; resourceInputs["terraformWorkflowTool"] = state ? state.terraformWorkflowTool : undefined; resourceInputs["terraformWorkspace"] = state ? state.terraformWorkspace : undefined; resourceInputs["terragrunt"] = state ? state.terragrunt : undefined; resourceInputs["workerPoolId"] = state ? state.workerPoolId : undefined; } else { const args = argsOrState; if ((!args || args.branch === undefined) && !opts.urn) { throw new Error("Missing required property 'branch'"); } if ((!args || args.repository === undefined) && !opts.urn) { throw new Error("Missing required property 'repository'"); } resourceInputs["additionalProjectGlobs"] = args ? args.additionalProjectGlobs : undefined; resourceInputs["administrative"] = args ? args.administrative : undefined; resourceInputs["afterApplies"] = args ? args.afterApplies : undefined; resourceInputs["afterDestroys"] = args ? args.afterDestroys : undefined; resourceInputs["afterInits"] = args ? args.afterInits : undefined; resourceInputs["afterPerforms"] = args ? args.afterPerforms : undefined; resourceInputs["afterPlans"] = args ? args.afterPlans : undefined; resourceInputs["afterRuns"] = args ? args.afterRuns : undefined; resourceInputs["ansible"] = args ? args.ansible : undefined; resourceInputs["autodeploy"] = args ? args.autodeploy : undefined; resourceInputs["autoretry"] = args ? args.autoretry : undefined; resourceInputs["azureDevops"] = args ? args.azureDevops : undefined; resourceInputs["beforeApplies"] = args ? args.beforeApplies : undefined; resourceInputs["beforeDestroys"] = args ? args.beforeDestroys : undefined; resourceInputs["beforeInits"] = args ? args.beforeInits : undefined; resourceInputs["beforePerforms"] = args ? args.beforePerforms : undefined; resourceInputs["beforePlans"] = args ? args.beforePlans : undefined; resourceInputs["bitbucketCloud"] = args ? args.bitbucketCloud : undefined; resourceInputs["bitbucketDatacenter"] = args ? args.bitbucketDatacenter : undefined; resourceInputs["branch"] = args ? args.branch : undefined; resourceInputs["cloudformation"] = args ? args.cloudformation : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["enableLocalPreview"] = args ? args.enableLocalPreview : undefined; resourceInputs["githubActionDeploy"] = args ? args.githubActionDeploy : undefined; resourceInputs["githubEnterprise"] = args ? args.githubEnterprise : undefined; resourceInputs["gitlab"] = args ? args.gitlab : undefined; resourceInputs["importState"] = (args === null || args === void 0 ? void 0 : args.importState) ? pulumi.secret(args.importState) : undefined; resourceInputs["importStateFile"] = args ? args.importStateFile : undefined; resourceInputs["kubernetes"] = args ? args.kubernetes : undefined; resourceInputs["labels"] = args ? args.labels : undefined; resourceInputs["manageState"] = args ? args.manageState : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["projectRoot"] = args ? args.projectRoot : undefined; resourceInputs["protectFromDeletion"] = args ? args.protectFromDeletion : undefined; resourceInputs["pulumi"] = args ? args.pulumi : undefined; resourceInputs["rawGit"] = args ? args.rawGit : undefined; resourceInputs["repository"] = args ? args.repository : undefined; resourceInputs["runnerImage"] = args ? args.runnerImage : undefined; resourceInputs["showcase"] = args ? args.showcase : undefined; resourceInputs["slug"] = args ? args.slug : undefined; resourceInputs["spaceId"] = args ? args.spaceId : undefined; resourceInputs["terraformExternalStateAccess"] = args ? args.terraformExternalStateAccess : undefined; resourceInputs["terraformSmartSanitization"] = args ? args.terraformSmartSanitization : undefined; resourceInputs["terraformVersion"] = args ? args.terraformVersion : undefined; resourceInputs["terraformWorkflowTool"] = args ? args.terraformWorkflowTool : undefined; resourceInputs["terraformWorkspace"] = args ? args.terraformWorkspace : undefined; resourceInputs["terragrunt"] = args ? args.terragrunt : undefined; resourceInputs["workerPoolId"] = args ? args.workerPoolId : undefined; resourceInputs["awsAssumeRolePolicyStatement"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["importState"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(Stack.__pulumiType, name, resourceInputs, opts); } } exports.Stack = Stack; /** @internal */ Stack.__pulumiType = 'spacelift:index/stack:Stack'; //# sourceMappingURL=stack.js.map