googleComputeReservation
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 f1Micro
or g1Small
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
- How-to Guides
- Reserving zonal resources
Example Usage - Reservation Basic
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.computeReservation.ComputeReservation(this, "gce_reservation", {
name: "gce-reservation",
specific_reservation: [
{
count: 1,
instance_properties: [
{
machine_type: "n2-standard-2",
min_cpu_platform: "Intel Cascade Lake",
},
],
},
],
zone: "us-central1-a",
});
Argument Reference
The following arguments are supported:
-
name
- (Required) 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[aZ]([AZ09]*[aZ09])?
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. -
specificReservation
- (Required) Reservation for instances with specific machine shapes. Structure is documented below. -
zone
- (Required) The zone where the reservation is made.
The specificReservation
block supports:
-
count
- (Required) The number of resources that are allocated. -
inUseCount
- (Output) How many instances are in use. -
instanceProperties
- (Required) The instance properties for the reservation. Structure is documented below.
The instanceProperties
block supports:
-
machineType
- (Required) The name of the machine type to reserve. -
minCpuPlatform
- (Optional) The minimum CPU platform for the reservation. For example,"intelSkylake"
. See the CPU platform availability reference](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform#availablezones) for information on available CPU platforms. -
guestAccelerators
- (Optional) Guest accelerator type and count. Structure is documented below. -
localSsds
- (Optional) The amount of local ssd to reserve with each instance. This reserves disks of typelocalSsd
. Structure is documented below.
The guestAccelerators
block supports:
-
acceleratorType
- (Required) The full or partial URL of the accelerator type to attach to this instance. For example:projects/myProject/zones/usCentral1C/acceleratorTypes/nvidiaTeslaP100
If you are creating an instance template, specify only the accelerator name. -
acceleratorCount
- (Required) The number of the guest accelerator cards exposed to this instance.
-
interface
- (Optional) The disk interface to use for attaching this disk. Default value isscsi
. Possible values arescsi
andnvme
. -
diskSizeGb
- (Required) The size of the disk in base-2 GB.
-
description
- (Optional) An optional description of this resource. -
specificReservationRequired
- (Optional) 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. -
shareSettings
- (Optional) The share setting for reservations. Structure is documented below. -
project
- (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
The shareSettings
block supports:
-
shareType
- (Optional) Type of sharing for this shared-reservation Possible values arelocal
andspecificProjects
. -
projectMap
- (Optional) A map of project number and project config. This is only valid when shareType's value is SPECIFIC_PROJECTS. Structure is documented below.
The projectMap
block supports:
-
id
- (Required) The identifier for this object. Format specified above. -
projectId
- (Optional) The project id/number, should be same as the key of this project config in the project map.
Attributes Reference
In addition to the arguments listed above, the following computed attributes are exported:
-
id
- an identifier for the resource with formatprojects/{{project}}/zones/{{zone}}/reservations/{{name}}
-
creationTimestamp
- Creation timestamp in RFC3339 text format. -
commitment
- Full or partial URL to a parent commitment. This field displays for reservations that are tied to a commitment. -
status
- The status of the reservation. -
selfLink
- The URI of the created resource.
Timeouts
This resource provides the following Timeouts configuration options:
create
- Default is 20 minutes.update
- Default is 20 minutes.delete
- Default is 20 minutes.
Import
Reservation can be imported using any of these accepted formats:
$ terraform import google_compute_reservation.default projects/{{project}}/zones/{{zone}}/reservations/{{name}}
$ terraform import google_compute_reservation.default {{project}}/{{zone}}/{{name}}
$ terraform import google_compute_reservation.default {{zone}}/{{name}}
$ terraform import google_compute_reservation.default {{name}}
User Project Overrides
This resource supports User Project Overrides.