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_scale_set - update error #7957

Closed
ArcturusZhang opened this issue Jul 30, 2020 · 3 comments · Fixed by #7983
Closed

azurerm_linux_virtual_machine_scale_set - update error #7957

ArcturusZhang opened this issue Jul 30, 2020 · 3 comments · Fixed by #7983
Assignees
Labels
bug service/vmss Virtual Machine Scale Sets upstream/microsoft Indicates that there's an upstream issue blocking this issue/PR
Milestone

Comments

@ArcturusZhang
Copy link
Contributor

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 (and AzureRM Provider) Version

Terraform v0.12.29

Affected Resource(s)

  • azurerm_linux_virtual_machine_scale_set
  • probably azurerm_windows_virtual_machine_scale_set

Terraform Configuration Files

resource "azurerm_linux_virtual_machine_scale_set" "main" {
  name                            = "${var.prefix}-vmss"
  resource_group_name             = data.azurerm_resource_group.test.name
  location                        = data.azurerm_resource_group.test.location
  sku                             = "Standard_F2"
  instances                       = 3
  admin_username                  = "adminuser"
  admin_password                  = "P@ssw0rd1234!"
  disable_password_authentication = false

  source_image_id = data.azurerm_shared_image_version.test.id

  network_interface {
    name    = "example"
    primary = true

    ip_configuration {
      name      = "internal"
      primary   = true
      subnet_id = azurerm_subnet.internal.id
    }
  }

  os_disk {
    storage_account_type = "Standard_LRS"
    caching              = "ReadWrite"
  }
  
  data_disk {
    storage_account_type = "Standard_LRS"
    caching              = "ReadOnly"
    lun                  = 1
    disk_size_gb         = 20
    create_option        = "Empty"
  }

  tags = {
    "Test" = "Foo"
  }
}

Debug Output

Panic Output

Error updating LLinuxinux Virtual Machine Scale Set "test-vmss" (Resource Group "test-vmss-update"): compute.VirtualMachineScaleSetsClient#Update: Failure sending request: StatusCode=400 -- Original Error: Code="InvalidParameter" Message="Required parameter 'imageReference' is missing (null)." Target="imageReference"

Expected Behavior

The VMSS successfully updated

Actual Behavior

Got an error complaining imageReference is null

Error updating LLinuxinux Virtual Machine Scale Set "test-vmss" (Resource Group "test-vmss-update"): compute.VirtualMachineScaleSetsClient#Update: Failure sending request: StatusCode=400 -- Original Error: Code="InvalidParameter" Message="Required parameter 'imageReference' is missing (null)." Target="imageReference"

Steps to Reproduce

  1. terraform apply with the config above but the data_disk block removed - the VMSS should be successfully provisioned
  2. terraform apply again with the config above with data_disk block restored - service throws an error at you

Important Factoids

I believe this should be an Azure API bug - in some circumstances, the API is expected in a PATCH request, even though you are not willing to change the image reference, you will have to specify an image reference.

But a workaround on the provider side is also valid - just always fill in the image reference in the update callback

References

@ArcturusZhang ArcturusZhang added bug service/vmss Virtual Machine Scale Sets upstream/microsoft Indicates that there's an upstream issue blocking this issue/PR labels Jul 30, 2020
@ArcturusZhang ArcturusZhang self-assigned this Jul 30, 2020
@ArcturusZhang
Copy link
Contributor Author

Upstream issue opened: Azure/azure-rest-api-specs#10322

@ghost
Copy link

ghost commented Sep 4, 2020

This has been released in version 2.26.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.26.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Oct 2, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Oct 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug service/vmss Virtual Machine Scale Sets upstream/microsoft Indicates that there's an upstream issue blocking this issue/PR
Projects
None yet
2 participants