github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/website/source/docs/providers/azurerm/r/managed_disk.html.markdown (about) 1 --- 2 layout: "azurerm" 3 page_title: "Azure Resource Manager: azurerm_managed_disk" 4 sidebar_current: "docs-azurerm-resource-managed-disk" 5 description: |- 6 Create a Managed Disk. 7 --- 8 9 # azurerm\_managed\_disk 10 11 Create a managed disk. 12 13 ## Example Usage with Create Empty 14 15 ```hcl 16 resource "azurerm_resource_group" "test" { 17 name = "acctestrg" 18 location = "West US 2" 19 } 20 21 resource "azurerm_managed_disk" "test" { 22 name = "acctestmd" 23 location = "West US 2" 24 resource_group_name = "${azurerm_resource_group.test.name}" 25 storage_account_type = "Standard_LRS" 26 create_option = "Empty" 27 disk_size_gb = "1" 28 29 tags { 30 environment = "staging" 31 } 32 } 33 ``` 34 35 ## Example Usage with Create Copy 36 37 ```hcl 38 resource "azurerm_resource_group" "test" { 39 name = "acctestrg" 40 location = "West US 2" 41 } 42 43 resource "azurerm_managed_disk" "source" { 44 name = "acctestmd1" 45 location = "West US 2" 46 resource_group_name = "${azurerm_resource_group.test.name}" 47 storage_account_type = "Standard_LRS" 48 create_option = "Empty" 49 disk_size_gb = "1" 50 51 tags { 52 environment = "staging" 53 } 54 } 55 56 resource "azurerm_managed_disk" "copy" { 57 name = "acctestmd2" 58 location = "West US 2" 59 resource_group_name = "${azurerm_resource_group.test.name}" 60 storage_account_type = "Standard_LRS" 61 create_option = "Copy" 62 source_resource_id = "${azurerm_managed_disk.source.id}" 63 disk_size_gb = "1" 64 65 tags { 66 environment = "staging" 67 } 68 } 69 ``` 70 71 ## Argument Reference 72 73 The following arguments are supported: 74 75 * `name` - (Required) Specifies the name of the managed disk. Changing this forces a 76 new resource to be created. 77 * `resource_group_name` - (Required) The name of the resource group in which to create 78 the managed disk. 79 * `location` - (Required) Specified the supported Azure location where the resource exists. 80 Changing this forces a new resource to be created. 81 * `storage_account_type` - (Required) The type of storage to use for the managed disk. 82 Allowable values are `Standard_LRS` or `Premium_LRS`. 83 * `create_option` - (Required) The method to use when creating the managed disk. 84 * `Import` - Import a VHD file in to the managed disk (VHD specified with `source_uri`). 85 * `Empty` - Create an empty managed disk. 86 * `Copy` - Copy an existing managed disk or snapshot (specified with `source_resource_id`). 87 * `source_uri` - (Optional) URI to a valid VHD file to be used when `create_option` is `Import`. 88 * `source_resource_id` - (Optional) ID of an existing managed disk to copy when `create_option` is `Copy`. 89 * `os_type` - (Optional) Specify a value when the source of an `Import` or `Copy` 90 operation targets a source that contains an operating system. Valid values are `Linux` or `Windows` 91 * `disk_size_gb` - (Required) Specifies the size of the managed disk to create in gigabytes. 92 If `create_option` is `Copy`, then the value must be equal to or greater than the source's size. 93 * `tags` - (Optional) A mapping of tags to assign to the resource. 94 95 For more information on managed disks, such as sizing options and pricing, please check out the 96 [azure documentation](https://docs.microsoft.com/en-us/azure/storage/storage-managed-disks-overview). 97 98 ## Attributes Reference 99 100 The following attributes are exported: 101 102 * `id` - The managed disk ID. 103 104 ## Import 105 106 Managed Disks can be imported using the `resource id`, e.g. 107 108 ``` 109 terraform import azurerm_managed_disk.test /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/microsoft.compute/disks/manageddisk1 110 ```