hashicorp / hashicorp/packer-plugin-azure
Azure: Problems with disk_additional_size on images containg already additional disks
- Dominant language
- Go
- Stars
- 63
- Forks
- 103
- PR merge metrics
- No merged PRs in 30d
Description
_This issue was originally opened by @loibpet as hashicorp/packer#7042. 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._
**packer -v: 1.3.2**
We are using for our images a "chained" process for on-premis and for all cloud providers, i.e. we create one basis containing all required hardening, company specific setup and cloud specific configuration. Then we use this basis in another step and create the intended image flavor. In step one, we create one additional disk to separate the /var/log tree to a separate disk (company way of doing things which cannot be changed). For certain use cases, we need to use one more data disk in the image (e.g. for local data storage).
Our templates look like this:
**Step 1:**
```
"builders": [
{
"type": "azure-arm",
"client_id": "{{user `client_id`}}",
"client_secret": "{{user `client_secret`}}",
"subscription_id": "{{user `subscription_id`}}",
"tenant_id": "{{user `tenant_id`}}",
"ssh_username": "azure",
"ssh_password": "MySecretPassword",
"os_type": "Linux",
"image_publisher": "OpenLogic",
"image_offer": "CentOS",
"image_sku": "7.5",
"image_version": "latest",
"ssh_pty": "true",
"vm_size": "Standard_B1s",
"disk_additional_size": [
5
],
"managed_image_name": "packer-test-step1",
"managed_image_resource_group_name": "my-rg",
"location": "West Europe",
"virtual_network_name": "my-vnet",
"virtual_network_resource_group_name": "my-rg",
"virtual_network_subnet_name": "private"
}
```
This works fine and the image is created as needed.
**Step 2 - Version 1:**
```
"builders": [
{
"type": "azure-arm",
"client_id": "{{user `client_id`}}",
"client_secret": "{{user `client_secret`}}",
"subscription_id": "{{user `subscription_id`}}",
"tenant_id": "{{user `tenant_id`}}",
"ssh_username": "azure",
"ssh_password": "MySecretPassword",
"os_type": "Linux",
"custom_managed_image_name": "packer-test-step1",
"custom_managed_image_resource_group_name": "my-rg",
"ssh_pty": "true",
"vm_size": "Standard_B1s",
"disk_additional_size": [
10
],
"managed_image_name": "packer-test-step2a",
"managed_image_resource_group_name": "my-rg",
"location": "West Europe",
"virtual_network_name": "my-vnet",
"virtual_network_resource_group_name": "my-rg",
"virtual_network_subnet_name": "private"
}
```
This one fails with:
==> azure-arm: ERROR: -> BadRequest
==> azure-arm: ERROR: -> InvalidParameter : Cannot specify user image overrides for a disk already defined in the specified image reference.
**Step 2 - Version 2:**
```
"builders": [
{
"type": "azure-arm",
"client_id": "{{user `client_id`}}",
"client_secret": "{{user `client_secret`}}",
"subscription_id": "{{user `subscription_id`}}",
"tenant_id": "{{user `tenant_id`}}",
"ssh_username": "azure",
"ssh_password": "MySecretPassword",
"os_type": "Linux",
"custom_managed_image_name": "packer-test-step1",
"custom_managed_image_resource_group_name": "my-rg",
"ssh_pty": "true",
"vm_size": "Standard_B1s",
"disk_additional_size": [
5, 10
],
"managed_image_name": "packer-test-step2b",
"managed_image_resource_group_name": "my-rg",
"location": "West Europe",
"virtual_network_name": "my-vnet",
"virtual_network_resource_group_name": "my-rg",
"virtual_network_subnet_name": "private"
}
```
Adding the size of the user disk of step 1 fails as well:
==> azure-arm: ERROR: -> BadRequest
==> azure-arm: ERROR: -> InvalidParameter : Cannot specify user image overrides for a disk already defined in the specified image reference.
Contributor guide
Research direction
Start at the azure-arm builder paths handling custom_managed_image_name, custom_managed_image_resource_group_name, and disk_additional_size. Reproduce both Step 2 configurations against an image containing an additional disk and inspect the reported Azure InvalidParameter response. Done means chained managed images can preserve existing additional disks while applying the requested disk configuration without that error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, go
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100