@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
186 lines • 7.78 kB
TypeScript
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}}
* $ pulumi import gcp:compute/resourcePolicyAttachment:ResourcePolicyAttachment default {{project}}/{{zone}}/{{instance}}/{{name}}
* $ pulumi import gcp:compute/resourcePolicyAttachment:ResourcePolicyAttachment default {{zone}}/{{instance}}/{{name}}
* $ 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<pulumi.ID>, 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;
/**
* Whether Terraform will be prevented from destroying the resource. Defaults to DELETE.
* When a 'terraform destroy' or 'pulumi up' would delete the resource,
* the command will fail if this field is set to "PREVENT" in Terraform state.
* When set to "ABANDON", the command will remove the resource from Terraform
* management without updating or deleting the resource in the API.
* When set to "DELETE", deleting the resource is allowed.
*/
readonly deletionPolicy: pulumi.Output<string>;
/**
* The name of the instance in which the resource policies are attached to.
*/
readonly instance: pulumi.Output<string>;
/**
* The resource policy to be attached to the instance for scheduling start/stop
* operations. Do not specify the self link.
*/
readonly name: pulumi.Output<string>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
readonly project: pulumi.Output<string>;
/**
* A reference to the zone where the instance resides.
*/
readonly zone: pulumi.Output<string>;
/**
* 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 {
/**
* Whether Terraform will be prevented from destroying the resource. Defaults to DELETE.
* When a 'terraform destroy' or 'pulumi up' would delete the resource,
* the command will fail if this field is set to "PREVENT" in Terraform state.
* When set to "ABANDON", the command will remove the resource from Terraform
* management without updating or deleting the resource in the API.
* When set to "DELETE", deleting the resource is allowed.
*/
deletionPolicy?: pulumi.Input<string | undefined>;
/**
* The name of the instance in which the resource policies are attached to.
*/
instance?: pulumi.Input<string | undefined>;
/**
* The resource policy to be attached to the instance for scheduling start/stop
* operations. Do not specify the self link.
*/
name?: pulumi.Input<string | undefined>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
project?: pulumi.Input<string | undefined>;
/**
* A reference to the zone where the instance resides.
*/
zone?: pulumi.Input<string | undefined>;
}
/**
* The set of arguments for constructing a ResourcePolicyAttachment resource.
*/
export interface ResourcePolicyAttachmentArgs {
/**
* Whether Terraform will be prevented from destroying the resource. Defaults to DELETE.
* When a 'terraform destroy' or 'pulumi up' would delete the resource,
* the command will fail if this field is set to "PREVENT" in Terraform state.
* When set to "ABANDON", the command will remove the resource from Terraform
* management without updating or deleting the resource in the API.
* When set to "DELETE", deleting the resource is allowed.
*/
deletionPolicy?: pulumi.Input<string | undefined>;
/**
* The name of the instance in which the resource policies are attached to.
*/
instance: pulumi.Input<string>;
/**
* The resource policy to be attached to the instance for scheduling start/stop
* operations. Do not specify the self link.
*/
name?: pulumi.Input<string | undefined>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
project?: pulumi.Input<string | undefined>;
/**
* A reference to the zone where the instance resides.
*/
zone?: pulumi.Input<string | undefined>;
}
//# sourceMappingURL=resourcePolicyAttachment.d.ts.map