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

Microsoft.MachineLearningServices/workspaces/outboundRules returns MissingApiVersionParameter #498

Open
emad0082 opened this issue May 8, 2024 · 4 comments

Comments

@emad0082
Copy link

emad0082 commented May 8, 2024

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

@emad0082
Copy link
Author

How do i add a label to this?

@ms-henglu
Copy link
Collaborator

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: #453 (comment)

Please check if it could help in your case.

@emad0082
Copy link
Author

Thank you for responding, i will be attempting to use your example fixes and return once tested.

@emad0082
Copy link
Author

Alright @ms-henglu

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.

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