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}} * ``` * * ```sh * $ pulumi import gcp:compute/reservation:Reservation default {{project}}/{{zone}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:compute/reservation:Reservation default {{zone}}/{{name}} * ``` * * ```sh * $ 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, 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; /** * Full or partial URL to a parent commitment. This field displays for * reservations that are tied to a commitment. */ readonly commitment: pulumi.Output; /** * Creation timestamp in RFC3339 text format. */ readonly creationTimestamp: pulumi.Output; /** * 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; /** * 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; /** * An optional description of this resource. */ readonly description: pulumi.Output; /** * Indicates if this group of VMs have emergent maintenance enabled. */ readonly enableEmergentMaintenance: pulumi.Output; /** * Type of the resource. Always compute#reservations for reservations. */ readonly kind: pulumi.Output; /** * Full or partial URL to parent commitments. This field displays for reservations that are tied to multiple commitments. */ readonly linkedCommitments: pulumi.Output; /** * 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; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. * * * `blockNames` - (Optional) List of all reservation block names in the parent reservation. */ readonly project: pulumi.Output; /** * (Output) * The number of reservation blocks associated with this reservation. */ readonly reservationBlockCount: pulumi.Output; /** * Sharing policy for reservations with Google Cloud managed services. * Structure is documented below. */ readonly reservationSharingPolicy: pulumi.Output; /** * Status information for Reservation resource. * Structure is documented below. */ readonly resourceStatuses: pulumi.Output; /** * Reserved for future use. */ readonly satisfiesPzs: pulumi.Output; /** * The URI of the created resource. */ readonly selfLink: pulumi.Output; /** * The share setting for reservations. * Structure is documented below. */ readonly shareSettings: pulumi.Output; /** * Reservation for instances with specific machine shapes. * Structure is documented below. */ readonly specificReservation: pulumi.Output; /** * 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; /** * The status of the reservation. */ readonly status: pulumi.Output; /** * The zone where the reservation is made. */ readonly zone: pulumi.Output; /** * 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[]>; /** * Full or partial URL to a parent commitment. This field displays for * reservations that are tied to a commitment. */ commitment?: pulumi.Input; /** * Creation timestamp in RFC3339 text format. */ creationTimestamp?: pulumi.Input; /** * 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; /** * 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; /** * An optional description of this resource. */ description?: pulumi.Input; /** * Indicates if this group of VMs have emergent maintenance enabled. */ enableEmergentMaintenance?: pulumi.Input; /** * Type of the resource. Always compute#reservations for reservations. */ kind?: pulumi.Input; /** * Full or partial URL to parent commitments. This field displays for reservations that are tied to multiple commitments. */ linkedCommitments?: pulumi.Input[]>; /** * 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; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. * * * `blockNames` - (Optional) List of all reservation block names in the parent reservation. */ project?: pulumi.Input; /** * (Output) * The number of reservation blocks associated with this reservation. */ reservationBlockCount?: pulumi.Input; /** * Sharing policy for reservations with Google Cloud managed services. * Structure is documented below. */ reservationSharingPolicy?: pulumi.Input; /** * Status information for Reservation resource. * Structure is documented below. */ resourceStatuses?: pulumi.Input[]>; /** * Reserved for future use. */ satisfiesPzs?: pulumi.Input; /** * The URI of the created resource. */ selfLink?: pulumi.Input; /** * The share setting for reservations. * Structure is documented below. */ shareSettings?: pulumi.Input; /** * Reservation for instances with specific machine shapes. * Structure is documented below. */ specificReservation?: pulumi.Input; /** * 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; /** * The status of the reservation. */ status?: pulumi.Input; /** * The zone where the reservation is made. */ zone?: pulumi.Input; } /** * 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; /** * 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; /** * An optional description of this resource. */ description?: pulumi.Input; /** * Indicates if this group of VMs have emergent maintenance enabled. */ enableEmergentMaintenance?: pulumi.Input; /** * 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; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. * * * `blockNames` - (Optional) List of all reservation block names in the parent reservation. */ project?: pulumi.Input; /** * Sharing policy for reservations with Google Cloud managed services. * Structure is documented below. */ reservationSharingPolicy?: pulumi.Input; /** * The share setting for reservations. * Structure is documented below. */ shareSettings?: pulumi.Input; /** * Reservation for instances with specific machine shapes. * Structure is documented below. */ specificReservation: pulumi.Input; /** * 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; /** * The zone where the reservation is made. */ zone: pulumi.Input; }