import * as pulumi from "@pulumi/pulumi"; /** * Adds existing resource policies to a compute instance. You can only add one policy * which will be applied to this instance for scheduling start/stop operations. * * This resource can be used instead of setting the resourcePolicy directly in the * compute instance resource to avoid dependency issues when using instance-level IAM * permissions. * * ## Example Usage * * ### Compute Resource Policy Attachment Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const instance = new gcp.compute.Instance("instance", { * networkInterfaces: [{ * accessConfigs: [{}], * network: "default", * }], * name: "my-instance", * machineType: "e2-medium", * zone: "us-central1-a", * bootDisk: { * initializeParams: { * image: "debian-cloud/debian-11", * }, * }, * }); * const policy = new gcp.compute.ResourcePolicy("policy", { * name: "my-resource-policy", * region: "us-central1", * instanceSchedulePolicy: { * vmStartSchedule: { * schedule: "0 8 * * *", * }, * vmStopSchedule: { * schedule: "0 18 * * *", * }, * timeZone: "America/New_York", * }, * }); * const attachment = new gcp.compute.ResourcePolicyAttachment("attachment", { * name: policy.name, * instance: instance.name, * zone: "us-central1-a", * }); * ``` * * ## Import * * ResourcePolicyAttachment can be imported using any of these accepted formats: * * * `projects/{{project}}/zones/{{zone}}/instances/{{instance}}/{{name}}` * * * `{{project}}/{{zone}}/{{instance}}/{{name}}` * * * `{{zone}}/{{instance}}/{{name}}` * * * `{{instance}}/{{name}}` * * When using the `pulumi import` command, ResourcePolicyAttachment can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:compute/resourcePolicyAttachment:ResourcePolicyAttachment default projects/{{project}}/zones/{{zone}}/instances/{{instance}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:compute/resourcePolicyAttachment:ResourcePolicyAttachment default {{project}}/{{zone}}/{{instance}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:compute/resourcePolicyAttachment:ResourcePolicyAttachment default {{zone}}/{{instance}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:compute/resourcePolicyAttachment:ResourcePolicyAttachment default {{instance}}/{{name}} * ``` */ export declare class ResourcePolicyAttachment extends pulumi.CustomResource { /** * Get an existing ResourcePolicyAttachment 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, state?: ResourcePolicyAttachmentState, opts?: pulumi.CustomResourceOptions): ResourcePolicyAttachment; /** * Returns true if the given object is an instance of ResourcePolicyAttachment. 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 ResourcePolicyAttachment; /** * The name of the instance in which the resource policies are attached to. */ readonly instance: pulumi.Output; /** * The resource policy to be attached to the instance for scheduling start/stop * operations. Do not specify the self link. */ readonly name: pulumi.Output; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ readonly project: pulumi.Output; /** * A reference to the zone where the instance resides. */ readonly zone: pulumi.Output; /** * Create a ResourcePolicyAttachment 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: ResourcePolicyAttachmentArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering ResourcePolicyAttachment resources. */ export interface ResourcePolicyAttachmentState { /** * The name of the instance in which the resource policies are attached to. */ instance?: pulumi.Input; /** * The resource policy to be attached to the instance for scheduling start/stop * operations. Do not specify the self link. */ name?: pulumi.Input; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input; /** * A reference to the zone where the instance resides. */ zone?: pulumi.Input; } /** * The set of arguments for constructing a ResourcePolicyAttachment resource. */ export interface ResourcePolicyAttachmentArgs { /** * The name of the instance in which the resource policies are attached to. */ instance: pulumi.Input; /** * The resource policy to be attached to the instance for scheduling start/stop * operations. Do not specify the self link. */ name?: pulumi.Input; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input; /** * A reference to the zone where the instance resides. */ zone?: pulumi.Input; }