Terraform: count on azure_data_disk

Created on 24 Jun 2016  ·  10Comments  ·  Source: hashicorp/terraform

Hi,

would appreciate adding support for creating an array of data disks on azure.

https://www.terraform.io/docs/providers/azure/r/data_disk.html

enhancement provideazurerm

Most helpful comment

yes I know that....though this issue/request is to support count

storage_data_disk {
count = 4
name = "mydatadisk${count.index)"
vhd_uri = "${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}/mydatadisk$(cound.index).vhd"
disk_size_gb = "1023"
create_option = "empty"
lun = 0
}

All 10 comments

Hi @isamuelson

I am looking into this now - give me a little bit of time to investigate

Thanks

Paul

@stack72 thanks!

Hi @isamuelson

So when looking at this, it isn't actually possible to specify more than 1 data_disk on a VM in Azure. The API returns this error:

{
    "error": {
        "code": "OperationNotAllowed",
        "target": "dataDisks",
        "message": "The maximum number of data disks allowed to be attached to a VM is 1."
    }
}

I have submitted a PR that will only allow 1 data_disk to be specified going forward to keep with the API restraints

Paul

His is bizarre....

According to docs DS2 can have 4 data disks...we actually have that
working...

https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-windows-sizes/

On Tuesday, June 28, 2016, Paul Stack [email protected] wrote:

Hi @isamuelson https://github.com/isamuelson

So when looking at this, it isn't actually possible to specify more than 1
data_disk on a VM in Azure. The API returns this error:

{
"error": {
"code": "OperationNotAllowed",
"target": "dataDisks",
"message": "The maximum number of data disks allowed to be attached to a VM is 1."
}
}

I have submitted a PR that will only allow 1 data_disk to be specified
going forward to keep with the API restraints

Paul


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/hashicorp/terraform/issues/7321#issuecomment-229034437,
or mute the thread
https://github.com/notifications/unsubscribe/ABX8VP0kLvmsdZBp77gosuEwsuUsnEblks5qQROQgaJpZM4I-FYD
.

_Ido Samuelson_

Phone (US): +1-415-562-8582

Email: _ido.[email protected]_
LinkedIn: http://www.linkedin.com/in/isamuelson

Skype: ido_samuelson

Checking a DS2 machine now to see... 2 mins

@isamuelson apologies for the false alarm here - this was because of the machine type I was using :)

ok, so there are different things happening here:

  1. The link you gave in the original issue was a link to the Azure Service Manager Data_disk resource. Azure Resource Manager has no such idea.
  2. To use data disks in ARM, you need to specify something like this:
storage_data_disk {
        name                    = "mydatadisk1"
        vhd_uri       = "${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}/mydatadisk1.vhd"
    disk_size_gb  = "1023"
    create_option = "Empty"
    lun                     = 0
  }
  1. You can specify multiple config blocks to add multiple data disks:
storage_data_disk {
        name                    = "mydatadisk2"
        vhd_uri       = "${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}/mydatadisk2.vhd"
    disk_size_gb  = "1023"
    create_option = "empty"
    lun                     = 0
  }

  storage_data_disk {
        name                    = "mydatadisk3"
        vhd_uri       = "${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}/mydatadisk3.vhd"
    disk_size_gb  = "1023"
    create_option = "empty"
    lun                     = 0
  }

  storage_data_disk {
        name                    = "mydatadisk4"
        vhd_uri       = "${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}/mydatadisk4.vhd"
    disk_size_gb  = "1023"
    create_option = "empty"
    lun                     = 0
  }

All within the same VM

Hope this helps?

Paul

yes I know that....though this issue/request is to support count

storage_data_disk {
count = 4
name = "mydatadisk${count.index)"
vhd_uri = "${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}/mydatadisk$(cound.index).vhd"
disk_size_gb = "1023"
create_option = "empty"
lun = 0
}

@isamuelson this has been requested as a general addition to the schema in #7034

I am going to close this request and then let the tracking for the schema change happen there

Paul

I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings