google_compute_reservation

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:

Open in Cloud Shell

Example Usage - Reservation Basic

resource "google_compute_reservation" "gce_reservation" {
  name = "gce-reservation"
  zone = "us-central1-a"

  specific_reservation {
    count = 1
    instance_properties {
      min_cpu_platform = "Intel Cascade Lake"
      machine_type     = "n2-standard-2"
    }
  }
}

Argument Reference

The following arguments are supported:

The specific_reservation block supports:

The instance_properties block supports:

The guest_accelerators block supports:

The local_ssds block supports:


The share_settings block supports:

The project_map block supports:

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

Timeouts

This resource provides the following Timeouts configuration options:

Import

Reservation can be imported using any of these accepted formats:

In Terraform v1.5.0 and later, use an import block to import Reservation using one of the formats above. For example:

import {
  id = "projects/{{project}}/zones/{{zone}}/reservations/{{name}}"
  to = google_compute_reservation.default
}

When using the terraform import command, Reservation can be imported using one of the formats above. For example:

$ 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.