import * as pulumi from "@pulumi/pulumi"; /** * Manages attaching a Disk to a Virtual Machine. * * > **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. * * > **Please Note:** only Managed Disks are supported via this separate resource, Unmanaged Disks can be attached using the `storageDataDisk` block in the `azure.compute.VirtualMachine` resource. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azure from "@pulumi/azure"; * * const config = new pulumi.Config(); * const prefix = config.get("prefix") || "example"; * const vmName = `${prefix}-vm`; * 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: "internal", * subnetId: internal.id, * privateIpAddressAllocation: "Dynamic", * }], * }); * const exampleVirtualMachine = new azure.compute.VirtualMachine("example", { * name: vmName, * location: example.location, * resourceGroupName: example.name, * networkInterfaceIds: [mainNetworkInterface.id], * vmSize: "Standard_F2", * 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: vmName, * adminUsername: "testadmin", * adminPassword: "Password1234!", * }, * osProfileLinuxConfig: { * disablePasswordAuthentication: false, * }, * }); * const exampleManagedDisk = new azure.compute.ManagedDisk("example", { * name: `${vmName}-disk1`, * location: example.location, * resourceGroupName: example.name, * storageAccountType: "Standard_LRS", * createOption: "Empty", * diskSizeGb: 10, * }); * const exampleDataDiskAttachment = new azure.compute.DataDiskAttachment("example", { * managedDiskId: exampleManagedDisk.id, * virtualMachineId: exampleVirtualMachine.id, * lun: 10, * caching: "ReadWrite", * }); * ``` * * ## API Providers * * * This resource uses the following Azure API Providers: * * * `Microsoft.Compute` - 2024-03-01, 2023-04-02 * * ## Import * * Virtual Machines Data Disk Attachments can be imported using the `resource id`, e.g. * * ```sh * $ pulumi import azure:compute/dataDiskAttachment:DataDiskAttachment example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Compute/virtualMachines/machine1/dataDisks/disk1 * ``` * * > **Note:** This is provider-specific ID matching the format: `{virtualMachineID}/dataDisks/{diskName}` */ export declare class DataDiskAttachment extends pulumi.CustomResource { /** * Get an existing DataDiskAttachment 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: string, id: pulumi.Input, state?: DataDiskAttachmentState, opts?: pulumi.CustomResourceOptions): DataDiskAttachment; /** * Returns true if the given object is an instance of DataDiskAttachment. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is DataDiskAttachment; /** * Specifies the caching requirements for this Data Disk. Possible values include `None`, `ReadOnly` and `ReadWrite`. */ readonly caching: pulumi.Output; /** * The Create Option of the Data Disk, such as `Empty` or `Attach`. Defaults to `Attach`. Changing this forces a new resource to be created. */ readonly createOption: pulumi.Output; /** * The Logical Unit Number of the Data Disk, which needs to be unique within the Virtual Machine. Changing this forces a new resource to be created. */ readonly lun: pulumi.Output; /** * The ID of an existing Managed Disk which should be attached. Changing this forces a new resource to be created. */ readonly managedDiskId: pulumi.Output; /** * The ID of the Virtual Machine to which the Data Disk should be attached. Changing this forces a new resource to be created. */ readonly virtualMachineId: pulumi.Output; /** * Specifies if Write Accelerator is enabled on the disk. This can only be enabled on `Premium_LRS` managed disks with no caching and [M-Series VMs](https://docs.microsoft.com/azure/virtual-machines/workloads/sap/how-to-enable-write-accelerator). Defaults to `false`. */ readonly writeAcceleratorEnabled: pulumi.Output; /** * Create a DataDiskAttachment resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: DataDiskAttachmentArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering DataDiskAttachment resources. */ export interface DataDiskAttachmentState { /** * Specifies the caching requirements for this Data Disk. Possible values include `None`, `ReadOnly` and `ReadWrite`. */ caching?: pulumi.Input; /** * The Create Option of the Data Disk, such as `Empty` or `Attach`. Defaults to `Attach`. Changing this forces a new resource to be created. */ createOption?: pulumi.Input; /** * The Logical Unit Number of the Data Disk, which needs to be unique within the Virtual Machine. Changing this forces a new resource to be created. */ lun?: pulumi.Input; /** * The ID of an existing Managed Disk which should be attached. Changing this forces a new resource to be created. */ managedDiskId?: pulumi.Input; /** * The ID of the Virtual Machine to which the Data Disk should be attached. Changing this forces a new resource to be created. */ virtualMachineId?: pulumi.Input; /** * Specifies if Write Accelerator is enabled on the disk. This can only be enabled on `Premium_LRS` managed disks with no caching and [M-Series VMs](https://docs.microsoft.com/azure/virtual-machines/workloads/sap/how-to-enable-write-accelerator). Defaults to `false`. */ writeAcceleratorEnabled?: pulumi.Input; } /** * The set of arguments for constructing a DataDiskAttachment resource. */ export interface DataDiskAttachmentArgs { /** * Specifies the caching requirements for this Data Disk. Possible values include `None`, `ReadOnly` and `ReadWrite`. */ caching: pulumi.Input; /** * The Create Option of the Data Disk, such as `Empty` or `Attach`. Defaults to `Attach`. Changing this forces a new resource to be created. */ createOption?: pulumi.Input; /** * The Logical Unit Number of the Data Disk, which needs to be unique within the Virtual Machine. Changing this forces a new resource to be created. */ lun: pulumi.Input; /** * The ID of an existing Managed Disk which should be attached. Changing this forces a new resource to be created. */ managedDiskId: pulumi.Input; /** * The ID of the Virtual Machine to which the Data Disk should be attached. Changing this forces a new resource to be created. */ virtualMachineId: pulumi.Input; /** * Specifies if Write Accelerator is enabled on the disk. This can only be enabled on `Premium_LRS` managed disks with no caching and [M-Series VMs](https://docs.microsoft.com/azure/virtual-machines/workloads/sap/how-to-enable-write-accelerator). Defaults to `false`. */ writeAcceleratorEnabled?: pulumi.Input; }