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

Multiple azurerm_cognitive_deployments result in a "Another operation is being performed on the parent resource" error #22607

Closed
1 task done
msha1026 opened this issue Jul 19, 2023 · 4 comments · Fixed by #22711

Comments

@msha1026
Copy link

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 "+1" or "me too" comments, 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.5.3

AzureRM Provider Version

3.65.0

Affected Resource(s)/Data Source(s)

azurerm_cognitive_deployment

Terraform Configuration Files

resource "azurerm_cognitive_account" "cognitive_account" {
  name                = "${var.prefix}-${var.project}-openai-${var.environment}"
  location            = var.location
  resource_group_name = var.resource_group_name
  kind                = "OpenAI"
  sku_name            = "S0"
}

resource "azurerm_cognitive_deployment" "gpt35turbo" {
  name                 = "chat"
  cognitive_account_id = azurerm_cognitive_account.cognitive_account.id

  model {
    format  = "OpenAI"
    name    = "gpt-35-turbo"
    version = "0301"
  }

  scale {
    type = "Standard"
  }
}

resource "azurerm_cognitive_deployment" "ada" {
  name                 = "embedding-ada"
  cognitive_account_id = azurerm_cognitive_account.cognitive_account.id

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

  scale {
    type = "Standard"
  }
}

Debug Output/Panic Output

│ Error: creating Deployment (Subscription: "***"
│ Resource Group Name: "***"
│ Account Name: "cpg-copilot-openai-tst"
│ Deployment Name: "embedding-ada"): performing CreateOrUpdate: unexpected status 409 with error: RequestConflict: Another operation is being performed on the parent resource '/subscriptions/***/resourceGroups/***/providers/Microsoft.CognitiveServices/accounts/cpg-copilot-openai-tst'. Please try again later.
│ 
│   with module.copilot_platform.azurerm_cognitive_deployment.ada,
│   on modules/platform/cognitive.tf line 39, in resource "azurerm_cognitive_deployment" "ada":
│   39: resource "azurerm_cognitive_deployment" "ada" {
│ 
│ creating Deployment (Subscription: "***"
│ Resource Group Name: "***"
│ Account Name: "cpg-copilot-openai-tst"
│ Deployment Name: "embedding-ada"): performing CreateOrUpdate: unexpected
│ status 409 with error: RequestConflict: Another operation is being
│ performed on the parent resource
│ '/subscriptions/***/resourceGroups/***/providers/Microsoft.CognitiveServices/accounts/cpg-copilot-openai-tst'.
│ Please try again later.

Expected Behaviour

Successfully created multiple OpenAI model deployments (assuming there's some retry logic under the hood).

Actual Behaviour

Failed to create multiple OpenAI model deployments.

Steps to Reproduce

No response

Important Factoids

No response

References

No response

@liuwuliuyun
Copy link
Contributor

Hi @msha1026 , thanks for raising this issue. As the error message suggests, creating deployments is only able to do sequentially. I think you could try the depend_on meta to make the second deployment depend on the first one as a workaround. For azurerm devs, we could add locks to the parent resource and avoid having this problem. I will start implementing this later. Let me know if you have more questions on this.

@msha1026
Copy link
Author

Great, makes sense. We will use the depends_on workaround for now. Thank you, @liuwuliuyun!

@Erzangel
Copy link

Hello, I am in a case where I create the azurerm_cognitive_deployment through a count and therefore cannot use the depends-on workaround.

i.e. if my count is set to 3, I am almost sure to run into the above error.

If locks to the parent resource make it so that each resource in the count is applied sequentially, this does seem like the correct solution!

Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants