We recommend using Azure Native.
azure.compute.DataDiskAttachment
Explore with Pulumi AI
Manages attaching a Disk to a Virtual Machine.
NOTE: Data Disks can be attached either directly on the
azure.compute.VirtualMachine
resource, or using theazure.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
storage_data_disk
block in theazure.compute.VirtualMachine
resource.
Example Usage
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",
});
import pulumi
import pulumi_azure as azure
config = pulumi.Config()
prefix = config.get("prefix")
if prefix is None:
prefix = "example"
vm_name = f"{prefix}-vm"
example = azure.core.ResourceGroup("example",
name=f"{prefix}-resources",
location="West Europe")
main = azure.network.VirtualNetwork("main",
name=f"{prefix}-network",
address_spaces=["10.0.0.0/16"],
location=example.location,
resource_group_name=example.name)
internal = azure.network.Subnet("internal",
name="internal",
resource_group_name=example.name,
virtual_network_name=main.name,
address_prefixes=["10.0.2.0/24"])
main_network_interface = azure.network.NetworkInterface("main",
name=f"{prefix}-nic",
location=example.location,
resource_group_name=example.name,
ip_configurations=[{
"name": "internal",
"subnet_id": internal.id,
"private_ip_address_allocation": "Dynamic",
}])
example_virtual_machine = azure.compute.VirtualMachine("example",
name=vm_name,
location=example.location,
resource_group_name=example.name,
network_interface_ids=[main_network_interface.id],
vm_size="Standard_F2",
storage_image_reference={
"publisher": "Canonical",
"offer": "0001-com-ubuntu-server-jammy",
"sku": "22_04-lts",
"version": "latest",
},
storage_os_disk={
"name": "myosdisk1",
"caching": "ReadWrite",
"create_option": "FromImage",
"managed_disk_type": "Standard_LRS",
},
os_profile={
"computer_name": vm_name,
"admin_username": "testadmin",
"admin_password": "Password1234!",
},
os_profile_linux_config={
"disable_password_authentication": False,
})
example_managed_disk = azure.compute.ManagedDisk("example",
name=f"{vm_name}-disk1",
location=example.location,
resource_group_name=example.name,
storage_account_type="Standard_LRS",
create_option="Empty",
disk_size_gb=10)
example_data_disk_attachment = azure.compute.DataDiskAttachment("example",
managed_disk_id=example_managed_disk.id,
virtual_machine_id=example_virtual_machine.id,
lun=10,
caching="ReadWrite")
package main
import (
"fmt"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/compute"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/network"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
prefix := "example"
if param := cfg.Get("prefix"); param != "" {
prefix = param
}
vmName := fmt.Sprintf("%v-vm", prefix)
example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
Name: pulumi.Sprintf("%v-resources", prefix),
Location: pulumi.String("West Europe"),
})
if err != nil {
return err
}
main, err := network.NewVirtualNetwork(ctx, "main", &network.VirtualNetworkArgs{
Name: pulumi.Sprintf("%v-network", prefix),
AddressSpaces: pulumi.StringArray{
pulumi.String("10.0.0.0/16"),
},
Location: example.Location,
ResourceGroupName: example.Name,
})
if err != nil {
return err
}
internal, err := network.NewSubnet(ctx, "internal", &network.SubnetArgs{
Name: pulumi.String("internal"),
ResourceGroupName: example.Name,
VirtualNetworkName: main.Name,
AddressPrefixes: pulumi.StringArray{
pulumi.String("10.0.2.0/24"),
},
})
if err != nil {
return err
}
mainNetworkInterface, err := network.NewNetworkInterface(ctx, "main", &network.NetworkInterfaceArgs{
Name: pulumi.Sprintf("%v-nic", prefix),
Location: example.Location,
ResourceGroupName: example.Name,
IpConfigurations: network.NetworkInterfaceIpConfigurationArray{
&network.NetworkInterfaceIpConfigurationArgs{
Name: pulumi.String("internal"),
SubnetId: internal.ID(),
PrivateIpAddressAllocation: pulumi.String("Dynamic"),
},
},
})
if err != nil {
return err
}
exampleVirtualMachine, err := compute.NewVirtualMachine(ctx, "example", &compute.VirtualMachineArgs{
Name: pulumi.String(vmName),
Location: example.Location,
ResourceGroupName: example.Name,
NetworkInterfaceIds: pulumi.StringArray{
mainNetworkInterface.ID(),
},
VmSize: pulumi.String("Standard_F2"),
StorageImageReference: &compute.VirtualMachineStorageImageReferenceArgs{
Publisher: pulumi.String("Canonical"),
Offer: pulumi.String("0001-com-ubuntu-server-jammy"),
Sku: pulumi.String("22_04-lts"),
Version: pulumi.String("latest"),
},
StorageOsDisk: &compute.VirtualMachineStorageOsDiskArgs{
Name: pulumi.String("myosdisk1"),
Caching: pulumi.String("ReadWrite"),
CreateOption: pulumi.String("FromImage"),
ManagedDiskType: pulumi.String("Standard_LRS"),
},
OsProfile: &compute.VirtualMachineOsProfileArgs{
ComputerName: pulumi.String(vmName),
AdminUsername: pulumi.String("testadmin"),
AdminPassword: pulumi.String("Password1234!"),
},
OsProfileLinuxConfig: &compute.VirtualMachineOsProfileLinuxConfigArgs{
DisablePasswordAuthentication: pulumi.Bool(false),
},
})
if err != nil {
return err
}
exampleManagedDisk, err := compute.NewManagedDisk(ctx, "example", &compute.ManagedDiskArgs{
Name: pulumi.Sprintf("%v-disk1", vmName),
Location: example.Location,
ResourceGroupName: example.Name,
StorageAccountType: pulumi.String("Standard_LRS"),
CreateOption: pulumi.String("Empty"),
DiskSizeGb: pulumi.Int(10),
})
if err != nil {
return err
}
_, err = compute.NewDataDiskAttachment(ctx, "example", &compute.DataDiskAttachmentArgs{
ManagedDiskId: exampleManagedDisk.ID(),
VirtualMachineId: exampleVirtualMachine.ID(),
Lun: pulumi.Int(10),
Caching: pulumi.String("ReadWrite"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var prefix = config.Get("prefix") ?? "example";
var vmName = $"{prefix}-vm";
var example = new Azure.Core.ResourceGroup("example", new()
{
Name = $"{prefix}-resources",
Location = "West Europe",
});
var main = new Azure.Network.VirtualNetwork("main", new()
{
Name = $"{prefix}-network",
AddressSpaces = new[]
{
"10.0.0.0/16",
},
Location = example.Location,
ResourceGroupName = example.Name,
});
var @internal = new Azure.Network.Subnet("internal", new()
{
Name = "internal",
ResourceGroupName = example.Name,
VirtualNetworkName = main.Name,
AddressPrefixes = new[]
{
"10.0.2.0/24",
},
});
var mainNetworkInterface = new Azure.Network.NetworkInterface("main", new()
{
Name = $"{prefix}-nic",
Location = example.Location,
ResourceGroupName = example.Name,
IpConfigurations = new[]
{
new Azure.Network.Inputs.NetworkInterfaceIpConfigurationArgs
{
Name = "internal",
SubnetId = @internal.Id,
PrivateIpAddressAllocation = "Dynamic",
},
},
});
var exampleVirtualMachine = new Azure.Compute.VirtualMachine("example", new()
{
Name = vmName,
Location = example.Location,
ResourceGroupName = example.Name,
NetworkInterfaceIds = new[]
{
mainNetworkInterface.Id,
},
VmSize = "Standard_F2",
StorageImageReference = new Azure.Compute.Inputs.VirtualMachineStorageImageReferenceArgs
{
Publisher = "Canonical",
Offer = "0001-com-ubuntu-server-jammy",
Sku = "22_04-lts",
Version = "latest",
},
StorageOsDisk = new Azure.Compute.Inputs.VirtualMachineStorageOsDiskArgs
{
Name = "myosdisk1",
Caching = "ReadWrite",
CreateOption = "FromImage",
ManagedDiskType = "Standard_LRS",
},
OsProfile = new Azure.Compute.Inputs.VirtualMachineOsProfileArgs
{
ComputerName = vmName,
AdminUsername = "testadmin",
AdminPassword = "Password1234!",
},
OsProfileLinuxConfig = new Azure.Compute.Inputs.VirtualMachineOsProfileLinuxConfigArgs
{
DisablePasswordAuthentication = false,
},
});
var exampleManagedDisk = new Azure.Compute.ManagedDisk("example", new()
{
Name = $"{vmName}-disk1",
Location = example.Location,
ResourceGroupName = example.Name,
StorageAccountType = "Standard_LRS",
CreateOption = "Empty",
DiskSizeGb = 10,
});
var exampleDataDiskAttachment = new Azure.Compute.DataDiskAttachment("example", new()
{
ManagedDiskId = exampleManagedDisk.Id,
VirtualMachineId = exampleVirtualMachine.Id,
Lun = 10,
Caching = "ReadWrite",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.network.VirtualNetwork;
import com.pulumi.azure.network.VirtualNetworkArgs;
import com.pulumi.azure.network.Subnet;
import com.pulumi.azure.network.SubnetArgs;
import com.pulumi.azure.network.NetworkInterface;
import com.pulumi.azure.network.NetworkInterfaceArgs;
import com.pulumi.azure.network.inputs.NetworkInterfaceIpConfigurationArgs;
import com.pulumi.azure.compute.VirtualMachine;
import com.pulumi.azure.compute.VirtualMachineArgs;
import com.pulumi.azure.compute.inputs.VirtualMachineStorageImageReferenceArgs;
import com.pulumi.azure.compute.inputs.VirtualMachineStorageOsDiskArgs;
import com.pulumi.azure.compute.inputs.VirtualMachineOsProfileArgs;
import com.pulumi.azure.compute.inputs.VirtualMachineOsProfileLinuxConfigArgs;
import com.pulumi.azure.compute.ManagedDisk;
import com.pulumi.azure.compute.ManagedDiskArgs;
import com.pulumi.azure.compute.DataDiskAttachment;
import com.pulumi.azure.compute.DataDiskAttachmentArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var config = ctx.config();
final var prefix = config.get("prefix").orElse("example");
final var vmName = String.format("%s-vm", prefix);
var example = new ResourceGroup("example", ResourceGroupArgs.builder()
.name(String.format("%s-resources", prefix))
.location("West Europe")
.build());
var main = new VirtualNetwork("main", VirtualNetworkArgs.builder()
.name(String.format("%s-network", prefix))
.addressSpaces("10.0.0.0/16")
.location(example.location())
.resourceGroupName(example.name())
.build());
var internal = new Subnet("internal", SubnetArgs.builder()
.name("internal")
.resourceGroupName(example.name())
.virtualNetworkName(main.name())
.addressPrefixes("10.0.2.0/24")
.build());
var mainNetworkInterface = new NetworkInterface("mainNetworkInterface", NetworkInterfaceArgs.builder()
.name(String.format("%s-nic", prefix))
.location(example.location())
.resourceGroupName(example.name())
.ipConfigurations(NetworkInterfaceIpConfigurationArgs.builder()
.name("internal")
.subnetId(internal.id())
.privateIpAddressAllocation("Dynamic")
.build())
.build());
var exampleVirtualMachine = new VirtualMachine("exampleVirtualMachine", VirtualMachineArgs.builder()
.name(vmName)
.location(example.location())
.resourceGroupName(example.name())
.networkInterfaceIds(mainNetworkInterface.id())
.vmSize("Standard_F2")
.storageImageReference(VirtualMachineStorageImageReferenceArgs.builder()
.publisher("Canonical")
.offer("0001-com-ubuntu-server-jammy")
.sku("22_04-lts")
.version("latest")
.build())
.storageOsDisk(VirtualMachineStorageOsDiskArgs.builder()
.name("myosdisk1")
.caching("ReadWrite")
.createOption("FromImage")
.managedDiskType("Standard_LRS")
.build())
.osProfile(VirtualMachineOsProfileArgs.builder()
.computerName(vmName)
.adminUsername("testadmin")
.adminPassword("Password1234!")
.build())
.osProfileLinuxConfig(VirtualMachineOsProfileLinuxConfigArgs.builder()
.disablePasswordAuthentication(false)
.build())
.build());
var exampleManagedDisk = new ManagedDisk("exampleManagedDisk", ManagedDiskArgs.builder()
.name(String.format("%s-disk1", vmName))
.location(example.location())
.resourceGroupName(example.name())
.storageAccountType("Standard_LRS")
.createOption("Empty")
.diskSizeGb(10)
.build());
var exampleDataDiskAttachment = new DataDiskAttachment("exampleDataDiskAttachment", DataDiskAttachmentArgs.builder()
.managedDiskId(exampleManagedDisk.id())
.virtualMachineId(exampleVirtualMachine.id())
.lun("10")
.caching("ReadWrite")
.build());
}
}
configuration:
prefix:
type: string
default: example
resources:
example:
type: azure:core:ResourceGroup
properties:
name: ${prefix}-resources
location: West Europe
main:
type: azure:network:VirtualNetwork
properties:
name: ${prefix}-network
addressSpaces:
- 10.0.0.0/16
location: ${example.location}
resourceGroupName: ${example.name}
internal:
type: azure:network:Subnet
properties:
name: internal
resourceGroupName: ${example.name}
virtualNetworkName: ${main.name}
addressPrefixes:
- 10.0.2.0/24
mainNetworkInterface:
type: azure:network:NetworkInterface
name: main
properties:
name: ${prefix}-nic
location: ${example.location}
resourceGroupName: ${example.name}
ipConfigurations:
- name: internal
subnetId: ${internal.id}
privateIpAddressAllocation: Dynamic
exampleVirtualMachine:
type: azure:compute:VirtualMachine
name: example
properties:
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
exampleManagedDisk:
type: azure:compute:ManagedDisk
name: example
properties:
name: ${vmName}-disk1
location: ${example.location}
resourceGroupName: ${example.name}
storageAccountType: Standard_LRS
createOption: Empty
diskSizeGb: 10
exampleDataDiskAttachment:
type: azure:compute:DataDiskAttachment
name: example
properties:
managedDiskId: ${exampleManagedDisk.id}
virtualMachineId: ${exampleVirtualMachine.id}
lun: '10'
caching: ReadWrite
variables:
vmName: ${prefix}-vm
Create DataDiskAttachment Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new DataDiskAttachment(name: string, args: DataDiskAttachmentArgs, opts?: CustomResourceOptions);
@overload
def DataDiskAttachment(resource_name: str,
args: DataDiskAttachmentArgs,
opts: Optional[ResourceOptions] = None)
@overload
def DataDiskAttachment(resource_name: str,
opts: Optional[ResourceOptions] = None,
caching: Optional[str] = None,
lun: Optional[int] = None,
managed_disk_id: Optional[str] = None,
virtual_machine_id: Optional[str] = None,
create_option: Optional[str] = None,
write_accelerator_enabled: Optional[bool] = None)
func NewDataDiskAttachment(ctx *Context, name string, args DataDiskAttachmentArgs, opts ...ResourceOption) (*DataDiskAttachment, error)
public DataDiskAttachment(string name, DataDiskAttachmentArgs args, CustomResourceOptions? opts = null)
public DataDiskAttachment(String name, DataDiskAttachmentArgs args)
public DataDiskAttachment(String name, DataDiskAttachmentArgs args, CustomResourceOptions options)
type: azure:compute:DataDiskAttachment
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args DataDiskAttachmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args DataDiskAttachmentArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args DataDiskAttachmentArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args DataDiskAttachmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args DataDiskAttachmentArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var dataDiskAttachmentResource = new Azure.Compute.DataDiskAttachment("dataDiskAttachmentResource", new()
{
Caching = "string",
Lun = 0,
ManagedDiskId = "string",
VirtualMachineId = "string",
CreateOption = "string",
WriteAcceleratorEnabled = false,
});
example, err := compute.NewDataDiskAttachment(ctx, "dataDiskAttachmentResource", &compute.DataDiskAttachmentArgs{
Caching: pulumi.String("string"),
Lun: pulumi.Int(0),
ManagedDiskId: pulumi.String("string"),
VirtualMachineId: pulumi.String("string"),
CreateOption: pulumi.String("string"),
WriteAcceleratorEnabled: pulumi.Bool(false),
})
var dataDiskAttachmentResource = new DataDiskAttachment("dataDiskAttachmentResource", DataDiskAttachmentArgs.builder()
.caching("string")
.lun(0)
.managedDiskId("string")
.virtualMachineId("string")
.createOption("string")
.writeAcceleratorEnabled(false)
.build());
data_disk_attachment_resource = azure.compute.DataDiskAttachment("dataDiskAttachmentResource",
caching="string",
lun=0,
managed_disk_id="string",
virtual_machine_id="string",
create_option="string",
write_accelerator_enabled=False)
const dataDiskAttachmentResource = new azure.compute.DataDiskAttachment("dataDiskAttachmentResource", {
caching: "string",
lun: 0,
managedDiskId: "string",
virtualMachineId: "string",
createOption: "string",
writeAcceleratorEnabled: false,
});
type: azure:compute:DataDiskAttachment
properties:
caching: string
createOption: string
lun: 0
managedDiskId: string
virtualMachineId: string
writeAcceleratorEnabled: false
DataDiskAttachment Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The DataDiskAttachment resource accepts the following input properties:
- Caching string
- Specifies the caching requirements for this Data Disk. Possible values include
None
,ReadOnly
andReadWrite
. - Lun int
- 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.
- Managed
Disk stringId - The ID of an existing Managed Disk which should be attached. Changing this forces a new resource to be created.
- Virtual
Machine stringId - The ID of the Virtual Machine to which the Data Disk should be attached. Changing this forces a new resource to be created.
- Create
Option string - The Create Option of the Data Disk, such as
Empty
orAttach
. Defaults toAttach
. Changing this forces a new resource to be created. - Write
Accelerator boolEnabled - 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. Defaults tofalse
.
- Caching string
- Specifies the caching requirements for this Data Disk. Possible values include
None
,ReadOnly
andReadWrite
. - Lun int
- 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.
- Managed
Disk stringId - The ID of an existing Managed Disk which should be attached. Changing this forces a new resource to be created.
- Virtual
Machine stringId - The ID of the Virtual Machine to which the Data Disk should be attached. Changing this forces a new resource to be created.
- Create
Option string - The Create Option of the Data Disk, such as
Empty
orAttach
. Defaults toAttach
. Changing this forces a new resource to be created. - Write
Accelerator boolEnabled - 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. Defaults tofalse
.
- caching String
- Specifies the caching requirements for this Data Disk. Possible values include
None
,ReadOnly
andReadWrite
. - lun Integer
- 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.
- managed
Disk StringId - The ID of an existing Managed Disk which should be attached. Changing this forces a new resource to be created.
- virtual
Machine StringId - The ID of the Virtual Machine to which the Data Disk should be attached. Changing this forces a new resource to be created.
- create
Option String - The Create Option of the Data Disk, such as
Empty
orAttach
. Defaults toAttach
. Changing this forces a new resource to be created. - write
Accelerator BooleanEnabled - 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. Defaults tofalse
.
- caching string
- Specifies the caching requirements for this Data Disk. Possible values include
None
,ReadOnly
andReadWrite
. - lun number
- 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.
- managed
Disk stringId - The ID of an existing Managed Disk which should be attached. Changing this forces a new resource to be created.
- virtual
Machine stringId - The ID of the Virtual Machine to which the Data Disk should be attached. Changing this forces a new resource to be created.
- create
Option string - The Create Option of the Data Disk, such as
Empty
orAttach
. Defaults toAttach
. Changing this forces a new resource to be created. - write
Accelerator booleanEnabled - 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. Defaults tofalse
.
- caching str
- Specifies the caching requirements for this Data Disk. Possible values include
None
,ReadOnly
andReadWrite
. - lun int
- 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.
- managed_
disk_ strid - The ID of an existing Managed Disk which should be attached. Changing this forces a new resource to be created.
- virtual_
machine_ strid - The ID of the Virtual Machine to which the Data Disk should be attached. Changing this forces a new resource to be created.
- create_
option str - The Create Option of the Data Disk, such as
Empty
orAttach
. Defaults toAttach
. Changing this forces a new resource to be created. - write_
accelerator_ boolenabled - 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. Defaults tofalse
.
- caching String
- Specifies the caching requirements for this Data Disk. Possible values include
None
,ReadOnly
andReadWrite
. - lun Number
- 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.
- managed
Disk StringId - The ID of an existing Managed Disk which should be attached. Changing this forces a new resource to be created.
- virtual
Machine StringId - The ID of the Virtual Machine to which the Data Disk should be attached. Changing this forces a new resource to be created.
- create
Option String - The Create Option of the Data Disk, such as
Empty
orAttach
. Defaults toAttach
. Changing this forces a new resource to be created. - write
Accelerator BooleanEnabled - 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. Defaults tofalse
.
Outputs
All input properties are implicitly available as output properties. Additionally, the DataDiskAttachment resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing DataDiskAttachment Resource
Get an existing DataDiskAttachment resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: DataDiskAttachmentState, opts?: CustomResourceOptions): DataDiskAttachment
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
caching: Optional[str] = None,
create_option: Optional[str] = None,
lun: Optional[int] = None,
managed_disk_id: Optional[str] = None,
virtual_machine_id: Optional[str] = None,
write_accelerator_enabled: Optional[bool] = None) -> DataDiskAttachment
func GetDataDiskAttachment(ctx *Context, name string, id IDInput, state *DataDiskAttachmentState, opts ...ResourceOption) (*DataDiskAttachment, error)
public static DataDiskAttachment Get(string name, Input<string> id, DataDiskAttachmentState? state, CustomResourceOptions? opts = null)
public static DataDiskAttachment get(String name, Output<String> id, DataDiskAttachmentState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Caching string
- Specifies the caching requirements for this Data Disk. Possible values include
None
,ReadOnly
andReadWrite
. - Create
Option string - The Create Option of the Data Disk, such as
Empty
orAttach
. Defaults toAttach
. Changing this forces a new resource to be created. - Lun int
- 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.
- Managed
Disk stringId - The ID of an existing Managed Disk which should be attached. Changing this forces a new resource to be created.
- Virtual
Machine stringId - The ID of the Virtual Machine to which the Data Disk should be attached. Changing this forces a new resource to be created.
- Write
Accelerator boolEnabled - 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. Defaults tofalse
.
- Caching string
- Specifies the caching requirements for this Data Disk. Possible values include
None
,ReadOnly
andReadWrite
. - Create
Option string - The Create Option of the Data Disk, such as
Empty
orAttach
. Defaults toAttach
. Changing this forces a new resource to be created. - Lun int
- 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.
- Managed
Disk stringId - The ID of an existing Managed Disk which should be attached. Changing this forces a new resource to be created.
- Virtual
Machine stringId - The ID of the Virtual Machine to which the Data Disk should be attached. Changing this forces a new resource to be created.
- Write
Accelerator boolEnabled - 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. Defaults tofalse
.
- caching String
- Specifies the caching requirements for this Data Disk. Possible values include
None
,ReadOnly
andReadWrite
. - create
Option String - The Create Option of the Data Disk, such as
Empty
orAttach
. Defaults toAttach
. Changing this forces a new resource to be created. - lun Integer
- 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.
- managed
Disk StringId - The ID of an existing Managed Disk which should be attached. Changing this forces a new resource to be created.
- virtual
Machine StringId - The ID of the Virtual Machine to which the Data Disk should be attached. Changing this forces a new resource to be created.
- write
Accelerator BooleanEnabled - 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. Defaults tofalse
.
- caching string
- Specifies the caching requirements for this Data Disk. Possible values include
None
,ReadOnly
andReadWrite
. - create
Option string - The Create Option of the Data Disk, such as
Empty
orAttach
. Defaults toAttach
. Changing this forces a new resource to be created. - lun number
- 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.
- managed
Disk stringId - The ID of an existing Managed Disk which should be attached. Changing this forces a new resource to be created.
- virtual
Machine stringId - The ID of the Virtual Machine to which the Data Disk should be attached. Changing this forces a new resource to be created.
- write
Accelerator booleanEnabled - 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. Defaults tofalse
.
- caching str
- Specifies the caching requirements for this Data Disk. Possible values include
None
,ReadOnly
andReadWrite
. - create_
option str - The Create Option of the Data Disk, such as
Empty
orAttach
. Defaults toAttach
. Changing this forces a new resource to be created. - lun int
- 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.
- managed_
disk_ strid - The ID of an existing Managed Disk which should be attached. Changing this forces a new resource to be created.
- virtual_
machine_ strid - The ID of the Virtual Machine to which the Data Disk should be attached. Changing this forces a new resource to be created.
- write_
accelerator_ boolenabled - 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. Defaults tofalse
.
- caching String
- Specifies the caching requirements for this Data Disk. Possible values include
None
,ReadOnly
andReadWrite
. - create
Option String - The Create Option of the Data Disk, such as
Empty
orAttach
. Defaults toAttach
. Changing this forces a new resource to be created. - lun Number
- 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.
- managed
Disk StringId - The ID of an existing Managed Disk which should be attached. Changing this forces a new resource to be created.
- virtual
Machine StringId - The ID of the Virtual Machine to which the Data Disk should be attached. Changing this forces a new resource to be created.
- write
Accelerator BooleanEnabled - 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. Defaults tofalse
.
Import
Virtual Machines Data Disk Attachments can be imported using the resource id
, e.g.
$ pulumi import azure:compute/dataDiskAttachment:DataDiskAttachment example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Compute/virtualMachines/machine1/dataDisks/disk1
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurerm
Terraform Provider.