@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
169 lines • 9.56 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! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.InstanceFromMachineImage = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages a VM instance resource within GCE. For more information see
* [the official documentation](https://cloud.google.com/compute/docs/instances)
* and
* [API](https://cloud.google.com/compute/docs/reference/latest/instances).
*
* This resource is specifically to create a compute instance from a given
* `sourceMachineImage`. To create an instance without a machine image, use the
* `gcp.compute.Instance` resource.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const tpl = new gcp.compute.InstanceFromMachineImage("tpl", {
* name: "instance-from-machine-image",
* zone: "us-central1-a",
* sourceMachineImage: "projects/PROJECT-ID/global/machineImages/NAME",
* canIpForward: false,
* labels: {
* my_key: "my_value",
* },
* });
* ```
*/
class InstanceFromMachineImage extends pulumi.CustomResource {
/**
* Get an existing InstanceFromMachineImage 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 InstanceFromMachineImage(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of InstanceFromMachineImage. 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'] === InstanceFromMachineImage.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["advancedMachineFeatures"] = state?.advancedMachineFeatures;
resourceInputs["allowStoppingForUpdate"] = state?.allowStoppingForUpdate;
resourceInputs["attachedDisks"] = state?.attachedDisks;
resourceInputs["bootDisks"] = state?.bootDisks;
resourceInputs["canIpForward"] = state?.canIpForward;
resourceInputs["confidentialInstanceConfig"] = state?.confidentialInstanceConfig;
resourceInputs["cpuPlatform"] = state?.cpuPlatform;
resourceInputs["creationTimestamp"] = state?.creationTimestamp;
resourceInputs["currentStatus"] = state?.currentStatus;
resourceInputs["deletionProtection"] = state?.deletionProtection;
resourceInputs["description"] = state?.description;
resourceInputs["desiredStatus"] = state?.desiredStatus;
resourceInputs["effectiveLabels"] = state?.effectiveLabels;
resourceInputs["enableDisplay"] = state?.enableDisplay;
resourceInputs["guestAccelerators"] = state?.guestAccelerators;
resourceInputs["hostname"] = state?.hostname;
resourceInputs["instanceEncryptionKey"] = state?.instanceEncryptionKey;
resourceInputs["instanceId"] = state?.instanceId;
resourceInputs["keyRevocationActionType"] = state?.keyRevocationActionType;
resourceInputs["labelFingerprint"] = state?.labelFingerprint;
resourceInputs["labels"] = state?.labels;
resourceInputs["machineType"] = state?.machineType;
resourceInputs["metadata"] = state?.metadata;
resourceInputs["metadataFingerprint"] = state?.metadataFingerprint;
resourceInputs["metadataStartupScript"] = state?.metadataStartupScript;
resourceInputs["minCpuPlatform"] = state?.minCpuPlatform;
resourceInputs["name"] = state?.name;
resourceInputs["networkInterfaces"] = state?.networkInterfaces;
resourceInputs["networkPerformanceConfig"] = state?.networkPerformanceConfig;
resourceInputs["params"] = state?.params;
resourceInputs["partnerMetadata"] = state?.partnerMetadata;
resourceInputs["project"] = state?.project;
resourceInputs["pulumiLabels"] = state?.pulumiLabels;
resourceInputs["reservationAffinity"] = state?.reservationAffinity;
resourceInputs["resourcePolicies"] = state?.resourcePolicies;
resourceInputs["scheduling"] = state?.scheduling;
resourceInputs["scratchDisks"] = state?.scratchDisks;
resourceInputs["selfLink"] = state?.selfLink;
resourceInputs["serviceAccount"] = state?.serviceAccount;
resourceInputs["shieldedInstanceConfig"] = state?.shieldedInstanceConfig;
resourceInputs["sourceMachineImage"] = state?.sourceMachineImage;
resourceInputs["sourceMachineImageEncryptionKey"] = state?.sourceMachineImageEncryptionKey;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsFingerprint"] = state?.tagsFingerprint;
resourceInputs["zone"] = state?.zone;
}
else {
const args = argsOrState;
if (args?.sourceMachineImage === undefined && !opts.urn) {
throw new Error("Missing required property 'sourceMachineImage'");
}
resourceInputs["advancedMachineFeatures"] = args?.advancedMachineFeatures;
resourceInputs["allowStoppingForUpdate"] = args?.allowStoppingForUpdate;
resourceInputs["canIpForward"] = args?.canIpForward;
resourceInputs["confidentialInstanceConfig"] = args?.confidentialInstanceConfig;
resourceInputs["deletionProtection"] = args?.deletionProtection;
resourceInputs["description"] = args?.description;
resourceInputs["desiredStatus"] = args?.desiredStatus;
resourceInputs["enableDisplay"] = args?.enableDisplay;
resourceInputs["guestAccelerators"] = args?.guestAccelerators;
resourceInputs["hostname"] = args?.hostname;
resourceInputs["instanceEncryptionKey"] = args?.instanceEncryptionKey;
resourceInputs["keyRevocationActionType"] = args?.keyRevocationActionType;
resourceInputs["labels"] = args?.labels;
resourceInputs["machineType"] = args?.machineType;
resourceInputs["metadata"] = args?.metadata;
resourceInputs["metadataStartupScript"] = args?.metadataStartupScript;
resourceInputs["minCpuPlatform"] = args?.minCpuPlatform;
resourceInputs["name"] = args?.name;
resourceInputs["networkInterfaces"] = args?.networkInterfaces;
resourceInputs["networkPerformanceConfig"] = args?.networkPerformanceConfig;
resourceInputs["params"] = args?.params;
resourceInputs["partnerMetadata"] = args?.partnerMetadata;
resourceInputs["project"] = args?.project;
resourceInputs["reservationAffinity"] = args?.reservationAffinity;
resourceInputs["resourcePolicies"] = args?.resourcePolicies;
resourceInputs["scheduling"] = args?.scheduling;
resourceInputs["serviceAccount"] = args?.serviceAccount;
resourceInputs["shieldedInstanceConfig"] = args?.shieldedInstanceConfig;
resourceInputs["sourceMachineImage"] = args?.sourceMachineImage;
resourceInputs["sourceMachineImageEncryptionKey"] = args?.sourceMachineImageEncryptionKey;
resourceInputs["tags"] = args?.tags;
resourceInputs["zone"] = args?.zone;
resourceInputs["attachedDisks"] = undefined /*out*/;
resourceInputs["bootDisks"] = undefined /*out*/;
resourceInputs["cpuPlatform"] = undefined /*out*/;
resourceInputs["creationTimestamp"] = undefined /*out*/;
resourceInputs["currentStatus"] = undefined /*out*/;
resourceInputs["effectiveLabels"] = undefined /*out*/;
resourceInputs["instanceId"] = undefined /*out*/;
resourceInputs["labelFingerprint"] = undefined /*out*/;
resourceInputs["metadataFingerprint"] = undefined /*out*/;
resourceInputs["pulumiLabels"] = undefined /*out*/;
resourceInputs["scratchDisks"] = undefined /*out*/;
resourceInputs["selfLink"] = undefined /*out*/;
resourceInputs["tagsFingerprint"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(InstanceFromMachineImage.__pulumiType, name, resourceInputs, opts);
}
}
exports.InstanceFromMachineImage = InstanceFromMachineImage;
/** @internal */
InstanceFromMachineImage.__pulumiType = 'gcp:compute/instanceFromMachineImage:InstanceFromMachineImage';
//# sourceMappingURL=instanceFromMachineImage.js.map
;