@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
447 lines (446 loc) • 14.8 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
/**
* A policy that can be attached to a resource to specify or schedule actions on that resource.
*
* To get more information about ResourcePolicy, see:
*
* * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/resourcePolicies)
*
* ## Example Usage
*
* ### Resource Policy Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const foo = new gcp.compute.ResourcePolicy("foo", {
* name: "gce-policy",
* region: "us-central1",
* snapshotSchedulePolicy: {
* schedule: {
* dailySchedule: {
* daysInCycle: 1,
* startTime: "04:00",
* },
* },
* },
* });
* ```
* ### Resource Policy Full
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const bar = new gcp.compute.ResourcePolicy("bar", {
* name: "gce-policy",
* region: "us-central1",
* snapshotSchedulePolicy: {
* schedule: {
* hourlySchedule: {
* hoursInCycle: 20,
* startTime: "23:00",
* },
* },
* retentionPolicy: {
* maxRetentionDays: 10,
* onSourceDiskDelete: "KEEP_AUTO_SNAPSHOTS",
* },
* snapshotProperties: {
* labels: {
* my_label: "value",
* },
* storageLocations: "us",
* guestFlush: true,
* },
* },
* });
* ```
* ### Resource Policy Placement Policy
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const baz = new gcp.compute.ResourcePolicy("baz", {
* name: "gce-policy",
* region: "us-central1",
* groupPlacementPolicy: {
* vmCount: 2,
* collocation: "COLLOCATED",
* },
* });
* ```
* ### Resource Policy Placement Policy Max Distance
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const baz = new gcp.compute.ResourcePolicy("baz", {
* name: "gce-policy",
* region: "us-central1",
* groupPlacementPolicy: {
* vmCount: 2,
* collocation: "COLLOCATED",
* maxDistance: 2,
* },
* });
* ```
* ### Resource Policy Instance Schedule Policy
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const hourly = new gcp.compute.ResourcePolicy("hourly", {
* name: "gce-policy",
* region: "us-central1",
* description: "Start and stop instances",
* instanceSchedulePolicy: {
* vmStartSchedule: {
* schedule: "0 * * * *",
* },
* vmStopSchedule: {
* schedule: "15 * * * *",
* },
* timeZone: "US/Central",
* },
* });
* ```
* ### Resource Policy Snapshot Schedule Chain Name
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const hourly = new gcp.compute.ResourcePolicy("hourly", {
* name: "gce-policy",
* region: "us-central1",
* description: "chain name snapshot",
* snapshotSchedulePolicy: {
* schedule: {
* hourlySchedule: {
* hoursInCycle: 20,
* startTime: "23:00",
* },
* },
* retentionPolicy: {
* maxRetentionDays: 14,
* onSourceDiskDelete: "KEEP_AUTO_SNAPSHOTS",
* },
* snapshotProperties: {
* labels: {
* my_label: "value",
* },
* storageLocations: "us",
* guestFlush: true,
* chainName: "test-schedule-chain-name",
* },
* },
* });
* ```
* ### Resource Policy Consistency Group
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const cgroup = new gcp.compute.ResourcePolicy("cgroup", {
* name: "gce-policy",
* region: "europe-west1",
* diskConsistencyGroupPolicy: {
* enabled: true,
* },
* });
* ```
* ### Resource Policy Workload Policy
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const bar = new gcp.compute.ResourcePolicy("bar", {
* name: "gce-policy",
* region: "europe-west1",
* workloadPolicy: {
* type: "HIGH_AVAILABILITY",
* },
* });
* ```
* ### Resource Policy Workload Policy Accelerator Topology
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const bar = new gcp.compute.ResourcePolicy("bar", {
* name: "gce-policy",
* region: "europe-west1",
* workloadPolicy: {
* type: "HIGH_THROUGHPUT",
* acceleratorTopology: "SOME NEW TOPOLOGY",
* },
* });
* ```
* ### Resource Policy Workload Policy Max Topology Distance
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const bar = new gcp.compute.ResourcePolicy("bar", {
* name: "gce-policy",
* region: "europe-west1",
* workloadPolicy: {
* type: "HIGH_THROUGHPUT",
* maxTopologyDistance: "BLOCK",
* },
* });
* ```
* ### Resource Policy Placement Policy Gpu Topology
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const baz = new gcp.compute.ResourcePolicy("baz", {
* name: "gce-policy",
* region: "europe-west9",
* groupPlacementPolicy: {
* vmCount: 2,
* collocation: "COLLOCATED",
* gpuTopology: "1x72",
* },
* });
* ```
*
* ## Import
*
* ResourcePolicy can be imported using any of these accepted formats:
*
* * `projects/{{project}}/regions/{{region}}/resourcePolicies/{{name}}`
*
* * `{{project}}/{{region}}/{{name}}`
*
* * `{{region}}/{{name}}`
*
* * `{{name}}`
*
* When using the `pulumi import` command, ResourcePolicy can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:compute/resourcePolicy:ResourcePolicy default projects/{{project}}/regions/{{region}}/resourcePolicies/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/resourcePolicy:ResourcePolicy default {{project}}/{{region}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/resourcePolicy:ResourcePolicy default {{region}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/resourcePolicy:ResourcePolicy default {{name}}
* ```
*/
export declare class ResourcePolicy extends pulumi.CustomResource {
/**
* Get an existing ResourcePolicy 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?: ResourcePolicyState, opts?: pulumi.CustomResourceOptions): ResourcePolicy;
/**
* Returns true if the given object is an instance of ResourcePolicy. 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 ResourcePolicy;
/**
* An optional description of this resource. Provide this property when you create the resource.
*/
readonly description: pulumi.Output<string | undefined>;
/**
* Replication consistency group for asynchronous disk replication.
* Structure is documented below.
*/
readonly diskConsistencyGroupPolicy: pulumi.Output<outputs.compute.ResourcePolicyDiskConsistencyGroupPolicy | undefined>;
/**
* Resource policy for instances used for placement configuration.
* Structure is documented below.
*/
readonly groupPlacementPolicy: pulumi.Output<outputs.compute.ResourcePolicyGroupPlacementPolicy | undefined>;
/**
* Resource policy for scheduling instance operations.
* Structure is documented below.
*/
readonly instanceSchedulePolicy: pulumi.Output<outputs.compute.ResourcePolicyInstanceSchedulePolicy | undefined>;
/**
* The name of the resource, provided by the client when initially creating
* the resource. The resource name must be 1-63 characters long, and comply
* with RFC1035. Specifically, the name must be 1-63 characters long and
* match the regular expression `a-z`? which means the
* first character must be a lowercase letter, and all following characters
* must be a dash, lowercase letter, or digit, except the last character,
* which cannot be a dash.
*
*
* - - -
*/
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>;
/**
* Region where resource policy resides.
*/
readonly region: pulumi.Output<string>;
/**
* The URI of the created resource.
*/
readonly selfLink: pulumi.Output<string>;
/**
* Policy for creating snapshots of persistent disks.
* Structure is documented below.
*/
readonly snapshotSchedulePolicy: pulumi.Output<outputs.compute.ResourcePolicySnapshotSchedulePolicy | undefined>;
/**
* Represents the workload policy.
* Structure is documented below.
*/
readonly workloadPolicy: pulumi.Output<outputs.compute.ResourcePolicyWorkloadPolicy | undefined>;
/**
* Create a ResourcePolicy 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?: ResourcePolicyArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering ResourcePolicy resources.
*/
export interface ResourcePolicyState {
/**
* An optional description of this resource. Provide this property when you create the resource.
*/
description?: pulumi.Input<string>;
/**
* Replication consistency group for asynchronous disk replication.
* Structure is documented below.
*/
diskConsistencyGroupPolicy?: pulumi.Input<inputs.compute.ResourcePolicyDiskConsistencyGroupPolicy>;
/**
* Resource policy for instances used for placement configuration.
* Structure is documented below.
*/
groupPlacementPolicy?: pulumi.Input<inputs.compute.ResourcePolicyGroupPlacementPolicy>;
/**
* Resource policy for scheduling instance operations.
* Structure is documented below.
*/
instanceSchedulePolicy?: pulumi.Input<inputs.compute.ResourcePolicyInstanceSchedulePolicy>;
/**
* The name of the resource, provided by the client when initially creating
* the resource. The resource name must be 1-63 characters long, and comply
* with RFC1035. Specifically, the name must be 1-63 characters long and
* match the regular expression `a-z`? which means the
* first character must be a lowercase letter, and all following characters
* must be a dash, lowercase letter, or digit, except the last character,
* which cannot be a dash.
*
*
* - - -
*/
name?: pulumi.Input<string>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
project?: pulumi.Input<string>;
/**
* Region where resource policy resides.
*/
region?: pulumi.Input<string>;
/**
* The URI of the created resource.
*/
selfLink?: pulumi.Input<string>;
/**
* Policy for creating snapshots of persistent disks.
* Structure is documented below.
*/
snapshotSchedulePolicy?: pulumi.Input<inputs.compute.ResourcePolicySnapshotSchedulePolicy>;
/**
* Represents the workload policy.
* Structure is documented below.
*/
workloadPolicy?: pulumi.Input<inputs.compute.ResourcePolicyWorkloadPolicy>;
}
/**
* The set of arguments for constructing a ResourcePolicy resource.
*/
export interface ResourcePolicyArgs {
/**
* An optional description of this resource. Provide this property when you create the resource.
*/
description?: pulumi.Input<string>;
/**
* Replication consistency group for asynchronous disk replication.
* Structure is documented below.
*/
diskConsistencyGroupPolicy?: pulumi.Input<inputs.compute.ResourcePolicyDiskConsistencyGroupPolicy>;
/**
* Resource policy for instances used for placement configuration.
* Structure is documented below.
*/
groupPlacementPolicy?: pulumi.Input<inputs.compute.ResourcePolicyGroupPlacementPolicy>;
/**
* Resource policy for scheduling instance operations.
* Structure is documented below.
*/
instanceSchedulePolicy?: pulumi.Input<inputs.compute.ResourcePolicyInstanceSchedulePolicy>;
/**
* The name of the resource, provided by the client when initially creating
* the resource. The resource name must be 1-63 characters long, and comply
* with RFC1035. Specifically, the name must be 1-63 characters long and
* match the regular expression `a-z`? which means the
* first character must be a lowercase letter, and all following characters
* must be a dash, lowercase letter, or digit, except the last character,
* which cannot be a dash.
*
*
* - - -
*/
name?: pulumi.Input<string>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
project?: pulumi.Input<string>;
/**
* Region where resource policy resides.
*/
region?: pulumi.Input<string>;
/**
* Policy for creating snapshots of persistent disks.
* Structure is documented below.
*/
snapshotSchedulePolicy?: pulumi.Input<inputs.compute.ResourcePolicySnapshotSchedulePolicy>;
/**
* Represents the workload policy.
* Structure is documented below.
*/
workloadPolicy?: pulumi.Input<inputs.compute.ResourcePolicyWorkloadPolicy>;
}