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

Plugin not Responding for azurerm_windows_virtual_machine_scale_set #28417

Closed
1 task done
pritam-is-next opened this issue Jan 6, 2025 · 3 comments · Fixed by #28549
Closed
1 task done

Plugin not Responding for azurerm_windows_virtual_machine_scale_set #28417

pritam-is-next opened this issue Jan 6, 2025 · 3 comments · Fixed by #28549
Labels
bug crash service/vmss Virtual Machine Scale Sets v/4.x
Milestone

Comments

@pritam-is-next
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 comments along the lines of "+1", "me too" or "any updates", 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 and review the contribution guide to help.

Terraform Version

1.10.3

AzureRM Provider Version

4.3.0-4.14.0

Affected Resource(s)/Data Source(s)

azurerm_windows_virtual_machine_scale_set

Terraform Configuration Files

data "azurerm_client_config" "current" {}

resource "azurerm_windows_virtual_machine_scale_set" "VirtualMachineScaleset" {
  depends_on = [data.azurerm_lb_backend_address_pool.bepool, data.azurerm_subnet.subnet, data.azurerm_storage_account.storage_account, data.azurerm_application_gateway.appgtw]
  for_each   = var.VirtualMachineScaleset

  name                 = each.value.name
  resource_group_name  = each.value.rg.name
  location             = each.value.rg.location
  sku                  = each.value.sku
  instances            = try(each.value.instances, 1)
  admin_password       = each.value.admin_password
  admin_username       = each.value.admin_username
  computer_name_prefix = each.value.computer_name_prefix
  custom_data          = local.custom_data[each.key]
  # user_data            = local.user_data[each.key]
  encryption_at_host_enabled = try(each.value.encryption_at_host_enabled, false)
  # boot_diagnostics {
  #   storage_account_uri = data.azurerm_storage_account.storage_account[each.key].primary_blob_endpoint
  # }

  license_type = try(each.value.license_type, "Windows_Server")

  priority        = try(each.value.priority, "Regular")
  # eviction_policy = try(each.value.eviction_policy, "Deallocate") // Deallocate and Delete

  zone_balance = try(each.value.zone_balance, true)
  zones        = [1, 2, 3]
  # health_probe_id = "/subscriptions/${data.azurerm_client_config.current.subscription_id}/resourceGroups/${each.value.rg.name}/providers/Microsoft.Network/loadBalancers/m2-lb-lite12j1-dev-ea-lb1/probes/hprob"
  # health_probe_id = "/subscriptions/bf7020f1-55cb-4e93-9fe6-0b1f28f92460/resourceGroups/rg-avslite-dev-lite12j1/providers/Microsoft.Network/loadBalancers/m2-lb-lite12j1-dev-ea-lb1/probes/hprob"
  automatic_instance_repair {
    enabled      = try(each.value.automatic_instance_repair.enabled, true)
    grace_period = "PT10M"
    action       = "Replace"
  }

  source_image_reference {
    publisher = each.value.source_image_reference.publisher
    offer     = each.value.source_image_reference.offer
    sku       = each.value.source_image_reference.sku
    version   = each.value.source_image_reference.version
  }
  os_disk {
    storage_account_type = each.value.os_disk.storage_account_type
    caching              = each.value.os_disk.caching
  }
  dynamic "network_interface" {
    for_each = each.value.network_interface

    content {
      name        = network_interface.value.name
      primary     = try(network_interface.value.primary, false)
      dns_servers = try(network_interface.value.dns_servers, [])

      ip_configuration {
        name                                         = try(network_interface.value.ip_configuration.name, "internal")
        primary                                      = try(network_interface.value.ip_configuration.primary, false)
        subnet_id                                    = data.azurerm_subnet.subnet[each.key].id
        load_balancer_backend_address_pool_ids       = try(tolist([data.azurerm_lb_backend_address_pool.bepool[each.key].id]), tolist([]))
        application_gateway_backend_address_pool_ids = try(tolist([data.azurerm_application_gateway.appgtw[each.key].backend_address_pool[0].id]), tolist([]))
      }
    }
  }

  scale_in {
    rule                   = try(each.value.scale_in.rule, "NewestVM")             // Default, NewestVM and OldestVM
    force_deletion_enabled = try(each.value.scale_in.force_deletion_enabled, true) //force_deletion_enabled - true or false
  }

  extension {
    name                 = "customScriptExtension"
    publisher            = "Microsoft.Compute"
    type                 = "CustomScriptExtension"
    type_handler_version = "1.10"

    settings = jsonencode({
      "commandToExecute" : <<EOF
    cd C:\AzureData && rename CustomData.bin CustomData.ps1 && powershell.exe -Command ^"Register-ScheduledTask -Action $(New-ScheduledTaskAction -Execute powershell.exe -Argument \"-File C:\AzureData\CustomData.ps1 \") -Trigger $(New-ScheduledTaskTrigger -AtStartup) -TaskPath \CMS\VMSetup  -TaskName setupvm -User SYSTEM -RunLevel Highest ^" && shutdown.exe /r /t 20
    EOF
    })

    protected_settings = jsonencode({
      storageAccountName = "${each.value.extension.protected_settings.storage_account.name}"
      storageAccountKey  = "${data.azurerm_storage_account.storage_account[each.key].primary_access_key}"
    })
  }
  extension {
    name                       = "HealthExtension"
    publisher                  = "Microsoft.ManagedServices"
    type                       = "ApplicationHealthWindows"
    type_handler_version       = "2.0"
    auto_upgrade_minor_version = true
    settings = jsonencode({
      "protocol" : "http",
      "port" : 8082,
      "requestPath" : "/health",
      "intervalInSeconds" : 60,
      "numberOfProbes" : 2,
      "gracePeriod" : 600
    })
  }

  # extension {
  #   name = "AADLogin"
  #   publisher = "Microsoft.Azure.ActiveDirectory"
  #   type = "AADLoginForWindows"
  #   type_handler_version= "1.0"
  #   auto_upgrade_minor_version = true
  # }

  lifecycle {
    ignore_changes = [
      network_interface[0].ip_configuration[0].subnet_id,
      extension
    ]
  }

  tags = try(each.value.tags, {
    "client": "${each.value.client_name}"
    "env": "${each.value.environment}"
  })

}

