@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
222 lines • 10.4 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FutureReservation = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* Represents a future reservation resource in Compute Engine. Future reservations allow users
* to reserve capacity for a specified time window, ensuring that resources are available
* when needed.
*
* 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.
*
* > **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider.
* See Provider Versions for more details on beta resources.
*
* To get more information about FutureReservation, see:
*
* * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/futureReservations)
* * How-to Guides
* * [Future Reservations Guide](https://cloud.google.com/compute/docs/instances/future-reservations-overview)
*
* ## Example Usage
*
* ### Future Reservation Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const gceFutureReservation = new gcp.compute.FutureReservation("gce_future_reservation", {
* name: "gce-future-reservation",
* project: "my-project-name",
* autoDeleteAutoCreatedReservations: true,
* planningStatus: "DRAFT",
* namePrefix: "fr-basic",
* timeWindow: {
* startTime: "2025-11-01T00:00:00Z",
* endTime: "2025-11-02T00:00:00Z",
* },
* specificSkuProperties: {
* totalCount: "1",
* instanceProperties: {
* machineType: "e2-standard-2",
* },
* },
* });
* ```
* ### Future Reservation Aggregate Reservation
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const gceFutureReservation = new gcp.compute.FutureReservation("gce_future_reservation", {
* name: "gce-future-reservation-aggregate-reservation",
* project: "my-project-name",
* autoDeleteAutoCreatedReservations: true,
* planningStatus: "DRAFT",
* namePrefix: "fr-basic",
* timeWindow: {
* startTime: "2025-11-01T00:00:00Z",
* endTime: "2025-11-02T00:00:00Z",
* },
* aggregateReservation: {
* vmFamily: "VM_FAMILY_CLOUD_TPU_DEVICE_CT3",
* workloadType: "UNSPECIFIED",
* reservedResources: [
* {
* accelerator: {
* acceleratorCount: 32,
* acceleratorType: "projects/my-project-name/zones/us-central1-a/acceleratorTypes/ct3",
* },
* },
* {
* accelerator: {
* acceleratorCount: 2,
* acceleratorType: "projects/my-project-name/zones/us-central1-a/acceleratorTypes/ct3",
* },
* },
* ],
* },
* });
* ```
*
* ## Import
*
* FutureReservation can be imported using any of these accepted formats:
*
* * `projects/{{project}}/zones/{{zone}}/futureReservations/{{name}}`
* * `{{project}}/{{zone}}/{{name}}`
* * `{{zone}}/{{name}}`
* * `{{name}}`
*
* When using the `pulumi import` command, FutureReservation can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:compute/futureReservation:FutureReservation default projects/{{project}}/zones/{{zone}}/futureReservations/{{name}}
* $ pulumi import gcp:compute/futureReservation:FutureReservation default {{project}}/{{zone}}/{{name}}
* $ pulumi import gcp:compute/futureReservation:FutureReservation default {{zone}}/{{name}}
* $ pulumi import gcp:compute/futureReservation:FutureReservation default {{name}}
* ```
*/
class FutureReservation extends pulumi.CustomResource {
/**
* Get an existing FutureReservation 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, id, state, opts) {
return new FutureReservation(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:compute/futureReservation:FutureReservation';
/**
* Returns true if the given object is an instance of FutureReservation. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === FutureReservation.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["aggregateReservation"] = state?.aggregateReservation;
resourceInputs["autoCreatedReservationsDeleteTime"] = state?.autoCreatedReservationsDeleteTime;
resourceInputs["autoCreatedReservationsDuration"] = state?.autoCreatedReservationsDuration;
resourceInputs["autoDeleteAutoCreatedReservations"] = state?.autoDeleteAutoCreatedReservations;
resourceInputs["commitmentInfo"] = state?.commitmentInfo;
resourceInputs["creationTimestamp"] = state?.creationTimestamp;
resourceInputs["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["deploymentType"] = state?.deploymentType;
resourceInputs["description"] = state?.description;
resourceInputs["name"] = state?.name;
resourceInputs["namePrefix"] = state?.namePrefix;
resourceInputs["planningStatus"] = state?.planningStatus;
resourceInputs["project"] = state?.project;
resourceInputs["reservationMode"] = state?.reservationMode;
resourceInputs["reservationName"] = state?.reservationName;
resourceInputs["schedulingType"] = state?.schedulingType;
resourceInputs["selfLink"] = state?.selfLink;
resourceInputs["selfLinkWithId"] = state?.selfLinkWithId;
resourceInputs["shareSettings"] = state?.shareSettings;
resourceInputs["specificReservationRequired"] = state?.specificReservationRequired;
resourceInputs["specificSkuProperties"] = state?.specificSkuProperties;
resourceInputs["statuses"] = state?.statuses;
resourceInputs["timeWindow"] = state?.timeWindow;
resourceInputs["zone"] = state?.zone;
}
else {
const args = argsOrState;
if (args?.timeWindow === undefined && !opts.urn) {
throw new Error("Missing required property 'timeWindow'");
}
resourceInputs["aggregateReservation"] = args?.aggregateReservation;
resourceInputs["autoCreatedReservationsDeleteTime"] = args?.autoCreatedReservationsDeleteTime;
resourceInputs["autoCreatedReservationsDuration"] = args?.autoCreatedReservationsDuration;
resourceInputs["autoDeleteAutoCreatedReservations"] = args?.autoDeleteAutoCreatedReservations;
resourceInputs["commitmentInfo"] = args?.commitmentInfo;
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["deploymentType"] = args?.deploymentType;
resourceInputs["description"] = args?.description;
resourceInputs["name"] = args?.name;
resourceInputs["namePrefix"] = args?.namePrefix;
resourceInputs["planningStatus"] = args?.planningStatus;
resourceInputs["project"] = args?.project;
resourceInputs["reservationMode"] = args?.reservationMode;
resourceInputs["reservationName"] = args?.reservationName;
resourceInputs["schedulingType"] = args?.schedulingType;
resourceInputs["shareSettings"] = args?.shareSettings;
resourceInputs["specificReservationRequired"] = args?.specificReservationRequired;
resourceInputs["specificSkuProperties"] = args?.specificSkuProperties;
resourceInputs["timeWindow"] = args?.timeWindow;
resourceInputs["creationTimestamp"] = undefined /*out*/;
resourceInputs["selfLink"] = undefined /*out*/;
resourceInputs["selfLinkWithId"] = undefined /*out*/;
resourceInputs["statuses"] = undefined /*out*/;
resourceInputs["zone"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(FutureReservation.__pulumiType, name, resourceInputs, opts);
}
}
exports.FutureReservation = FutureReservation;
//# sourceMappingURL=futureReservation.js.map