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
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 exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new()
{
Location = "West Europe",
});
var mainVirtualNetwork = new Azure.Network.VirtualNetwork("mainVirtualNetwork", new()
{
AddressSpaces = new[]
{
"10.0.0.0/16",
},
Location = exampleResourceGroup.Location,
ResourceGroupName = exampleResourceGroup.Name,
});
var @internal = new Azure.Network.Subnet("internal", new()
{
ResourceGroupName = exampleResourceGroup.Name,
VirtualNetworkName = mainVirtualNetwork.Name,
AddressPrefixes = new[]
{
"10.0.2.0/24",
},
});
var mainNetworkInterface = new Azure.Network.NetworkInterface("mainNetworkInterface", new()
{
Location = exampleResourceGroup.Location,
ResourceGroupName = exampleResourceGroup.Name,
IpConfigurations = new[]
{
new Azure.Network.Inputs.NetworkInterfaceIpConfigurationArgs
{
Name = "internal",
SubnetId = @internal.Id,
PrivateIpAddressAllocation = "Dynamic",
},
},
});
var exampleVirtualMachine = new Azure.Compute.VirtualMachine("exampleVirtualMachine", new()
{
Location = exampleResourceGroup.Location,
ResourceGroupName = exampleResourceGroup.Name,
NetworkInterfaceIds = new[]
{
mainNetworkInterface.Id,
},
VmSize = "Standard_F2",
StorageImageReference = new Azure.Compute.Inputs.VirtualMachineStorageImageReferenceArgs
{
Publisher = "Canonical",
Offer = "UbuntuServer",
Sku = "16.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("exampleManagedDisk", new()
{
Location = exampleResourceGroup.Location,
ResourceGroupName = exampleResourceGroup.Name,
StorageAccountType = "Standard_LRS",
CreateOption = "Empty",
DiskSizeGb = 10,
});
var exampleDataDiskAttachment = new Azure.Compute.DataDiskAttachment("exampleDataDiskAttachment", new()
{
ManagedDiskId = exampleManagedDisk.Id,
VirtualMachineId = exampleVirtualMachine.Id,
Lun = 10,
Caching = "ReadWrite",
});
});
package main
import (
"fmt"
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/compute"
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v5/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)
exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
Location: pulumi.String("West Europe"),
})
if err != nil {
return err
}
mainVirtualNetwork, err := network.NewVirtualNetwork(ctx, "mainVirtualNetwork", &network.VirtualNetworkArgs{
AddressSpaces: pulumi.StringArray{
pulumi.String("10.0.0.0/16"),
},
Location: exampleResourceGroup.Location,
ResourceGroupName: exampleResourceGroup.Name,
})
if err != nil {
return err
}
internal, err := network.NewSubnet(ctx, "internal", &network.SubnetArgs{
ResourceGroupName: exampleResourceGroup.Name,
VirtualNetworkName: mainVirtualNetwork.Name,
AddressPrefixes: pulumi.StringArray{
pulumi.String("10.0.2.0/24"),
},
})
if err != nil {
return err
}
mainNetworkInterface, err := network.NewNetworkInterface(ctx, "mainNetworkInterface", &network.NetworkInterfaceArgs{
Location: exampleResourceGroup.Location,
ResourceGroupName: exampleResourceGroup.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, "exampleVirtualMachine", &compute.VirtualMachineArgs{
Location: exampleResourceGroup.Location,
ResourceGroupName: exampleResourceGroup.Name,
NetworkInterfaceIds: pulumi.StringArray{
mainNetworkInterface.ID(),
},
VmSize: pulumi.String("Standard_F2"),
StorageImageReference: &compute.VirtualMachineStorageImageReferenceArgs{
Publisher: pulumi.String("Canonical"),
Offer: pulumi.String("UbuntuServer"),
Sku: pulumi.String("16.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, "exampleManagedDisk", &compute.ManagedDiskArgs{
Location: exampleResourceGroup.Location,
ResourceGroupName: exampleResourceGroup.Name,
StorageAccountType: pulumi.String("Standard_LRS"),
CreateOption: pulumi.String("Empty"),
DiskSizeGb: pulumi.Int(10),
})
if err != nil {
return err
}
_, err = compute.NewDataDiskAttachment(ctx, "exampleDataDiskAttachment", &compute.DataDiskAttachmentArgs{
ManagedDiskId: exampleManagedDisk.ID(),
VirtualMachineId: exampleVirtualMachine.ID(),
Lun: pulumi.Int(10),
Caching: pulumi.String("ReadWrite"),
})
if err != nil {
return err
}
return nil
})
}
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 exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
.location("West Europe")
.build());
var mainVirtualNetwork = new VirtualNetwork("mainVirtualNetwork", VirtualNetworkArgs.builder()
.addressSpaces("10.0.0.0/16")
.location(exampleResourceGroup.location())
.resourceGroupName(exampleResourceGroup.name())
.build());
var internal = new Subnet("internal", SubnetArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.virtualNetworkName(mainVirtualNetwork.name())
.addressPrefixes("10.0.2.0/24")
.build());
var mainNetworkInterface = new NetworkInterface("mainNetworkInterface", NetworkInterfaceArgs.builder()
.location(exampleResourceGroup.location())
.resourceGroupName(exampleResourceGroup.name())
.ipConfigurations(NetworkInterfaceIpConfigurationArgs.builder()
.name("internal")
.subnetId(internal.id())
.privateIpAddressAllocation("Dynamic")
.build())
.build());
var exampleVirtualMachine = new VirtualMachine("exampleVirtualMachine", VirtualMachineArgs.builder()
.location(exampleResourceGroup.location())
.resourceGroupName(exampleResourceGroup.name())
.networkInterfaceIds(mainNetworkInterface.id())
.vmSize("Standard_F2")
.storageImageReference(VirtualMachineStorageImageReferenceArgs.builder()
.publisher("Canonical")
.offer("UbuntuServer")
.sku("16.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()
.location(exampleResourceGroup.location())
.resourceGroupName(exampleResourceGroup.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());
}
}
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_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
main_virtual_network = azure.network.VirtualNetwork("mainVirtualNetwork",
address_spaces=["10.0.0.0/16"],
location=example_resource_group.location,
resource_group_name=example_resource_group.name)
internal = azure.network.Subnet("internal",
resource_group_name=example_resource_group.name,
virtual_network_name=main_virtual_network.name,
address_prefixes=["10.0.2.0/24"])
main_network_interface = azure.network.NetworkInterface("mainNetworkInterface",
location=example_resource_group.location,
resource_group_name=example_resource_group.name,
ip_configurations=[azure.network.NetworkInterfaceIpConfigurationArgs(
name="internal",
subnet_id=internal.id,
private_ip_address_allocation="Dynamic",
)])
example_virtual_machine = azure.compute.VirtualMachine("exampleVirtualMachine",
location=example_resource_group.location,
resource_group_name=example_resource_group.name,
network_interface_ids=[main_network_interface.id],
vm_size="Standard_F2",
storage_image_reference=azure.compute.VirtualMachineStorageImageReferenceArgs(
publisher="Canonical",
offer="UbuntuServer",
sku="16.04-LTS",
version="latest",
),
storage_os_disk=azure.compute.VirtualMachineStorageOsDiskArgs(
name="myosdisk1",
caching="ReadWrite",
create_option="FromImage",
managed_disk_type="Standard_LRS",
),
os_profile=azure.compute.VirtualMachineOsProfileArgs(
computer_name=vm_name,
admin_username="testadmin",
admin_password="Password1234!",
),
os_profile_linux_config=azure.compute.VirtualMachineOsProfileLinuxConfigArgs(
disable_password_authentication=False,
))
example_managed_disk = azure.compute.ManagedDisk("exampleManagedDisk",
location=example_resource_group.location,
resource_group_name=example_resource_group.name,
storage_account_type="Standard_LRS",
create_option="Empty",
disk_size_gb=10)
example_data_disk_attachment = azure.compute.DataDiskAttachment("exampleDataDiskAttachment",
managed_disk_id=example_managed_disk.id,
virtual_machine_id=example_virtual_machine.id,
lun=10,
caching="ReadWrite")
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 exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
const mainVirtualNetwork = new azure.network.VirtualNetwork("mainVirtualNetwork", {
addressSpaces: ["10.0.0.0/16"],
location: exampleResourceGroup.location,
resourceGroupName: exampleResourceGroup.name,
});
const internal = new azure.network.Subnet("internal", {
resourceGroupName: exampleResourceGroup.name,
virtualNetworkName: mainVirtualNetwork.name,
addressPrefixes: ["10.0.2.0/24"],
});
const mainNetworkInterface = new azure.network.NetworkInterface("mainNetworkInterface", {
location: exampleResourceGroup.location,
resourceGroupName: exampleResourceGroup.name,
ipConfigurations: [{
name: "internal",
subnetId: internal.id,
privateIpAddressAllocation: "Dynamic",
}],
});
const exampleVirtualMachine = new azure.compute.VirtualMachine("exampleVirtualMachine", {
location: exampleResourceGroup.location,
resourceGroupName: exampleResourceGroup.name,
networkInterfaceIds: [mainNetworkInterface.id],
vmSize: "Standard_F2",
storageImageReference: {
publisher: "Canonical",
offer: "UbuntuServer",
sku: "16.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("exampleManagedDisk", {
location: exampleResourceGroup.location,
resourceGroupName: exampleResourceGroup.name,
storageAccountType: "Standard_LRS",
createOption: "Empty",
diskSizeGb: 10,
});
const exampleDataDiskAttachment = new azure.compute.DataDiskAttachment("exampleDataDiskAttachment", {
managedDiskId: exampleManagedDisk.id,
virtualMachineId: exampleVirtualMachine.id,
lun: 10,
caching: "ReadWrite",
});
configuration:
prefix:
type: string
default: example
resources:
exampleResourceGroup:
type: azure:core:ResourceGroup
properties:
location: West Europe
mainVirtualNetwork:
type: azure:network:VirtualNetwork
properties:
addressSpaces:
- 10.0.0.0/16
location: ${exampleResourceGroup.location}
resourceGroupName: ${exampleResourceGroup.name}
internal:
type: azure:network:Subnet
properties:
resourceGroupName: ${exampleResourceGroup.name}
virtualNetworkName: ${mainVirtualNetwork.name}
addressPrefixes:
- 10.0.2.0/24
mainNetworkInterface:
type: azure:network:NetworkInterface
properties:
location: ${exampleResourceGroup.location}
resourceGroupName: ${exampleResourceGroup.name}
ipConfigurations:
- name: internal
subnetId: ${internal.id}
privateIpAddressAllocation: Dynamic
exampleVirtualMachine:
type: azure:compute:VirtualMachine
properties:
location: ${exampleResourceGroup.location}
resourceGroupName: ${exampleResourceGroup.name}
networkInterfaceIds:
- ${mainNetworkInterface.id}
vmSize: Standard_F2
storageImageReference:
publisher: Canonical
offer: UbuntuServer
sku: 16.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
properties:
location: ${exampleResourceGroup.location}
resourceGroupName: ${exampleResourceGroup.name}
storageAccountType: Standard_LRS
createOption: Empty
diskSizeGb: 10
exampleDataDiskAttachment:
type: azure:compute:DataDiskAttachment
properties:
managedDiskId: ${exampleManagedDisk.id}
virtualMachineId: ${exampleVirtualMachine.id}
lun: '10'
caching: ReadWrite
variables:
vmName: ${prefix}-vm
Create DataDiskAttachment Resource
new DataDiskAttachment(name: string, args: DataDiskAttachmentArgs, opts?: CustomResourceOptions);
@overload
def DataDiskAttachment(resource_name: 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)
@overload
def DataDiskAttachment(resource_name: str,
args: DataDiskAttachmentArgs,
opts: Optional[ResourceOptions] = 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.
- 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.
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
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
azurerm
Terraform Provider.