hashicorp / hashicorp/packer-plugin-azure
Ability to specify LUN and Caching for additional Azure data disks on managed image
- Dominant language
- Go
- Stars
- 63
- Forks
- 103
- PR merge metrics
- No merged PRs in 30d
Description
_This issue was originally opened by @alexsab1 as hashicorp/packer#6071. It was migrated here as a result of the [Packer plugin split](https://github.com/hashicorp/packer/issues/8610#issuecomment-770034737). The original body of the issue is below._
# Overview
Since version [1.2.2](https://github.com/hashicorp/packer/blob/master/CHANGELOG.md#122-march-26-2018) packer supports building with additional disks.
I tested this new feature by creating a template that creates additional 127GB managed data disk. After I ran the template I found out that packer defaults certain values for data disks:
1. LUN is defaulted to 0. I assume that adding more disks will increment LUN to 1, 2, etc.
2. Caching is set to Read/Write on attached disks.

# Problem
Once Azure Manager disk is created, it is not possible to change properties of the attached disk in the managed image. For example, [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/image?view=azure-cli-latest) does not offer commands to change property of data disk in managed image. Likewise, Azure Powershell, does not offer cmd-lets to change properties of data disk in managed image. I tired changing Lun via powershell in Azure Cloud Shell and received the following error

1) I need to change LUN from 0 to 1 on a single data disk created with the managed disk using packer version 1.2.2. This is the requirement of the Azure Scale Set infrastructure we run.
2) I also need to set caching to Read-only according to recommendations: https://docs.microsoft.com/en-us/azure/virtual-machines/windows/premium-storage-performance#disk-caching
# Feature Requested
Enhance packer to allow setting LUN and cache value for data disks before creating managed image.
Contributor guide
Research direction
No files or tests are named; start by locating the Azure managed-image builder code that creates additional data disks and tracing where LUN and caching defaults are assigned. Review the existing configuration and tests around additional disks, then confirm that both values can be supplied before image creation and are covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, go
- Domain
- cloud, devops
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100