Debug Output/Panic Output

Error: Plugin did not respond
│
│   with module.VirtualMachineScaleset.azurerm_windows_virtual_machine_scale_set.VirtualMachineScaleset["addns"],
│   on .terraform\modules\VirtualMachineScaleset\virtual_machine_scale_set.tf line 4, in resource "azurerm_windows_virtual_machine_scale_set" "VirtualMachineScaleset":
│    4: resource "azurerm_windows_virtual_machine_scale_set" "VirtualMachineScaleset" {
│
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs  
│ may contain more details.
╵
╷
│ Error: Plugin did not respond
│
│   with module.VirtualMachineScaleset.azurerm_windows_virtual_machine_scale_set.VirtualMachineScaleset["app"],
│   on .terraform\modules\VirtualMachineScaleset\virtual_machine_scale_set.tf line 4, in resource "azurerm_windows_virtual_machine_scale_set" "VirtualMachineScaleset":
│    4: resource "azurerm_windows_virtual_machine_scale_set" "VirtualMachineScaleset" {
│
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs  
│ may contain more details.
╵
╷
│ Error: Plugin did not respond
│
│   with module.VirtualMachineScaleset.azurerm_windows_virtual_machine_scale_set.VirtualMachineScaleset["web"],
│   on .terraform\modules\VirtualMachineScaleset\virtual_machine_scale_set.tf line 4, in resource "azurerm_windows_virtual_machine_scale_set" "VirtualMachineScaleset":
│    4: resource "azurerm_windows_virtual_machine_scale_set" "VirtualMachineScaleset" {
│
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs  
│ may contain more details.
╵
Releasing state lock. This may take a few moments...

Stack trace from the terraform-provider-azurerm_v4.14.0_x5.exe plugin:

panic: interface conversion: interface {} is nil, not []interface {}

goroutine 726 [running]:
github.com/hashicorp/terraform-provider-azurerm/internal/services/compute.expandOrchestratedVirtualMachineScaleSetExtensions({0x123c32f0, 0x1, 0x1})
        github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/orchestrated_virtual_machine_scale_set.go:1443 +0xf18
github.com/hashicorp/terraform-provider-azurerm/internal/services/compute.resourceWindowsVirtualMachineScaleSetUpdate(0x12754be0, {0x691b4a0, 0x112ddb08})
        github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/windows_virtual_machine_scale_set_resource.go:797 +0x2de5
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).update(0x107f8770, {0x7d5c488, 0x12cc8378}, 0x12754be0, {0x691b4a0, 0x112ddb08})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:828 +0x164
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0x107f8770, {0x7d5c488, 0x12cc8378}, 0x12d5f650, 0x12754910, {0x691b4a0, 0x112ddb08})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:947 +0x85c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0x1086c650, {0x7d5c488, 0x12cc8348}, 0x12ab60f0)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1155 +0xeb1
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).ApplyResourceChange(0x10110f50, {0x7d5c488, 0x12cc8288}, 0x12ab60f0)
        github.com/hashicorp/[email protected]/tf5muxserver/mux_server_ApplyResourceChange.go:36 +0x1d6
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0x1026a460, {0x7d5c488, 0x12a565d0}, 0x1293ac00)
        github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:865 +0x439
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x72e0d60, 0x1026a460}, {0x7d5c488, 0x12a565d0}, 0x1293abc0, 0x0)
        github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:611 +0x98
google.golang.org/grpc.(*Server).processUnaryRPC(0x10159188, {0x7d5c488, 0x125496b0}, {0x7d75614, 0x10f60fc8}, 0x12554b08, 0x10f71200, 0xd0ff0cc, 0x0)
        google.golang.org/[email protected]/server.go:1394 +0xfd9
google.golang.org/grpc.(*Server).handleStream(0x10159188, {0x7d75614, 0x10f60fc8}, 0x12554b08)
        google.golang.org/[email protected]/server.go:1805 +0x10cf
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        google.golang.org/[email protected]/server.go:1029 +0xaa
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 31
        google.golang.org/[email protected]/server.go:1040 +0x12f

Error: The terraform-provider-azurerm_v4.14.0_x5.exe plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

Expected Behaviour

No response

Actual Behaviour

No response

Steps to Reproduce

No response

Important Factoids

No response

References

No response

@pritam-is-next pritam-is-next changed the title Failing in Plugin not Responding for azurerm_windows_virtual_machine_scale_set Jan 6, 2025
@rcskosir rcskosir added the service/vmss Virtual Machine Scale Sets label Jan 6, 2025
@pritam-is-next
Copy link
Author

Issue Update:

Previously, the Health and Repair feature was enabled but later disabled through the portal. After I also disabled Health and Repair in the Terraform code, the error was resolved.

@lonegunmanb
Copy link
Contributor

@tutoraddicts thanks for reporting this issue to us, I'm working on a patch but have some tests to fix, I hope I can submit my pr ASAP.

Copy link

github-actions bot commented Mar 2, 2025

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.