hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.59k stars 4.62k forks source link

`azurerm_virtual_desktop_application_group` should force new on `host_pool_id` change #19687

Closed jrwesolo closed 1 year ago

jrwesolo commented 1 year ago

Is there an existing issue for this?

Community Note

Terraform Version

1.3.5

AzureRM Provider Version

3.35.0

Affected Resource(s)/Data Source(s)

azurerm_virtual_desktop_application_group

Terraform Configuration Files

resource "azurerm_resource_group" "example" {
  name     = "rg-example-virtualdesktop"
  location = "West Europe"
}

resource "azurerm_virtual_desktop_host_pool" "pooledbreadthfirst" {
  name                = "pooledbreadthfirst"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name

  type               = "Pooled"
  load_balancer_type = "BreadthFirst"
}

resource "azurerm_virtual_desktop_host_pool" "pooleddepthfirst" {
  name                = "pooleddepthfirst"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name

  type                             = "Personal"
  load_balancer_type               = "DepthFirst"
}

# Initially point app group to pooledbreadthfirst host pool
resource "azurerm_virtual_desktop_application_group" "remoteapp" {
  name                = "acctag"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name

  type          = "RemoteApp"
  host_pool_id  = azurerm_virtual_desktop_host_pool.pooledbreadthfirst.id
  friendly_name = "TestAppGroup"
  description   = "Acceptance Test: An application group"
}

Debug Output/Panic Output

N/A

Expected Behaviour

I would expect the application group to change the host pool it is pointing at.

Actual Behaviour

Host pool id is not updated on app group. It appears that this property is not editable and should be set to ForceNew in the resource code. The azure API for application groups also does not appear to have a field to update the host pool id.

Steps to Reproduce

  1. terraform apply
  2. Notice app group is pointing at pooledbreadthfirst host pool
  3. Change app group host_pool_id to point at pooleddepthfirst host pool
  4. terraform apply, notice TF detects the diff and applies change
  5. Check azure portal and notice app group is still pointing at pooledbreadthfirst
  6. Rerun terraform apply and see same diff in step 4

Important Factoids

No response

References

https://learn.microsoft.com/en-us/rest/api/desktopvirtualization/application-groups/update?tabs=HTTP https://github.com/hashicorp/terraform-provider-azurerm/blob/main/internal/services/desktopvirtualization/virtual_desktop_application_group_resource.go#L81-L85

sinbai commented 1 year ago

@jrwesolo thanks for opening this issue. I have submitted PR to fix it. Could you keep track of it for more updates?

jrwesolo commented 1 year ago

@sinbai thank you! I appreciate the quick response. I'll keep an eye on the PR.

github-actions[bot] commented 1 year ago

This functionality has been released in v3.38.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

github-actions[bot] commented 1 year ago

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.