ReservationArgs

data class ReservationArgs(val description: Output<String>? = null, val name: Output<String>? = null, val project: Output<String>? = null, val shareSettings: Output<ReservationShareSettingsArgs>? = null, val specificReservation: Output<ReservationSpecificReservationArgs>? = null, val specificReservationRequired: Output<Boolean>? = null, val zone: Output<String>? = null) : ConvertibleToJava<ReservationArgs>

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:

Example Usage

Reservation Basic

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",
},
},
});
import pulumi
import pulumi_gcp as gcp
gce_reservation = gcp.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",
},
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var gceReservation = new Gcp.Compute.Reservation("gce_reservation", new()
{
Name = "gce-reservation",
Zone = "us-central1-a",
SpecificReservation = new Gcp.Compute.Inputs.ReservationSpecificReservationArgs
{
Count = 1,
InstanceProperties = new Gcp.Compute.Inputs.ReservationSpecificReservationInstancePropertiesArgs
{
MinCpuPlatform = "Intel Cascade Lake",
MachineType = "n2-standard-2",
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := compute.NewReservation(ctx, "gce_reservation", &compute.ReservationArgs{
Name: pulumi.String("gce-reservation"),
Zone: pulumi.String("us-central1-a"),
SpecificReservation: &compute.ReservationSpecificReservationArgs{
Count: pulumi.Int(1),
InstanceProperties: &compute.ReservationSpecificReservationInstancePropertiesArgs{
MinCpuPlatform: pulumi.String("Intel Cascade Lake"),
MachineType: pulumi.String("n2-standard-2"),
},
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.Reservation;
import com.pulumi.gcp.compute.ReservationArgs;
import com.pulumi.gcp.compute.inputs.ReservationSpecificReservationArgs;
import com.pulumi.gcp.compute.inputs.ReservationSpecificReservationInstancePropertiesArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var gceReservation = new Reservation("gceReservation", ReservationArgs.builder()
.name("gce-reservation")
.zone("us-central1-a")
.specificReservation(ReservationSpecificReservationArgs.builder()
.count(1)
.instanceProperties(ReservationSpecificReservationInstancePropertiesArgs.builder()
.minCpuPlatform("Intel Cascade Lake")
.machineType("n2-standard-2")
.build())
.build())
.build());
}
}
resources:
gceReservation:
type: gcp:compute:Reservation
name: gce_reservation
properties:
name: gce-reservation
zone: us-central1-a
specificReservation:
count: 1
instanceProperties:
minCpuPlatform: Intel Cascade Lake
machineType: n2-standard-2

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:

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

Constructors

Link copied to clipboard
constructor(description: Output<String>? = null, name: Output<String>? = null, project: Output<String>? = null, shareSettings: Output<ReservationShareSettingsArgs>? = null, specificReservation: Output<ReservationSpecificReservationArgs>? = null, specificReservationRequired: Output<Boolean>? = null, zone: Output<String>? = null)

Properties

Link copied to clipboard
val description: Output<String>? = null

An optional description of this resource.

Link copied to clipboard
val name: Output<String>? = null

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.

Link copied to clipboard
val project: Output<String>? = null
Link copied to clipboard

The share setting for reservations.

Link copied to clipboard

Reservation for instances with specific machine shapes. Structure is documented below.

Link copied to clipboard

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.

Link copied to clipboard
val zone: Output<String>? = null

The zone where the reservation is made.

Functions

Link copied to clipboard
open override fun toJava(): ReservationArgs