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

azurerm_linux_virtual_machine data disk from image #19742

Closed
1 task done
pimvandenderen opened this issue Dec 20, 2022 · 4 comments
Closed
1 task done

azurerm_linux_virtual_machine data disk from image #19742

pimvandenderen opened this issue Dec 20, 2022 · 4 comments

Comments

@pimvandenderen
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

1.36

AzureRM Provider Version

3.26.0

Affected Resource(s)/Data Source(s)

azurerm_linux_virtual_machine

Terraform Configuration Files

resource "azurerm_linux_virtual_machine" "this" {
  name                  = "linux-vm"
  location              = "EastUS"
  resource_group_name   = azurerm_resource_group.this.name
  network_interface_ids = [azurerm_network_interface.this.id]
  size               = "Standard_D4s_v5"
  disable_password_authentication = false
  admin_username = "azadmin"
  admin_password = "Micr0s0ft21!"
  computer_name  = "linux-vm"

  source_image_id = "/subscriptions/46ff3a32-ad72-40d6-ae7c-c019a0340292/resourceGroups/terraform-rg/providers/Microsoft.Compute/images/ImageVM-image-20221215104425"

  os_disk {
     caching              = "ReadWrite"
     storage_account_type = "Standard_LRS"
   }
}

Debug Output/Panic Output

│ Error: creating Linux Virtual Machine: (Name "linux-vm" / Resource Group "LinuxTest"): compute.VirtualMachinesClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="InvalidParameter" Message="StorageProfile.dataDisks.lun does not have required value(s) for image specified in storage profile." Target="storageProfile"
│
│   on main.tf line 103, in resource "azurerm_linux_virtual_machine" "this":
│  103: resource "azurerm_linux_virtual_machine" "this" {

Expected Behaviour

azurerm_linux_virtual_machine doesn't have an option to specify the data disk when deploying a virtual machine from a managed image. Since the image has two data disks, there is no way to refer to the data disk ID.

In the ARM reference there is an option for setting the data disk create_option to be fromImage, but the validation values on the data disk attachment in Terraform don't allow fromImage as a possible option.

Actual Behaviour

Error as shown under debug output.

Steps to Reproduce

  1. Create a Linux virtual machine in Azure with an OS disk and with a Data disk.
  2. Capture the VM and create a managed image that includes both disks.
  3. Try to create a new VM from the managed image with both disks.

Important Factoids

No response

References

One reference is here without solution: https://discuss.hashicorp.com/t/can-create-virtual-linux-machine-from-custom-image-which-has-data-disk/10457/3

@myc2h6o
Copy link
Contributor

myc2h6o commented Dec 21, 2022

Hi @pimvandenderen thanks for opening the issue! This shall be resolved when #6117 is supported

@jsathler

This comment was marked as off-topic.

@rcskosir
Copy link
Contributor

rcskosir commented May 25, 2023

Hi @pimvandenderen, as stated by @myc2h6o #6117 is the one to watch for movement on this issue. I am going to close this issue as a duplicate so that we can consolidate feedback on to #6117, please upvote over there if you have not already.
The "closed" will say as not planned, but that also covers duplicates.

@rcskosir rcskosir closed this as not planned Won't fix, can't repro, duplicate, stale May 25, 2023
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants