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

azurerm_cognitive_deployment does not support tier in PUT #28376

Open
1 task done
stuartin opened this issue Dec 24, 2024 · 3 comments
Open
1 task done

azurerm_cognitive_deployment does not support tier in PUT #28376

stuartin opened this issue Dec 24, 2024 · 3 comments

Comments

@stuartin
Copy link

stuartin commented Dec 24, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment and review the contribution guide to help.

Terraform Version

1.10.2

AzureRM Provider Version

4.14.0

Affected Resource(s)/Data Source(s)

azurerm_cognitive_deployment

Terraform Configuration Files

provider "azurerm" {
  features {}
}

resource "azurerm_resource_group" "example" {
  name     = "sb-example-rg"
  location = "canadaeast"
}

resource "azurerm_cognitive_account" "example" {
  name                = "sb-example-ca"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  kind                = "OpenAI"
  sku_name            = "S0"
}

resource "azurerm_cognitive_deployment" "example" {
  name                 = "sb-example-cd"
  cognitive_account_id = azurerm_cognitive_account.example.id

  model {
    format = "OpenAI"
    name   = "text-embedding-ada-002"
  }

  sku {
    name = "Standard"
    tier = "Standard"
  }
}

Debug Output/Panic Output

│ Error: creating Deployment (Subscription: "xxx-xxx-xxx-xxx-xxx"
│ Resource Group Name: "sb-example-rg"
│ Account Name: "sb-example-ca"
│ Deployment Name: "sb-example-cd"): performing CreateOrUpdate: unexpected status 400 (400 Bad Request) with error: InvalidRequestContent: The request content was invalid and could not be deserialized.   
│
│   with azurerm_cognitive_deployment.example,
│   on main.tf line 27, in resource "azurerm_cognitive_deployment" "example":
│   27: resource "azurerm_cognitive_deployment" "example" {
│
│ creating Deployment (Subscription: "xxx-xxx-xxx-xxx-xxx"
│ Resource Group Name: "sb-example-rg"
│ Account Name: "sb-example-ca"
│ Deployment Name: "sb-example-cd"): performing CreateOrUpdate: unexpected status 400 (400 Bad Request) with error: InvalidRequestContent: The request content was invalid and could not be deserialized.

---

2024-12-23T16:03:14.244-0800 [DEBUG] provider.terraform-provider-azurerm_v4.14.0_x5.exe: {"properties":{"model":{"format":"OpenAI","name":"text-embedding-ada-002"},"versionUpgradeOption":"OnceNewDefaultVersionAvailable"},"sku":{"capacity":1,"name":"Standard","tier":"Standard"}}
2024-12-23T16:03:14.244-0800 [DEBUG] provider.terraform-provider-azurerm_v4.14.0_x5.exe: [DEBUG] PUT https://management.azure.com/subscriptions/xxx-xxx-xxx-xxx-xxx/resourceGroups/sb-example-rg/providers/Microsoft.CognitiveServices/accounts/sb-example-ca/deployments/sb-example-cd?api-version=2024-10-01
2024-12-23T16:03:14.711-0800 [DEBUG] provider.terraform-provider-azurerm_v4.14.0_x5.exe: [DEBUG] AzureRM Response for https://management.azure.com/subscriptions/xxx-xxx-xxx-xxx-xxx/resourceGroups/sb-example-rg/providers/Microsoft.CognitiveServices/accounts/sb-example-ca/deployments/sb-example-cd?api-version=2024-10-01: 
2024-12-23T16:03:14.711-0800 [DEBUG] provider.terraform-provider-azurerm_v4.14.0_x5.exe: HTTP/2.0 400 Bad Request

Expected Behaviour

I would expect that the azurerm_cognitive_deployment to be successful and NOT send the tier property in the API request as its not supported on PUT operations.

The CREATE succeeds when the tier attribute is removed from configuration

Actual Behaviour

The tier property is sent in the API request on create (PUT) operations, which is not supported

Steps to Reproduce

  1. terraform init
  2. terraform apply

Important Factoids

No

References

https://learn.microsoft.com/en-us/rest/api/aiservices/accountmanagement/deployments/create-or-update#skutier

@liuwuliuyun
Copy link
Contributor

Hi @stuartin, thank you for bringing this to our attention. As mentioned here, it is optional to specify the tier property in azurerm_cognitive_deployment. Therefore, as you suggested, removing the tier property from the configuration will resolve the issue.

@liuwuliuyun
Copy link
Contributor

Plus, according to the document, you don't need to specify the tier in the SKU block if there's only one tier. But if there are multiple tiers, we still need to include this property. So, removing it doesn't really make sense.

@stuartin
Copy link
Author

Thanks @liuwuliuyun.
I guess the terraform docs were a little unclear that the tier prop should only be specified if there are multiple tier's available in the SKU and if there is only one it should be excluded completely otherwise the PUT requests will fail.

I tried to find an example to test and validate this, but came up dry.
Not sure if you would like to update the variable description, otherwise feel free to close this off.

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

No branches or pull requests

2 participants