@spacelift-io/pulumi-spacelift
Version:
A Pulumi package for creating and managing Spacelift resources.
90 lines • 4.19 kB
JavaScript
;
// *** 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.StackDependencyReference = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* `spacelift.StackDependencyReference` represents a Spacelift **stack dependency reference** - a reference matches a stack's output to another stack's input. It is similar to an environment variable (`spacelift.EnvironmentVariable`), except that value is provided by another stack's output.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as spacelift from "@spacelift-io/pulumi-spacelift";
*
* const infra = new spacelift.Stack("infra", {
* branch: "master",
* repository: "core-infra",
* });
* const app = new spacelift.Stack("app", {
* branch: "master",
* repository: "app",
* });
* const testStackDependency = new spacelift.StackDependency("testStackDependency", {
* stackId: app.id,
* dependsOnStackId: infra.id,
* });
* const testStackDependencyReference = new spacelift.StackDependencyReference("testStackDependencyReference", {
* stackDependencyId: testStackDependency.id,
* outputName: "DB_CONNECTION_STRING",
* inputName: "APP_DB_URL",
* });
* ```
*/
class StackDependencyReference extends pulumi.CustomResource {
/**
* Get an existing StackDependencyReference 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 StackDependencyReference(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of StackDependencyReference. 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'] === StackDependencyReference.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["inputName"] = state ? state.inputName : undefined;
resourceInputs["outputName"] = state ? state.outputName : undefined;
resourceInputs["stackDependencyId"] = state ? state.stackDependencyId : undefined;
}
else {
const args = argsOrState;
if ((!args || args.inputName === undefined) && !opts.urn) {
throw new Error("Missing required property 'inputName'");
}
if ((!args || args.outputName === undefined) && !opts.urn) {
throw new Error("Missing required property 'outputName'");
}
if ((!args || args.stackDependencyId === undefined) && !opts.urn) {
throw new Error("Missing required property 'stackDependencyId'");
}
resourceInputs["inputName"] = args ? args.inputName : undefined;
resourceInputs["outputName"] = args ? args.outputName : undefined;
resourceInputs["stackDependencyId"] = args ? args.stackDependencyId : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(StackDependencyReference.__pulumiType, name, resourceInputs, opts);
}
}
exports.StackDependencyReference = StackDependencyReference;
/** @internal */
StackDependencyReference.__pulumiType = 'spacelift:index/stackDependencyReference:StackDependencyReference';
//# sourceMappingURL=stackDependencyReference.js.map