Closed jeanpaulsmit closed 7 months ago
Actually, I think the naming is confusing. I think it's looking for the Id of a user, not the user_id, so maybe this can be solved by renaming.
@jeanpaulsmit The user_id
is a resource ID not a simple ID as an number.
Example user_id
:
"/subscriptions/{subID}resourceGroups/{resourceGroup}/providers/Microsoft.ApiManagement/service/{APIMService}/users/{id}"
@xuzhang3 yes, correct, but exactly that fact makes the naming confusing.
user_id
is not supposed to be the id of the user, but the id of the resource.
@jeanpaulsmit Yes, the name here is confusing. This property should rename to owner_id
as the API(https://docs.microsoft.com/en-us/rest/api/apimanagement/current-ga/subscription/create-or-update#request-body) defines and the doc should document that this is a user ID path not a simple numeric ID.
Thanks for opening this issue. This was a problem in the 2.x version of the provider which is no longer actively maintained. If this is still an issue with the 3.x version of the provider please do let us know by opening a new issue, thanks!
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.
Community Note
Terraform (and AzureRM Provider) Version
Terraform 0.12.31 AzureRM 2.92
Affected Resource(s)
azurerm_api_management_subscription
Debug Output
Error: Can not parse "user_id" as a resource id: Cannot parse Azure ID: parse "1": invalid URI for request2022-01-22T23:55:55.062+0100 [WARN] plugin.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
Expected Behaviour
Allow to set the subscription key on the Administrator for a certain product.
Actual Behaviour
Error: Can not parse "user_id" as a resource id: Cannot parse Azure ID: parse "1": invalid URI for request2022-01-22T23:55:55.062+0100 [WARN] plugin.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
I would expect to be able to set the subscription key on the administrator account, and leave the display name empty like is in the portal for administrator accounts.
Steps to Reproduce
Try to set the subscription key for the Administrator user, which can be found as "1" in the list of users. However, this is not accepted by the apply command.
resource "azurerm_api_management_subscription" "subscriptionManagementAdmin" { api_management_name = azurerm_api_management.apim.name resource_group_name = azurerm_resource_group.rg.name product_id = "productId" user_id = "1" display_name = "Administrator" state = "active" primary_key = "abc" allow_tracing = true }
terraform apply
0000