"use strict";
// *** 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.Instance = 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).
 *
 * ## Example Usage
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const _default = new gcp.serviceaccount.Account("default", {
 *     accountId: "my-custom-sa",
 *     displayName: "Custom SA for VM Instance",
 * });
 * const defaultInstance = new gcp.compute.Instance("default", {
 *     networkInterfaces: [{
 *         accessConfigs: [{}],
 *         network: "default",
 *     }],
 *     name: "my-instance",
 *     machineType: "n2-standard-2",
 *     zone: "us-central1-a",
 *     tags: [
 *         "foo",
 *         "bar",
 *     ],
 *     bootDisk: {
 *         initializeParams: {
 *             image: "debian-cloud/debian-11",
 *             labels: {
 *                 my_label: "value",
 *             },
 *         },
 *     },
 *     scratchDisks: [{
 *         "interface": "NVME",
 *     }],
 *     metadata: {
 *         foo: "bar",
 *     },
 *     metadataStartupScript: "echo hi > /test.txt",
 *     serviceAccount: {
 *         email: _default.email,
 *         scopes: ["cloud-platform"],
 *     },
 * });
 * ```
 *
 * ### Confidential Computing
 *
 * Example with [Confidential Mode](https://cloud.google.com/confidential-computing/confidential-vm/docs/confidential-vm-overview) activated.
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const _default = new gcp.serviceaccount.Account("default", {
 *     accountId: "my-custom-sa",
 *     displayName: "Custom SA for VM Instance",
 * });
 * const confidentialInstance = new gcp.compute.Instance("confidential_instance", {
 *     networkInterfaces: [{
 *         accessConfigs: [{}],
 *         network: "default",
 *     }],
 *     name: "my-confidential-instance",
 *     zone: "us-central1-a",
 *     machineType: "n2d-standard-2",
 *     minCpuPlatform: "AMD Milan",
 *     confidentialInstanceConfig: {
 *         enableConfidentialCompute: true,
 *         confidentialInstanceType: "SEV",
 *     },
 *     bootDisk: {
 *         initializeParams: {
 *             image: "ubuntu-os-cloud/ubuntu-2204-lts",
 *             labels: {
 *                 my_label: "value",
 *             },
 *         },
 *     },
 *     scratchDisks: [{
 *         "interface": "NVME",
 *     }],
 *     serviceAccount: {
 *         email: _default.email,
 *         scopes: ["cloud-platform"],
 *     },
 * });
 * ```
 *
 * ## Import
 *
 * Instances can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/zones/{{zone}}/instances/{{name}}`
 *
 * * `{{project}}/{{zone}}/{{name}}`
 *
 * * `{{name}}`
 *
 * When using the `pulumi import` command, instances can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:compute/instance:Instance default projects/{{project}}/zones/{{zone}}/instances/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/instance:Instance default {{project}}/{{zone}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/instance:Instance default {{name}}
 * ```
 */
class Instance extends pulumi.CustomResource {
    /**
     * Get an existing Instance 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 Instance(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of Instance.  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'] === Instance.__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["bootDisk"] = state?.bootDisk;
            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["tags"] = state?.tags;
            resourceInputs["tagsFingerprint"] = state?.tagsFingerprint;
            resourceInputs["zone"] = state?.zone;
        }
        else {
            const args = argsOrState;
            if (args?.bootDisk === undefined && !opts.urn) {
                throw new Error("Missing required property 'bootDisk'");
            }
            if (args?.machineType === undefined && !opts.urn) {
                throw new Error("Missing required property 'machineType'");
            }
            if (args?.networkInterfaces === undefined && !opts.urn) {
                throw new Error("Missing required property 'networkInterfaces'");
            }
            resourceInputs["advancedMachineFeatures"] = args?.advancedMachineFeatures;
            resourceInputs["allowStoppingForUpdate"] = args?.allowStoppingForUpdate;
            resourceInputs["attachedDisks"] = args?.attachedDisks;
            resourceInputs["bootDisk"] = args?.bootDisk;
            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["scratchDisks"] = args?.scratchDisks;
            resourceInputs["serviceAccount"] = args?.serviceAccount;
            resourceInputs["shieldedInstanceConfig"] = args?.shieldedInstanceConfig;
            resourceInputs["tags"] = args?.tags;
            resourceInputs["zone"] = args?.zone;
            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["selfLink"] = undefined /*out*/;
            resourceInputs["tagsFingerprint"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
        opts = pulumi.mergeOptions(opts, secretOpts);
        super(Instance.__pulumiType, name, resourceInputs, opts);
    }
}
exports.Instance = Instance;
/** @internal */
Instance.__pulumiType = 'gcp:compute/instance:Instance';
//# sourceMappingURL=instance.js.map