@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
513 lines • 19.4 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
/**
* Represents a reservation resource. A reservation ensures that capacity is
* held in a specific zone even if the reserved VMs are not running.
*
* Reservations apply only to Compute Engine, Cloud Dataproc, and Google
* Kubernetes Engine VM usage.Reservations do not apply to `f1-micro` or
* `g1-small` machine types, preemptible VMs, sole tenant nodes, or other
* services not listed above
* like Cloud SQL and Dataflow.
*
* To get more information about Reservation, see:
*
* * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/reservations)
* * How-to Guides
* * [Reserving zonal resources](https://cloud.google.com/compute/docs/instances/reserving-zonal-resources)
*
* ## Example Usage
*
* ### Reservation Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const gceReservation = new gcp.compute.Reservation("gce_reservation", {
* name: "gce-reservation",
* zone: "us-central1-a",
* specificReservation: {
* count: 1,
* instanceProperties: {
* minCpuPlatform: "Intel Cascade Lake",
* machineType: "n2-standard-2",
* },
* },
* });
* ```
* ### Reservation Basic Beta
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const gceReservation = new gcp.compute.Reservation("gce_reservation", {
* name: "gce-reservation",
* zone: "us-central1-a",
* specificReservation: {
* count: 1,
* instanceProperties: {
* minCpuPlatform: "Intel Cascade Lake",
* machineType: "n2-standard-2",
* maintenanceInterval: "PERIODIC",
* },
* },
* enableEmergentMaintenance: true,
* });
* ```
* ### Reservation Source Instance Template
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const myImage = gcp.compute.getImage({
* family: "debian-11",
* project: "debian-cloud",
* });
* const foobar = new gcp.compute.InstanceTemplate("foobar", {
* name: "instance-template",
* machineType: "n2-standard-2",
* canIpForward: false,
* tags: [
* "foo",
* "bar",
* ],
* disks: [{
* sourceImage: myImage.then(myImage => myImage.selfLink),
* autoDelete: true,
* boot: true,
* }],
* networkInterfaces: [{
* network: "default",
* }],
* scheduling: {
* preemptible: false,
* automaticRestart: true,
* },
* metadata: {
* foo: "bar",
* },
* serviceAccount: {
* scopes: [
* "userinfo-email",
* "compute-ro",
* "storage-ro",
* ],
* },
* labels: {
* my_label: "foobar",
* },
* });
* const gceReservationSourceInstanceTemplate = new gcp.compute.Reservation("gce_reservation_source_instance_template", {
* name: "gce-reservation-source-instance-template",
* zone: "us-central1-a",
* specificReservation: {
* count: 1,
* sourceInstanceTemplate: foobar.selfLink,
* },
* });
* ```
* ### Reservation Sharing Policy
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const myImage = gcp.compute.getImage({
* family: "debian-11",
* project: "debian-cloud",
* });
* const foobar = new gcp.compute.InstanceTemplate("foobar", {
* name: "instance-template",
* machineType: "g2-standard-4",
* canIpForward: false,
* tags: [
* "foo",
* "bar",
* ],
* disks: [{
* sourceImage: myImage.then(myImage => myImage.selfLink),
* autoDelete: true,
* boot: true,
* }],
* networkInterfaces: [{
* network: "default",
* }],
* scheduling: {
* preemptible: false,
* automaticRestart: true,
* },
* metadata: {
* foo: "bar",
* },
* serviceAccount: {
* scopes: [
* "userinfo-email",
* "compute-ro",
* "storage-ro",
* ],
* },
* labels: {
* my_label: "foobar",
* },
* });
* const gceReservationSharingPolicy = new gcp.compute.Reservation("gce_reservation_sharing_policy", {
* name: "gce-reservation-sharing-policy",
* zone: "us-central1-b",
* specificReservation: {
* count: 2,
* sourceInstanceTemplate: foobar.selfLink,
* },
* reservationSharingPolicy: {
* serviceShareType: "ALLOW_ALL",
* },
* });
* ```
*
* ## Import
*
* Reservation can be imported using any of these accepted formats:
*
* * `projects/{{project}}/zones/{{zone}}/reservations/{{name}}`
* * `{{project}}/{{zone}}/{{name}}`
* * `{{zone}}/{{name}}`
* * `{{name}}`
*
* When using the `pulumi import` command, Reservation can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:compute/reservation:Reservation default projects/{{project}}/zones/{{zone}}/reservations/{{name}}
* $ pulumi import gcp:compute/reservation:Reservation default {{project}}/{{zone}}/{{name}}
* $ pulumi import gcp:compute/reservation:Reservation default {{zone}}/{{name}}
* $ pulumi import gcp:compute/reservation:Reservation default {{name}}
* ```
*/
export declare class Reservation extends pulumi.CustomResource {
/**
* Get an existing Reservation 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?: ReservationState, opts?: pulumi.CustomResourceOptions): Reservation;
/**
* Returns true if the given object is an instance of Reservation. 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 Reservation;
/**
* List of all reservation block names in the parent reservation.
*/
readonly blockNames: pulumi.Output<string[]>;
/**
* Full or partial URL to a parent commitment. This field displays for
* reservations that are tied to a commitment.
*/
readonly commitment: pulumi.Output<string>;
/**
* Creation timestamp in RFC3339 text format.
*/
readonly creationTimestamp: pulumi.Output<string>;
/**
* Duration after which the reservation will be auto-deleted by Compute Engine. Cannot be used with delete_at_time.
* Structure is documented below.
*/
readonly deleteAfterDuration: pulumi.Output<outputs.compute.ReservationDeleteAfterDuration | undefined>;
/**
* Absolute time in future when the reservation will be auto-deleted by Compute Engine. Timestamp is represented in RFC3339 text format.
* Cannot be used with delete_after_duration.
*/
readonly deleteAtTime: pulumi.Output<string>;
/**
* 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>;
/**
* An optional description of this resource.
*/
readonly description: pulumi.Output<string | undefined>;
/**
* (Optional, Beta)
* Indicates if this group of VMs have emergent maintenance enabled.
*/
readonly enableEmergentMaintenance: pulumi.Output<boolean | undefined>;
/**
* Type of the resource. Always compute#reservations for reservations.
*/
readonly kind: pulumi.Output<string>;
/**
* Full or partial URL to parent commitments. This field displays for reservations that are tied to multiple commitments.
*/
readonly linkedCommitments: pulumi.Output<string[]>;
/**
* Name of the resource. Provided by the client when the resource is
* created. The 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>;
/**
* (Output)
* The number of reservation blocks associated with this reservation.
*/
readonly reservationBlockCount: pulumi.Output<number>;
/**
* Sharing policy for reservations with Google Cloud managed services.
* Structure is documented below.
*/
readonly reservationSharingPolicy: pulumi.Output<outputs.compute.ReservationReservationSharingPolicy>;
/**
* Status information for Reservation resource.
* Structure is documented below.
*/
readonly resourceStatuses: pulumi.Output<outputs.compute.ReservationResourceStatus[]>;
/**
* Reserved for future use.
*/
readonly satisfiesPzs: pulumi.Output<boolean>;
/**
* The URI of the created resource.
*/
readonly selfLink: pulumi.Output<string>;
/**
* The share setting for reservations.
* Structure is documented below.
*/
readonly shareSettings: pulumi.Output<outputs.compute.ReservationShareSettings>;
/**
* Reservation for instances with specific machine shapes.
* Structure is documented below.
*/
readonly specificReservation: pulumi.Output<outputs.compute.ReservationSpecificReservation>;
/**
* When set to true, only VMs that target this reservation by name can
* consume this reservation. Otherwise, it can be consumed by VMs with
* affinity for any reservation. Defaults to false.
*/
readonly specificReservationRequired: pulumi.Output<boolean | undefined>;
/**
* The status of the reservation.
*/
readonly status: pulumi.Output<string>;
/**
* The zone where the reservation is made.
*/
readonly zone: pulumi.Output<string>;
/**
* Create a Reservation 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: ReservationArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering Reservation resources.
*/
export interface ReservationState {
/**
* List of all reservation block names in the parent reservation.
*/
blockNames?: pulumi.Input<pulumi.Input<string>[] | undefined>;
/**
* Full or partial URL to a parent commitment. This field displays for
* reservations that are tied to a commitment.
*/
commitment?: pulumi.Input<string | undefined>;
/**
* Creation timestamp in RFC3339 text format.
*/
creationTimestamp?: pulumi.Input<string | undefined>;
/**
* Duration after which the reservation will be auto-deleted by Compute Engine. Cannot be used with delete_at_time.
* Structure is documented below.
*/
deleteAfterDuration?: pulumi.Input<inputs.compute.ReservationDeleteAfterDuration | undefined>;
/**
* Absolute time in future when the reservation will be auto-deleted by Compute Engine. Timestamp is represented in RFC3339 text format.
* Cannot be used with delete_after_duration.
*/
deleteAtTime?: pulumi.Input<string | undefined>;
/**
* 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>;
/**
* An optional description of this resource.
*/
description?: pulumi.Input<string | undefined>;
/**
* (Optional, Beta)
* Indicates if this group of VMs have emergent maintenance enabled.
*/
enableEmergentMaintenance?: pulumi.Input<boolean | undefined>;
/**
* Type of the resource. Always compute#reservations for reservations.
*/
kind?: pulumi.Input<string | undefined>;
/**
* Full or partial URL to parent commitments. This field displays for reservations that are tied to multiple commitments.
*/
linkedCommitments?: pulumi.Input<pulumi.Input<string>[] | undefined>;
/**
* Name of the resource. Provided by the client when the resource is
* created. The 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 | 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>;
/**
* (Output)
* The number of reservation blocks associated with this reservation.
*/
reservationBlockCount?: pulumi.Input<number | undefined>;
/**
* Sharing policy for reservations with Google Cloud managed services.
* Structure is documented below.
*/
reservationSharingPolicy?: pulumi.Input<inputs.compute.ReservationReservationSharingPolicy | undefined>;
/**
* Status information for Reservation resource.
* Structure is documented below.
*/
resourceStatuses?: pulumi.Input<pulumi.Input<inputs.compute.ReservationResourceStatus>[] | undefined>;
/**
* Reserved for future use.
*/
satisfiesPzs?: pulumi.Input<boolean | undefined>;
/**
* The URI of the created resource.
*/
selfLink?: pulumi.Input<string | undefined>;
/**
* The share setting for reservations.
* Structure is documented below.
*/
shareSettings?: pulumi.Input<inputs.compute.ReservationShareSettings | undefined>;
/**
* Reservation for instances with specific machine shapes.
* Structure is documented below.
*/
specificReservation?: pulumi.Input<inputs.compute.ReservationSpecificReservation | undefined>;
/**
* When set to true, only VMs that target this reservation by name can
* consume this reservation. Otherwise, it can be consumed by VMs with
* affinity for any reservation. Defaults to false.
*/
specificReservationRequired?: pulumi.Input<boolean | undefined>;
/**
* The status of the reservation.
*/
status?: pulumi.Input<string | undefined>;
/**
* The zone where the reservation is made.
*/
zone?: pulumi.Input<string | undefined>;
}
/**
* The set of arguments for constructing a Reservation resource.
*/
export interface ReservationArgs {
/**
* Duration after which the reservation will be auto-deleted by Compute Engine. Cannot be used with delete_at_time.
* Structure is documented below.
*/
deleteAfterDuration?: pulumi.Input<inputs.compute.ReservationDeleteAfterDuration | undefined>;
/**
* Absolute time in future when the reservation will be auto-deleted by Compute Engine. Timestamp is represented in RFC3339 text format.
* Cannot be used with delete_after_duration.
*/
deleteAtTime?: pulumi.Input<string | undefined>;
/**
* 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>;
/**
* An optional description of this resource.
*/
description?: pulumi.Input<string | undefined>;
/**
* (Optional, Beta)
* Indicates if this group of VMs have emergent maintenance enabled.
*/
enableEmergentMaintenance?: pulumi.Input<boolean | undefined>;
/**
* Name of the resource. Provided by the client when the resource is
* created. The 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 | 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>;
/**
* Sharing policy for reservations with Google Cloud managed services.
* Structure is documented below.
*/
reservationSharingPolicy?: pulumi.Input<inputs.compute.ReservationReservationSharingPolicy | undefined>;
/**
* The share setting for reservations.
* Structure is documented below.
*/
shareSettings?: pulumi.Input<inputs.compute.ReservationShareSettings | undefined>;
/**
* Reservation for instances with specific machine shapes.
* Structure is documented below.
*/
specificReservation: pulumi.Input<inputs.compute.ReservationSpecificReservation>;
/**
* When set to true, only VMs that target this reservation by name can
* consume this reservation. Otherwise, it can be consumed by VMs with
* affinity for any reservation. Defaults to false.
*/
specificReservationRequired?: pulumi.Input<boolean | undefined>;
/**
* The zone where the reservation is made.
*/
zone: pulumi.Input<string>;
}
//# sourceMappingURL=reservation.d.ts.map