Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: new resource to attach disks to virtual machines #795

Closed
ned1313 opened this issue Feb 5, 2018 · 4 comments · Fixed by #1207
Closed

Feature Request: new resource to attach disks to virtual machines #795

ned1313 opened this issue Feb 5, 2018 · 4 comments · Fixed by #1207

Comments

@ned1313
Copy link
Contributor

ned1313 commented Feb 5, 2018

An issue that I have run into recently is the inability to use a count function when adding data disks to a VM storage configuration. I can create the data disks using a count function outside of the resource, but I have to specify multiple storage_data_disk items in the azurerm_virtual_machine resource to get them attached. Hashicorp is considering ways to added a count function within a resource (using the foreach terminology in this thread).

Rather than waiting for that approach to shake out, I would like to request that resources like azurerm_managed_disk support a mapping function to attach to a azurerm_virtual_machine resource, or that a new mapping resource be created that will map the attachment of the disk to the virtual machine, something like azurerm_managed_disk_attach. Here's an example of how that would work:

resource azurerm_managed_disk_attach {
  name  =  "disk-attach-${count.index}"
  count  =  "${var.number-of-disks}"
  disk_id  =  "${element(azurerm_managed_disk.mydisk.*.id, count.index)}"
  vm_id  =  "${azurerm_virtual_machine.mymachine.id}"
}
@clangaxon
Copy link

This would be a huge benefit for us as well.

@tombuildsstuff
Copy link
Contributor

hey @ned1313

Thanks for opening this issue :)

This is something we'd like to support, but at the current time there's no matching API available for this in Azure. We may be able to workaround this by "faking" it - by placing a Lock on the Virtual Machine such that only one change can happen at a time - however this needs some investigation (hence I've added the "thinking" tag for the moment).

Thanks!

@tombuildsstuff tombuildsstuff modified the milestones: 1.4.0, Future Apr 16, 2018
@achandmsft achandmsft added M3 upstream/microsoft Indicates that there's an upstream issue blocking this issue/PR upstream/terraform This issue is blocked on an upstream issue within Terraform (Terraform Core/CLI, The Plugin SDK etc) labels Apr 26, 2018
@tombuildsstuff tombuildsstuff removed the upstream/terraform This issue is blocked on an upstream issue within Terraform (Terraform Core/CLI, The Plugin SDK etc) label May 3, 2018
@tombuildsstuff tombuildsstuff self-assigned this May 3, 2018
@tombuildsstuff tombuildsstuff removed thinking upstream/microsoft Indicates that there's an upstream issue blocking this issue/PR labels May 6, 2018
@tombuildsstuff
Copy link
Contributor

👋 hey all

I spent some time on Friday trying to work out how we'd achieve this and have opened #1207 which includes a new resource for attaching disks. This is still in an early phase and needs extensive testing - which we'll look into later in the week

Thanks!

@ghost
Copy link

ghost commented Mar 30, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.