UNPKG

@spacelift-io/pulumi-spacelift

Version:

A Pulumi package for creating and managing Spacelift resources.

103 lines (102 loc) 3.8 kB
import * as pulumi from "@pulumi/pulumi"; /** * `spacelift.PolicyAttachment` represents a relationship between a policy (`spacelift.Policy`) and a stack (`spacelift.Stack`) or module (`spacelift.Module`). Each policy can only be attached to a stack/module once. `LOGIN` policies are the exception because they apply globally and not to individual stacks/modules. An attempt to attach one will fail. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as fs from "fs"; * import * as spacelift from "@spacelift-io/pulumi-spacelift"; * * const no_weekend_deploysPolicy = new spacelift.Policy("no-weekend-deploysPolicy", { * body: fs.readFileSync("policies/no-weekend-deploys.rego"), * type: "PLAN", * }); * const core_infra_production = new spacelift.Stack("core-infra-production", { * branch: "master", * repository: "core-infra", * }); * const no_weekend_deploysPolicyAttachment = new spacelift.PolicyAttachment("no-weekend-deploysPolicyAttachment", { * policyId: no_weekend_deploysPolicy.id, * stackId: core_infra_production.id, * }); * ``` * * ## Import * * ```sh * $ pulumi import spacelift:index/policyAttachment:PolicyAttachment no-weekend-deploys $POLICY_ID/$STACK_ID * ``` */ export declare class PolicyAttachment extends pulumi.CustomResource { /** * Get an existing PolicyAttachment 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: string, id: pulumi.Input<pulumi.ID>, state?: PolicyAttachmentState, opts?: pulumi.CustomResourceOptions): PolicyAttachment; /** * Returns true if the given object is an instance of PolicyAttachment. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is PolicyAttachment; /** * ID of the module to attach the policy to */ readonly moduleId: pulumi.Output<string | undefined>; /** * ID of the policy to attach */ readonly policyId: pulumi.Output<string>; /** * ID of the stack to attach the policy to */ readonly stackId: pulumi.Output<string | undefined>; /** * Create a PolicyAttachment resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: PolicyAttachmentArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering PolicyAttachment resources. */ export interface PolicyAttachmentState { /** * ID of the module to attach the policy to */ moduleId?: pulumi.Input<string>; /** * ID of the policy to attach */ policyId?: pulumi.Input<string>; /** * ID of the stack to attach the policy to */ stackId?: pulumi.Input<string>; } /** * The set of arguments for constructing a PolicyAttachment resource. */ export interface PolicyAttachmentArgs { /** * ID of the module to attach the policy to */ moduleId?: pulumi.Input<string>; /** * ID of the policy to attach */ policyId: pulumi.Input<string>; /** * ID of the stack to attach the policy to */ stackId?: pulumi.Input<string>; }