terraform-provider-azapi
terraform-provider-azapi copied to clipboard
Microsoft.MachineLearningServices/workspaces/outboundRules returns MissingApiVersionParameter
Brief description of the problem
When using Microsoft.MachineLearningServices/workspaces/outboundRules@2023-10-01 as documented here to create outbound rules in the workspace. Terraform throws the following error, indicating that the api_version parameter is not set. However the documentation provides the version in the type parameter. The request itself actually has it specified which version is being used, so i dont understand how this error happens in the first place.
When applying the terraform code, an error with the message: RESPONSE 400: 400 Bad Request ERROR CODE: ValidationError happens. - {"error":{"code":"MissingApiVersionParameter","message":"The api-version query parameter (?api-version=) is required for all requests."}}
Terraform code:
resource "azapi_resource" "outbound_rules" {
type = "Microsoft.MachineLearningServices/workspaces/outboundRules@2023-10-01"
name = "CognitiveServiceOutboundRule"
parent_id = azurerm_machine_learning_workspace.default.id
locks = [azurerm_machine_learning_workspace.default.id]
body = jsonencode({
"properties": {
"category": "UserDefined",
"status": "Active",
"type": "PrivateEndpoint",
"destination": {
"serviceResourceId": "${azurerm_private_endpoint.openai_ple.id}",
"sparkEnabled": false,
"sparkStatus": "Inactive",
"subresourceTarget": "account"
}
}
})
}
Full stack trace of the error:
Error: Failed to create/update resource
with azapi_resource.outbound_rules,
on workspace.tf line 100, in resource "azapi_resource" "outbound_rules":
100: resource "azapi_resource" "outbound_rules" {
creating/updating Resource: (ResourceId
"/subscriptions/xxxxx/resourceGroups/xxxxx/providers/Microsoft.MachineLearningServices/workspaces/AIP-SB-Core-mlw/outboundRules/CognitiveServiceOutboundRule"
/ Api Version "20[23](https://github.com/xxxx/actions/runs/xxxxx#step:17:24)-10-01"): PUT
{"error":{"code":"MissingApiVersionParameter","message":"The api-version query parameter (?api-version=) is required for all requests."}}
--------------------------------------------------------------------------------
RESPONSE 400: 400 Bad Request
ERROR CODE: ValidationError
--------------------------------------------------------------------------------
{
"error": {
"code": "ValidationError",
"severity": null,
"message": "Unsupported Target resource Microsoft.Network/privateEndpoints in Rule: \"CognitiveServiceOutboundRule\". Check documentation for supported types:https://aka.ms/AMLSupportedPEsInManagedNetwork",
"messageFormat": null,
"messageParameters": null,
"referenceCode": null,
"detailsUri": null,
"target": null,
"details": [],
"innerError": null,
"debugInfo": null,
"additionalInfo": null
},
"correlation": {
"operation": "xxxx",
"request": "4717f16cd1228543"
},
"environment": "westeurope",
"location": "westeurope",
"time": "2024-05-08T08:55:20.4,
"componentName": "account-rp",
"statusCode": 400
}
--------------------------------------------------------------------------------
How to reproduce
Implement a private endpoint, a machine learning workspace in your terraform config. Specify type to this version: type = "Microsoft.MachineLearningServices/workspaces/outboundRules@2023-10-01"
Run the plan.
Apply, and it should fail.
Current workarounds/fixes
As of so far i have not been able to add private endpoint outbound rules to the resource. Any help would be greatly appreciated
How do i add a label to this?
Hi @emad0082 ,
Thank you for taking time to report this issue and apologize for late response.
There's a similar issue related to ML workspace outbound rules, and I shared some examples in the comment: https://github.com/Azure/terraform-provider-azapi/issues/453#issuecomment-2095200485
Please check if it could help in your case.
Thank you for responding, i will be attempting to use your example fixes and return once tested.
Alright
I have now tested the proposed solutions. And i can only get the FQDN rules to work. The privat endpoint outbound rules still returns the same error. This is after i have tested it with version 1.12.1 of the provider and the azapi_resource_action solution.
Currently i have found no solutions to provision private endpoint outbound Rules using Terraform.
@ms-henglu are there any updates to this issue?
@ms-henglu just an update.
We are now experiencing failures when provisioning outbound FQDN rules, which used to work without issues earlier this month. However, our team is experiencing problems when dynamically adding new FQDN rules. We are having the issue on both v1.13.1 and v1.12.1
When can we expect this to be worked on?
Hey @emad0082, sorry for the lack of response on this thread. To clarify, are you experiencing issues with new FQDN rules or existing ones?
Hey @ms-henglu
It seems there was issues on our end regarding the outbound FQDN rules.
The error message returned, "MissingApiVersionParameter," was not relevant to my scenario. The actual issue was a mistake in my code, as I tried to add workspace outbound settings while the workspace was in "disabled" mode. The error message should have indicated this specific problem, though. But i do not expect you guys to put time into such a small issue. I'd much rather the private endpoint outbpund rules problems was fixed.