@spacelift-io/pulumi-spacelift
Version:
A Pulumi package for creating and managing Spacelift resources.
94 lines • 4.21 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.DriftDetection = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* `spacelift.DriftDetection` represents a Drift Detection configuration for a Stack. It will trigger a proposed run on the given schedule, which you can listen for using run state webhooks. If reconcile is true, then a tracked run will be triggered when drift is detected.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as spacelift from "@spacelift-io/pulumi-spacelift";
*
* const core_infra_production = new spacelift.Stack("core-infra-production", {
* branch: "master",
* repository: "core-infra",
* });
* const core_infra_production_drift_detection = new spacelift.DriftDetection("core-infra-production-drift-detection", {
* reconcile: true,
* stackId: core_infra_production.id,
* schedules: ["*/15 * * * *"],
* });
* // Every 15 minutes
* ```
*
* ## Import
*
* ```sh
* $ pulumi import spacelift:index/driftDetection:DriftDetection core-infra-production-drift-detection stack/$STACK_ID
* ```
*
* ```sh
* $ pulumi import spacelift:index/driftDetection:DriftDetection core-infra-production-drift-detection module/$MODULE_ID
* ```
*/
class DriftDetection extends pulumi.CustomResource {
/**
* Get an existing DriftDetection 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 DriftDetection(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of DriftDetection. 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'] === DriftDetection.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["ignoreState"] = state ? state.ignoreState : undefined;
resourceInputs["reconcile"] = state ? state.reconcile : undefined;
resourceInputs["schedules"] = state ? state.schedules : undefined;
resourceInputs["stackId"] = state ? state.stackId : undefined;
resourceInputs["timezone"] = state ? state.timezone : undefined;
}
else {
const args = argsOrState;
if ((!args || args.schedules === undefined) && !opts.urn) {
throw new Error("Missing required property 'schedules'");
}
if ((!args || args.stackId === undefined) && !opts.urn) {
throw new Error("Missing required property 'stackId'");
}
resourceInputs["ignoreState"] = args ? args.ignoreState : undefined;
resourceInputs["reconcile"] = args ? args.reconcile : undefined;
resourceInputs["schedules"] = args ? args.schedules : undefined;
resourceInputs["stackId"] = args ? args.stackId : undefined;
resourceInputs["timezone"] = args ? args.timezone : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(DriftDetection.__pulumiType, name, resourceInputs, opts);
}
}
exports.DriftDetection = DriftDetection;
/** @internal */
DriftDetection.__pulumiType = 'spacelift:index/driftDetection:DriftDetection';
//# sourceMappingURL=driftDetection.js.map