UNPKG

@spacelift-io/pulumi-spacelift

Version:

A Pulumi package for creating and managing Spacelift resources.

106 lines 4.82 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.EnvironmentVariable = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * `spacelift.EnvironmentVariable` defines an environment variable on the context (`spacelift.Context`), stack (`spacelift.Stack`) or a module (`spacelift.Module`), thereby allowing to pass and share various secrets and configuration with Spacelift stacks. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as spacelift from "@spacelift-io/pulumi-spacelift"; * * // For a context * const ireland_kubeconfig = new spacelift.EnvironmentVariable("ireland-kubeconfig", { * contextId: "prod-k8s-ie", * value: "/project/spacelift/kubeconfig", * writeOnly: false, * }); * // For a module * const module_kubeconfig = new spacelift.EnvironmentVariable("module-kubeconfig", { * moduleId: "k8s-module", * value: "/project/spacelift/kubeconfig", * writeOnly: false, * }); * // For a stack * const core_kubeconfig = new spacelift.EnvironmentVariable("core-kubeconfig", { * stackId: "k8s-core", * value: "/project/spacelift/kubeconfig", * writeOnly: false, * }); * ``` * * ## Import * * ```sh * $ pulumi import spacelift:index/environmentVariable:EnvironmentVariable ireland-kubeconfig context/$CONTEXT_ID/$ENVIRONMENT_VARIABLE_NAME * ``` * * ```sh * $ pulumi import spacelift:index/environmentVariable:EnvironmentVariable module-kubeconfig module/$MODULE_ID/$ENVIRONMENT_VARIABLE_NAME * ``` * * ```sh * $ pulumi import spacelift:index/environmentVariable:EnvironmentVariable core-kubeconfig stack/$STACK_ID/$ENVIRONMENT_VARIABLE_NAME * ``` */ class EnvironmentVariable extends pulumi.CustomResource { /** * Get an existing EnvironmentVariable 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 EnvironmentVariable(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of EnvironmentVariable. 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'] === EnvironmentVariable.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["checksum"] = state ? state.checksum : undefined; resourceInputs["contextId"] = state ? state.contextId : undefined; resourceInputs["moduleId"] = state ? state.moduleId : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["stackId"] = state ? state.stackId : undefined; resourceInputs["value"] = state ? state.value : undefined; resourceInputs["writeOnly"] = state ? state.writeOnly : undefined; } else { const args = argsOrState; resourceInputs["contextId"] = args ? args.contextId : undefined; resourceInputs["moduleId"] = args ? args.moduleId : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["stackId"] = args ? args.stackId : undefined; resourceInputs["value"] = (args === null || args === void 0 ? void 0 : args.value) ? pulumi.secret(args.value) : undefined; resourceInputs["writeOnly"] = args ? args.writeOnly : undefined; resourceInputs["checksum"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["value"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(EnvironmentVariable.__pulumiType, name, resourceInputs, opts); } } exports.EnvironmentVariable = EnvironmentVariable; /** @internal */ EnvironmentVariable.__pulumiType = 'spacelift:index/environmentVariable:EnvironmentVariable'; //# sourceMappingURL=environmentVariable.js.map