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

Azure: Problems with disk_additional_size on images containg already additional disks #18

Open
ghost opened this issue Apr 30, 2021 · 1 comment

Comments

@ghost
Copy link

ghost commented Apr 30, 2021

This issue was originally opened by @loibpet as hashicorp/packer#7042. It was migrated here as a result of the Packer plugin split. 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.

@ayushtessell
Copy link

Hey everyone I'm getting this error, has anyone found any solution for it , or reason why is it happening with packer ?

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

1 participant