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

Support for azurerm_shared_image_version data disks #21671

Open
1 task done
Jerico815 opened this issue May 5, 2023 · 1 comment
Open
1 task done

Support for azurerm_shared_image_version data disks #21671

Jerico815 opened this issue May 5, 2023 · 1 comment

Comments

@Jerico815
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

Description

Add a single or multiple data disks to azurerm_shared_image_version from managed_disks and/or snapshots.

Ref:
https://learn.microsoft.com/en-us/cli/azure/sig/image-version?view=azure-cli-latest#az-sig-image-version-create

Example from Microsoft:
Add a new image version from a managed disk and add additional data disks

az sig image-version create --resource-group MyResourceGroup \
--gallery-name MyGallery --gallery-image-definition MyImage \
--gallery-image-version 1.0.0 \
--os-snapshot /subscriptions/00000000-0000-0000-0000-00000000xxxx/resourceGroups/imageGroups/providers/Microsoft.Compute/disks/MyOSDisk \
--data-snapshots /subscriptions/00000000-0000-0000-0000-00000000xxxx/resourceGroups/imageGroups/providers/Microsoft.Compute/disks/MyDataDisk \
--data-snapshot-luns 0

Currently you need to create a azurerm_image (Supports data disks, but azurerm_image is legacy) and create a azurerm_shared_image_version from azurerm_image if you want a data disk included in your shared_image_version.

New or Affected Resource(s)/Data Source(s)

azurerm_shared_image_version

Potential Terraform Configuration

resource "azurerm_shared_image_version" "example" {
  name                = "0.0.1"
  gallery_name        = data.azurerm_shared_image.existing.gallery_name
  image_name          = data.azurerm_shared_image.existing.name
  resource_group_name = data.azurerm_shared_image.existing.resource_group_name
  location            = data.azurerm_shared_image.existing.location
  os_disk_snapshot_id = data.azurerm_windows_virtual_machine.existing.os_disk[0].id
  data_disk {
          managed_disk_snapshot_id = data.azurerm_managed_disk.existing1.id
          managed_disk_snapshot_lun = 0
  }
  data_disk {
          managed_disk_snapshot_id = data.azurerm_managed_disk.existing2.id
          managed_disk_snapshot_lun = 1
  }
  data_disk {
          managed_disk_snapshot_id = data.azurerm_snapshot.existing3.id
          managed_disk_snapshot_lun = 2
  }


  target_region {
    name                   = data.azurerm_shared_image.existing.location
    regional_replica_count = 5
    storage_account_type   = "Standard_LRS"
  }
}

References

https://learn.microsoft.com/en-us/cli/azure/sig/image-version?view=azure-cli-latest#az-sig-image-version-create

@Jerico815
Copy link
Author

For using this feature request with terraform we also need a solution for #6117
Please correct me if I am wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants