Open rosenbaaronAR opened 2 years ago
@rosenbaaronAR thank you for opening this issue here. For "changing something like a scale plan", Could you explain which property in the tf config is modified?
When I changed the scale plan from .. resource "azurerm_virtual_desktop_scaling_plan" "scale_plan" { name = "${var.avd.name}-scale_plan" location = azurerm_resource_group.rg.location resource_group_name = azurerm_resource_group.rg.name friendly_name = "Scaling Plan " description = "Scaling Plan" time_zone = "Central Standard Time" schedule { name = "Weekdays" days_of_week = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"] ramp_up_start_time = "05:00" ramp_up_load_balancing_algorithm = "BreadthFirst" ramp_up_minimum_hosts_percent = 0 ramp_up_capacity_threshold_percent = 10 peak_start_time = "09:00" peak_load_balancing_algorithm = "BreadthFirst" ramp_down_start_time = "19:00" ramp_down_load_balancing_algorithm = "DepthFirst" ramp_down_minimum_hosts_percent = 0 ramp_down_force_logoff_users = false ramp_down_wait_time_minutes = 45 ramp_down_notification_message = "Please log off in the next 45 minutes..." ramp_down_capacity_threshold_percent = 5 ramp_down_stop_hosts_when = "ZeroSessions" off_peak_start_time = "22:00" off_peak_load_balancing_algorithm = "DepthFirst" } host_pool { hostpool_id = azurerm_virtual_desktop_host_pool.hp.id scaling_plan_enabled = true } }
to
/ scale plan / resource "random_uuid" "scale_plan" { }
resource "azurerm_role_definition" "scale_plan" { name = "${var.avd.name}-autoscale" scope = azurerm_resource_group.rg.id description = "AVD AutoScale Role" permissions { actions = [ "Microsoft.Insights/eventtypes/values/read", "Microsoft.Compute/virtualMachines/deallocate/action", "Microsoft.Compute/virtualMachines/restart/action", "Microsoft.Compute/virtualMachines/powerOff/action", "Microsoft.Compute/virtualMachines/start/action", "Microsoft.Compute/virtualMachines/read", "Microsoft.DesktopVirtualization/hostpools/read", "Microsoft.DesktopVirtualization/hostpools/write", "Microsoft.DesktopVirtualization/hostpools/sessionhosts/read", "Microsoft.DesktopVirtualization/hostpools/sessionhosts/write",
"Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/delete" ,
"Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/read",
"Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/sendMessage/action" ,
"Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/read" ] not_actions = [] } assignable_scopes = [ azurerm_resource_group.rg.id, azurerm_virtual_desktop_host_pool.hp.id ] }
data azurerm_role_definition scale_plan { role_definition_id= "" scope = data.azurerm_subscription.current.id }
data "azuread_service_principal" "scale_plan" { display_name = "Windows Virtual Desktop" }
resource "azurerm_role_assignment" "scale_plan" { name = random_uuid.scale_plan.id
data_azurerm_role_definition.scale_plan.id, "|${azurerm_role_definition.scale_plan.scope}") scope = azurerm_resource_group.rg.id role_definition_id = data.azurerm_role_definition.scale_plan .id principal_id = data.azuread_service_principal. scale_plan.application_id skip_service_principal_aad_check = true } / resource "azurerm_role_assignment" "scale_plan_hp" { name = random_uuid.scale_plan.id scope = data.azurerm_subscription.current.id role_definition_id = azurerm_role_definition.scale_plan.role_definition_resource_id principal_id = data.azuread_service_principal.scale_plan.application_id skip_service_principal_aad_check = true } / resource "azurerm_virtual_desktop_scaling_plan" "scale_plan" { name = "${var.avd.name}-scale_plan" location = azurerm_resource_group.rg.location resource_group_name = azurerm_resource_group.rg.name friendly_name = "Scaling Plan " description = "Scaling Plan" time_zone = "Central Standard Time" schedule { name = "Weekdays" days_of_week = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"] ramp_up_start_time = "05:00" ramp_up_load_balancing_algorithm = "DepthFirst" ramp_up_minimum_hosts_percent = 0 ramp_up_capacity_threshold_percent = 90 peak_start_time = "09:00" peak_load_balancing_algorithm = "DepthFirst" ramp_down_start_time = "19:00" ramp_down_load_balancing_algorithm = "DepthFirst" ramp_down_minimum_hosts_percent = 0 ramp_down_force_logoff_users = false ramp_down_wait_time_minutes = 45 ramp_down_notification_message = "Please log off in the next 45 minutes..." ramp_down_capacity_threshold_percent = 5 ramp_down_stop_hosts_when = "ZeroSessions" off_peak_start_time = "22:00" off_peak_load_balancing_algorithm = "DepthFirst" } host_pool { hostpool_id = azurerm_virtual_desktop_host_pool.hp.id scaling_plan_enabled = true } }
I get this error message.
│ Error: deleting Host Pool: (Name "cdcddgw-hp" / Resource Group "rg-cdcddgw"): desktopvirtualization.HostPoolsClient#Delete: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="400" Message="ActivityId: 0324190d-cd92-47b1-8207-0a92337e17ae Error: The SessionHostPool cdcddgw-hp could not be deleted because it still has ApplicationGroups associated with it. Please remove all ApplicationGroups from the SessionHostPool and retry the operation." │
On Sun, May 22, 2022 at 9:07 PM Elena Xin @.***> wrote:
@rosenbaaronAR https://github.com/rosenbaaronAR thank you for opening this issue here. For "changing something like a scale plan", Could you explain which property in the tf config is modified?
— Reply to this email directly, view it on GitHub https://github.com/hashicorp/terraform-provider-azurerm/issues/16852#issuecomment-1134088644, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHARVKHRA4W5PAOZ2RYJWBDVLLR4TANCNFSM5WJMNSSA . You are receiving this because you were mentioned.Message ID: @.***>
-- Sincerely,
Aaron Rosenberg
Is there an existing issue for this?
Community Note
Hi, I'm not sure what happened but every time I updated anything in my azure virtual desktop I get this message here. It seems an update like changing the scale plan requires that the host pool be deleted and re-created resulting in the following message. I have to destroy and then re-apply all of my resources to get it to work correctly. My provider is. provider "registry.terraform.io/hashicorp/azurerm" version = "2.98.0" ╷ │ Error: deleting Host Pool: (Name "test-hp" / Resource Group "rg-test"): desktopvirtualization.HostPoolsClient#Delete: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="400" Message="ActivityId: 4b7776dc-27c5-4be8-8664-cec1dbbeeaee Error: The SessionHostPool test-hp could not be deleted because it still has ApplicationGroups associated with it. Please remove all ApplicationGroups from the SessionHostPool and retry the operation." │ │
Terraform Version
1.1.9
AzureRM Provider Version
2.98.0
Affected Resource(s)/Data Source(s)
azurerm_virtual_desktop_host_pool
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
No response
Actual Behaviour
No response
Steps to Reproduce
change something like the scale plan and terraform apply
Important Factoids
No response
References
No response