UNPKG

@spacelift-io/pulumi-spacelift

Version:

A Pulumi package for creating and managing Spacelift resources.

113 lines 5.35 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.Mountedfile = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * `spacelift.Mountedfile` represents a file mounted in each Run's workspace that is part of a configuration of a context (`spacelift.Context`), stack (`spacelift.Stack`) or a module (`spacelift.Module`). In principle, it's very similar to an environment variable (`spacelift.EnvironmentVariable`) except that the value is written to the filesystem rather than passed to the environment. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as fs from "fs"; * import * as spacelift from "@spacelift-io/pulumi-spacelift"; * * // For a context * const ireland_kubeconfig = new spacelift.Mountedfile("ireland-kubeconfig", { * contextId: "prod-k8s-ie", * relativePath: "kubeconfig", * content: Buffer.from(fs.readFileSync(`${path.module}/kubeconfig.json`), 'binary').toString('base64'), * }); * // For a module * const module_kubeconfig = new spacelift.Mountedfile("module-kubeconfig", { * moduleId: "k8s-module", * relativePath: "kubeconfig", * content: Buffer.from(fs.readFileSync(`${path.module}/kubeconfig.json`), 'binary').toString('base64'), * }); * // For a stack * const core_kubeconfig = new spacelift.Mountedfile("core-kubeconfig", { * stackId: "k8s-core", * relativePath: "kubeconfig", * content: Buffer.from(fs.readFileSync(`${path.module}/kubeconfig.json`), 'binary').toString('base64'), * }); * ``` * * ## Import * * ```sh * $ pulumi import spacelift:index/mountedfile:Mountedfile ireland-kubeconfig context/$CONTEXT_ID/$MOUNTED_FILE_ID * ``` * * ```sh * $ pulumi import spacelift:index/mountedfile:Mountedfile module-kubeconfig module/$MODULE_ID/$MOUNTED_FILE_ID * ``` * * ```sh * $ pulumi import spacelift:index/mountedfile:Mountedfile core-kubeconfig stack/$STACK_ID/$MOUNTED_FILE_ID * ``` */ class Mountedfile extends pulumi.CustomResource { /** * Get an existing Mountedfile 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 Mountedfile(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Mountedfile. 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'] === Mountedfile.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["checksum"] = state ? state.checksum : undefined; resourceInputs["content"] = state ? state.content : undefined; resourceInputs["contextId"] = state ? state.contextId : undefined; resourceInputs["moduleId"] = state ? state.moduleId : undefined; resourceInputs["relativePath"] = state ? state.relativePath : undefined; resourceInputs["stackId"] = state ? state.stackId : undefined; resourceInputs["writeOnly"] = state ? state.writeOnly : undefined; } else { const args = argsOrState; if ((!args || args.content === undefined) && !opts.urn) { throw new Error("Missing required property 'content'"); } if ((!args || args.relativePath === undefined) && !opts.urn) { throw new Error("Missing required property 'relativePath'"); } resourceInputs["content"] = (args === null || args === void 0 ? void 0 : args.content) ? pulumi.secret(args.content) : undefined; resourceInputs["contextId"] = args ? args.contextId : undefined; resourceInputs["moduleId"] = args ? args.moduleId : undefined; resourceInputs["relativePath"] = args ? args.relativePath : undefined; resourceInputs["stackId"] = args ? args.stackId : undefined; resourceInputs["writeOnly"] = args ? args.writeOnly : undefined; resourceInputs["checksum"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["content"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(Mountedfile.__pulumiType, name, resourceInputs, opts); } } exports.Mountedfile = Mountedfile; /** @internal */ Mountedfile.__pulumiType = 'spacelift:index/mountedfile:Mountedfile'; //# sourceMappingURL=mountedfile.js.map