"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! ***
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.VirtualMachine = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * Manages a Virtual Machine.
 *
 * ## Disclaimers
 *
 * > **Note:** The `azure.compute.VirtualMachine` resource has been superseded by the `azure.compute.LinuxVirtualMachine` and `azure.compute.WindowsVirtualMachine` resources. The existing `azure.compute.VirtualMachine` resource will continue to be available throughout the 2.x releases however is in a feature-frozen state to maintain compatibility - new functionality will instead be added to the `azure.compute.LinuxVirtualMachine` and `azure.compute.WindowsVirtualMachine` resources.
 *
 * > **Note:** Data Disks can be attached either directly on the `azure.compute.VirtualMachine` resource, or using the `azure.compute.DataDiskAttachment` resource - but the two cannot be used together. If both are used against the same Virtual Machine, spurious changes will occur.
 *
 * ## Example Usage
 *
 * ### From An Azure Platform Image)
 *
 * This example provisions a Virtual Machine with Managed Disks.
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 *
 * const config = new pulumi.Config();
 * const prefix = config.get("prefix") || "tfvmex";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: `${prefix}-resources`,
 *     location: "West Europe",
 * });
 * const main = new azure.network.VirtualNetwork("main", {
 *     name: `${prefix}-network`,
 *     addressSpaces: ["10.0.0.0/16"],
 *     location: example.location,
 *     resourceGroupName: example.name,
 * });
 * const internal = new azure.network.Subnet("internal", {
 *     name: "internal",
 *     resourceGroupName: example.name,
 *     virtualNetworkName: main.name,
 *     addressPrefixes: ["10.0.2.0/24"],
 * });
 * const mainNetworkInterface = new azure.network.NetworkInterface("main", {
 *     name: `${prefix}-nic`,
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     ipConfigurations: [{
 *         name: "testconfiguration1",
 *         subnetId: internal.id,
 *         privateIpAddressAllocation: "Dynamic",
 *     }],
 * });
 * const mainVirtualMachine = new azure.compute.VirtualMachine("main", {
 *     name: `${prefix}-vm`,
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     networkInterfaceIds: [mainNetworkInterface.id],
 *     vmSize: "Standard_DS1_v2",
 *     storageImageReference: {
 *         publisher: "Canonical",
 *         offer: "0001-com-ubuntu-server-jammy",
 *         sku: "22_04-lts",
 *         version: "latest",
 *     },
 *     storageOsDisk: {
 *         name: "myosdisk1",
 *         caching: "ReadWrite",
 *         createOption: "FromImage",
 *         managedDiskType: "Standard_LRS",
 *     },
 *     osProfile: {
 *         computerName: "hostname",
 *         adminUsername: "testadmin",
 *         adminPassword: "Password1234!",
 *     },
 *     osProfileLinuxConfig: {
 *         disablePasswordAuthentication: false,
 *     },
 *     tags: {
 *         environment: "staging",
 *     },
 * });
 * ```
 *
 * ## API Providers
 *
 * <!-- This section is generated, changes will be overwritten -->
 * This resource uses the following Azure API Providers:
 *
 * * `Microsoft.Compute` - 2024-03-01, 2023-04-02
 *
 * * `Microsoft.Network` - 2025-01-01
 *
 * ## Import
 *
 * Virtual Machines can be imported using the `resource id`, e.g.
 *
 * ```sh
 * $ pulumi import azure:compute/virtualMachine:VirtualMachine example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Compute/virtualMachines/machine1
 * ```
 */
class VirtualMachine extends pulumi.CustomResource {
    /**
     * Get an existing VirtualMachine 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 VirtualMachine(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'azure:compute/virtualMachine:VirtualMachine';
    /**
     * Returns true if the given object is an instance of VirtualMachine.  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'] === VirtualMachine.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["additionalCapabilities"] = state?.additionalCapabilities;
            resourceInputs["availabilitySetId"] = state?.availabilitySetId;
            resourceInputs["bootDiagnostics"] = state?.bootDiagnostics;
            resourceInputs["deleteDataDisksOnTermination"] = state?.deleteDataDisksOnTermination;
            resourceInputs["deleteOsDiskOnTermination"] = state?.deleteOsDiskOnTermination;
            resourceInputs["identity"] = state?.identity;
            resourceInputs["licenseType"] = state?.licenseType;
            resourceInputs["location"] = state?.location;
            resourceInputs["name"] = state?.name;
            resourceInputs["networkInterfaceIds"] = state?.networkInterfaceIds;
            resourceInputs["osProfile"] = state?.osProfile;
            resourceInputs["osProfileLinuxConfig"] = state?.osProfileLinuxConfig;
            resourceInputs["osProfileSecrets"] = state?.osProfileSecrets;
            resourceInputs["osProfileWindowsConfig"] = state?.osProfileWindowsConfig;
            resourceInputs["plan"] = state?.plan;
            resourceInputs["primaryNetworkInterfaceId"] = state?.primaryNetworkInterfaceId;
            resourceInputs["proximityPlacementGroupId"] = state?.proximityPlacementGroupId;
            resourceInputs["resourceGroupName"] = state?.resourceGroupName;
            resourceInputs["storageDataDisks"] = state?.storageDataDisks;
            resourceInputs["storageImageReference"] = state?.storageImageReference;
            resourceInputs["storageOsDisk"] = state?.storageOsDisk;
            resourceInputs["tags"] = state?.tags;
            resourceInputs["vmSize"] = state?.vmSize;
            resourceInputs["zones"] = state?.zones;
        }
        else {
            const args = argsOrState;
            if (args?.networkInterfaceIds === undefined && !opts.urn) {
                throw new Error("Missing required property 'networkInterfaceIds'");
            }
            if (args?.resourceGroupName === undefined && !opts.urn) {
                throw new Error("Missing required property 'resourceGroupName'");
            }
            if (args?.storageOsDisk === undefined && !opts.urn) {
                throw new Error("Missing required property 'storageOsDisk'");
            }
            if (args?.vmSize === undefined && !opts.urn) {
                throw new Error("Missing required property 'vmSize'");
            }
            resourceInputs["additionalCapabilities"] = args?.additionalCapabilities;
            resourceInputs["availabilitySetId"] = args?.availabilitySetId;
            resourceInputs["bootDiagnostics"] = args?.bootDiagnostics;
            resourceInputs["deleteDataDisksOnTermination"] = args?.deleteDataDisksOnTermination;
            resourceInputs["deleteOsDiskOnTermination"] = args?.deleteOsDiskOnTermination;
            resourceInputs["identity"] = args?.identity;
            resourceInputs["licenseType"] = args?.licenseType;
            resourceInputs["location"] = args?.location;
            resourceInputs["name"] = args?.name;
            resourceInputs["networkInterfaceIds"] = args?.networkInterfaceIds;
            resourceInputs["osProfile"] = args?.osProfile;
            resourceInputs["osProfileLinuxConfig"] = args?.osProfileLinuxConfig;
            resourceInputs["osProfileSecrets"] = args?.osProfileSecrets;
            resourceInputs["osProfileWindowsConfig"] = args?.osProfileWindowsConfig;
            resourceInputs["plan"] = args?.plan;
            resourceInputs["primaryNetworkInterfaceId"] = args?.primaryNetworkInterfaceId;
            resourceInputs["proximityPlacementGroupId"] = args?.proximityPlacementGroupId;
            resourceInputs["resourceGroupName"] = args?.resourceGroupName;
            resourceInputs["storageDataDisks"] = args?.storageDataDisks;
            resourceInputs["storageImageReference"] = args?.storageImageReference;
            resourceInputs["storageOsDisk"] = args?.storageOsDisk;
            resourceInputs["tags"] = args?.tags;
            resourceInputs["vmSize"] = args?.vmSize;
            resourceInputs["zones"] = args?.zones;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(VirtualMachine.__pulumiType, name, resourceInputs, opts);
    }
}
exports.VirtualMachine = VirtualMachine;
//# sourceMappingURL=virtualMachine.js.map