@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
169 lines • 11 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** 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, Object.assign(Object.assign({}, 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 ? state.advancedMachineFeatures : undefined;
resourceInputs["allowStoppingForUpdate"] = state ? state.allowStoppingForUpdate : undefined;
resourceInputs["attachedDisks"] = state ? state.attachedDisks : undefined;
resourceInputs["bootDisks"] = state ? state.bootDisks : undefined;
resourceInputs["canIpForward"] = state ? state.canIpForward : undefined;
resourceInputs["confidentialInstanceConfig"] = state ? state.confidentialInstanceConfig : undefined;
resourceInputs["cpuPlatform"] = state ? state.cpuPlatform : undefined;
resourceInputs["creationTimestamp"] = state ? state.creationTimestamp : undefined;
resourceInputs["currentStatus"] = state ? state.currentStatus : undefined;
resourceInputs["deletionProtection"] = state ? state.deletionProtection : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["desiredStatus"] = state ? state.desiredStatus : undefined;
resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined;
resourceInputs["enableDisplay"] = state ? state.enableDisplay : undefined;
resourceInputs["guestAccelerators"] = state ? state.guestAccelerators : undefined;
resourceInputs["hostname"] = state ? state.hostname : undefined;
resourceInputs["instanceEncryptionKey"] = state ? state.instanceEncryptionKey : undefined;
resourceInputs["instanceId"] = state ? state.instanceId : undefined;
resourceInputs["keyRevocationActionType"] = state ? state.keyRevocationActionType : undefined;
resourceInputs["labelFingerprint"] = state ? state.labelFingerprint : undefined;
resourceInputs["labels"] = state ? state.labels : undefined;
resourceInputs["machineType"] = state ? state.machineType : undefined;
resourceInputs["metadata"] = state ? state.metadata : undefined;
resourceInputs["metadataFingerprint"] = state ? state.metadataFingerprint : undefined;
resourceInputs["metadataStartupScript"] = state ? state.metadataStartupScript : undefined;
resourceInputs["minCpuPlatform"] = state ? state.minCpuPlatform : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["networkInterfaces"] = state ? state.networkInterfaces : undefined;
resourceInputs["networkPerformanceConfig"] = state ? state.networkPerformanceConfig : undefined;
resourceInputs["params"] = state ? state.params : undefined;
resourceInputs["partnerMetadata"] = state ? state.partnerMetadata : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined;
resourceInputs["reservationAffinity"] = state ? state.reservationAffinity : undefined;
resourceInputs["resourcePolicies"] = state ? state.resourcePolicies : undefined;
resourceInputs["scheduling"] = state ? state.scheduling : undefined;
resourceInputs["scratchDisks"] = state ? state.scratchDisks : undefined;
resourceInputs["selfLink"] = state ? state.selfLink : undefined;
resourceInputs["serviceAccount"] = state ? state.serviceAccount : undefined;
resourceInputs["shieldedInstanceConfig"] = state ? state.shieldedInstanceConfig : undefined;
resourceInputs["sourceMachineImage"] = state ? state.sourceMachineImage : undefined;
resourceInputs["sourceMachineImageEncryptionKey"] = state ? state.sourceMachineImageEncryptionKey : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["tagsFingerprint"] = state ? state.tagsFingerprint : undefined;
resourceInputs["zone"] = state ? state.zone : undefined;
}
else {
const args = argsOrState;
if ((!args || args.sourceMachineImage === undefined) && !opts.urn) {
throw new Error("Missing required property 'sourceMachineImage'");
}
resourceInputs["advancedMachineFeatures"] = args ? args.advancedMachineFeatures : undefined;
resourceInputs["allowStoppingForUpdate"] = args ? args.allowStoppingForUpdate : undefined;
resourceInputs["canIpForward"] = args ? args.canIpForward : undefined;
resourceInputs["confidentialInstanceConfig"] = args ? args.confidentialInstanceConfig : undefined;
resourceInputs["deletionProtection"] = args ? args.deletionProtection : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["desiredStatus"] = args ? args.desiredStatus : undefined;
resourceInputs["enableDisplay"] = args ? args.enableDisplay : undefined;
resourceInputs["guestAccelerators"] = args ? args.guestAccelerators : undefined;
resourceInputs["hostname"] = args ? args.hostname : undefined;
resourceInputs["instanceEncryptionKey"] = args ? args.instanceEncryptionKey : undefined;
resourceInputs["keyRevocationActionType"] = args ? args.keyRevocationActionType : undefined;
resourceInputs["labels"] = args ? args.labels : undefined;
resourceInputs["machineType"] = args ? args.machineType : undefined;
resourceInputs["metadata"] = args ? args.metadata : undefined;
resourceInputs["metadataStartupScript"] = args ? args.metadataStartupScript : undefined;
resourceInputs["minCpuPlatform"] = args ? args.minCpuPlatform : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["networkInterfaces"] = args ? args.networkInterfaces : undefined;
resourceInputs["networkPerformanceConfig"] = args ? args.networkPerformanceConfig : undefined;
resourceInputs["params"] = args ? args.params : undefined;
resourceInputs["partnerMetadata"] = args ? args.partnerMetadata : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["reservationAffinity"] = args ? args.reservationAffinity : undefined;
resourceInputs["resourcePolicies"] = args ? args.resourcePolicies : undefined;
resourceInputs["scheduling"] = args ? args.scheduling : undefined;
resourceInputs["serviceAccount"] = args ? args.serviceAccount : undefined;
resourceInputs["shieldedInstanceConfig"] = args ? args.shieldedInstanceConfig : undefined;
resourceInputs["sourceMachineImage"] = args ? args.sourceMachineImage : undefined;
resourceInputs["sourceMachineImageEncryptionKey"] = args ? args.sourceMachineImageEncryptionKey : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["zone"] = args ? args.zone : undefined;
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