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_virtual_desktop_host_pool attribute load_balancer_type shouldn't force a new resource to be created #20947

Merged
merged 1 commit into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ func resourceVirtualDesktopHostPool() *pluginsdk.Resource {
"load_balancer_type": {
Type: pluginsdk.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{
string(hostpool.LoadBalancerTypeBreadthFirst),
string(hostpool.LoadBalancerTypeDepthFirst),
Expand Down Expand Up @@ -263,7 +262,7 @@ func resourceVirtualDesktopHostPoolUpdate(d *pluginsdk.ResourceData, meta interf
payload.Tags = tags.Expand(d.Get("tags").(map[string]interface{}))
}

if d.HasChanges("custom_rdp_properties", "description", "friendly_name", "maximum_sessions_allowed", "preferred_app_group_type", "start_vm_on_connect", "validate_environment", "scheduled_agent_updates") {
if d.HasChanges("custom_rdp_properties", "description", "friendly_name", "load_balancer_type", "maximum_sessions_allowed", "preferred_app_group_type", "start_vm_on_connect", "validate_environment", "scheduled_agent_updates") {
payload.Properties = &hostpool.HostPoolPatchProperties{}

if d.HasChange("custom_rdp_properties") {
Expand All @@ -278,6 +277,11 @@ func resourceVirtualDesktopHostPoolUpdate(d *pluginsdk.ResourceData, meta interf
payload.Properties.FriendlyName = utils.String(d.Get("friendly_name").(string))
}

if d.HasChange("load_balancer_type") {
loadBalancerType := hostpool.LoadBalancerType(d.Get("load_balancer_type").(string))
payload.Properties.LoadBalancerType = &loadBalancerType
}

if d.HasChange("maximum_sessions_allowed") {
payload.Properties.MaxSessionLimit = utils.Int64(int64(d.Get("maximum_sessions_allowed").(int)))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ resource "azurerm_virtual_desktop_host_pool" "test" {
resource_group_name = azurerm_resource_group.test.name
type = "Pooled"
validate_environment = true
load_balancer_type = "BreadthFirst"
load_balancer_type = "DepthFirst"
}
`, data.RandomInteger, data.Locations.Secondary, data.RandomString)
}
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/virtual_desktop_host_pool.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ The following arguments are supported:

* `type` - (Required) The type of the Virtual Desktop Host Pool. Valid options are `Personal` or `Pooled`. Changing the type forces a new resource to be created.

* `load_balancer_type` - (Required) `BreadthFirst` load balancing distributes new user sessions across all available session hosts in the host pool. Possible values are `BreadthFirst`, `DepthFirst` and `Persistent`. Changing this forces a new resource to be created.
* `load_balancer_type` - (Required) `BreadthFirst` load balancing distributes new user sessions across all available session hosts in the host pool. Possible values are `BreadthFirst`, `DepthFirst` and `Persistent`.
`DepthFirst` load balancing distributes new user sessions to an available session host with the highest number of connections but has not reached its maximum session limit threshold.
`Persistent` should be used if the host pool type is `Personal`

Expand Down