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

Unable to update parameters of machine learning workspace's default datastore with azapi #694

Open
webczat opened this issue Dec 17, 2024 · 3 comments
Labels
bug Something isn't working upstream-swagger

Comments

@webczat
Copy link

webczat commented Dec 17, 2024

I wanted to reconfigure default datasource of azure ml workspace so that it uses managed identity for authentication. I used the "azapi_update_resource" resource.
However, when trying to do this, I get the following error in terraform logs:

The datastore workspaceblobstore is currently the workspace default, so it cannot be updated with isDefault set to false. To change the default, update a different datastore with isDefault set to true.

Here's my resource:

resource "azapi_update_resource" "workspaceblobstore" {
  type = "Microsoft.MachineLearningServices/workspaces/datastores@2024-10-01"
  name = "workspaceblobstore"
  parent_id = azurerm_machine_learning_workspace.ml_ws.id

 body = {
  "properties" = {
    "credentials" = {
      "credentialsType" = "None"
    }
    "serviceDataAccessAuthIdentity" = "WorkspaceSystemAssignedIdentity"
  }
 }
}

It seems that "isDefault" is a property marked readonly in schema, however trying to update the resource sets it to false, and that triggers the error. In addition, trying to set it to true or null in the resource body doesn't change the outcome.

I have done a test with az rest by reading the resource, modifying the authentication credentials properties and sending the update, and it worked, but only when "isDefault" was explicitly set to true.
This is actually an azure schema bug, however seems that azapi might need a way to work around bugs like this. Currently it ignores any tries to set it.

@ms-henglu ms-henglu added bug Something isn't working upstream-swagger labels Dec 18, 2024
@ms-henglu
Copy link
Member

Hi @webczat

Thank you for taking time to report this issue.

I'll work on improving this to make sure that the properties specified in the azapi_update_resource's body always are sent to the API.

Meanwhile, I have a workaround that might help with this case. The azapi_resource_action is used to trigger one http request, I think you could use it to make a "Patch"/"PUT" request to update the resource.

@webczat
Copy link
Author

webczat commented Dec 18, 2024

does the workaround require first retrieving data using a data source? because PATCH is not supported by the resource in question, and PUT requires sending original body with updates, not just updated elements.
Also it turned out I don't need to do that because somehow most of the settings needed are set by default already for this specific resource, which I didn't know at the time.

@ms-henglu
Copy link
Member

does the workaround require first retrieving data using a data source? because PATCH is not supported by the resource in question, and PUT requires sending original body with updates, not just updated elements.

Got it, then this workaround won't work for this case.

Also it turned out I don't need to do that because somehow most of the settings needed are set by default already for this specific resource, which I didn't know at the time.

Glad to see the issue is resolved anyway. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream-swagger
Projects
None yet
Development

No branches or pull requests

2 participants