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

Empty 'action' results in error properties` is not expected here, it's read onlyschema validate : Bug? #670

Open
dcw77 opened this issue Nov 13, 2024 · 1 comment

Comments

@dcw77
Copy link

dcw77 commented Nov 13, 2024

Be gentle, I'm not a Developer. I think I found a bug?

When I try to make a change to a setting using the azapi_resource_action if I use an action = "update" it fails. Seems to be adding 'update' to the end of the request.

performing action update of "Resource: (ResourceId \"/subscriptions/subscription-id/resourceGroups/rg-name/providers/Microsoft.DesktopVirtualization/hostPools/hp-avd-hostpool/sessionHosts/xx-xx-avda-01\" │ / Api Version \"2024-04-08-preview\")": PATCH │ https://management.azure.com/subscriptions/subsctiption/subscription-id/resourceGroups/rg-name/providers/Microsoft.DesktopVirtualization/hostPools/hp-avd-hostpool/sessionHosts/xx-xx-avda-01/update │ -------------------------------------------------------------------------------- │ RESPONSE 404: 404 Not Found │ ERROR CODE UNAVAILABLE │ -------------------------------------------------------------------------------- │ Response contained no body │ --------------------------------------------------------------------------------

resource "azapi_resource_action" "update_allow_new_session" {
  depends_on = [ azurerm_virtual_machine_extension.register_session_host ]
  for_each = toset(local.avdb_vm_names)

  type        = "Microsoft.DesktopVirtualization/hostPools/sessionHosts@2024-04-08-preview"
  resource_id = "/subscriptions/${data.azurerm_subscription.primary.subscription_id}/resourceGroups/${data.azurerm_resource_group.avd-pp.name}/providers/Microsoft.DesktopVirtualization/hostPools/${data.azurerm_virtual_desktop_host_pool.hostpool.name}/sessionHosts/${each.key}"
  action      = "update"
  method      = "PATCH"

  body = {
    
  "properties": {
    "allowNewSession": false
  }
  }
}

If I omit 'action' or leave it blank then VSCode complains that I am trying to perform an edit to a read only setting. However if I ignore it's complaints and run the plan and apply it then it is successful and the Session Hosts are put into Drain Mode as expected

resource "azapi_resource_action" "update_allow_new_session" {
  depends_on = [ azurerm_virtual_machine_extension.register_session_host ]
  for_each = toset(local.avdb_vm_names)

  type        = "Microsoft.DesktopVirtualization/hostPools/sessionHosts@2024-04-08-preview"
  resource_id = "/subscriptions/${data.azurerm_subscription.primary.subscription_id}/resourceGroups/${data.azurerm_resource_group.avd-pp.name}/providers/Microsoft.DesktopVirtualization/hostPools/${data.azurerm_virtual_desktop_host_pool.hostpool.name}/sessionHosts/${each.key}"
  action      = ""
  method      = "PATCH"

  body = {
    
  "properties": {
    "allowNewSession": false
  }
  }
}

Image

Thanks

@dcw77 dcw77 changed the title Empty 'action' results in error properties` is not expected here, it's read onlyschema validate Empty 'action' results in error properties` is not expected here, it's read onlyschema validate : Bug? Nov 13, 2024
@ms-henglu
Copy link
Member

Hi @dcw77 ,

Thank you for taking time to report this issue!

Yes, the error message comes from the VSCode extension, I'll work on improving it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants