hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.61k stars 4.65k forks source link

Changing the capacity on azurerm_cognitive_deployment forces replacement #23226

Closed kliseb closed 1 year ago

kliseb commented 1 year ago

Is there an existing issue for this?

Community Note

Terraform Version

v1.5.2

AzureRM Provider Version

v3.72.0

Affected Resource(s)/Data Source(s)

azurerm_cognitive_deployment

Terraform Configuration Files

resource "azurerm_cognitive_account" "account" {
  location              = "eastus"
  resource_group_name   = var.rg_name
  name                  = "account-name"
  custom_subdomain_name = "subdomain-name"
  kind                  = "OpenAI"
  sku_name              = "S0"
}

resource "azurerm_cognitive_deployment" "deployment" {
  name                 = "name"
  cognitive_account_id = azurerm_cognitive_account.account.id
  model {
    format  = "OpenAI"
    name    = "gpt-35-turbo"
    version = "0301"
  }

  scale {
    type     = "Standard"
    capacity = 30
  }
}

Debug Output/Panic Output

-/+ resource "azurerm_cognitive_deployment" "deployment" {
      ~ id                   = "<deployment-id>" -> (known after apply)
        name                 = "name"
        # (2 unchanged attributes hidden)

      ~ scale {
          ~ capacity = 30 -> 29 # forces replacement
            # (1 unchanged attribute hidden)
        }

        # (1 unchanged block hidden)
    }

Expected Behaviour

Changing the capacity (in this example, from 30 to 29) I would expect not to force replacement of the deployment.

Actual Behaviour

If we want to change the capacity of our deployments, we must either change it through the azure portal or accept that our deployment won't exist for a short time. Perhaps azure also replaces the deployment silently in the background and there is no way to avoid replacing the deployment. If so, is there any azure documentation describing how they perform the capacity change?

Steps to Reproduce

No response

Important Factoids

No response

References

No response

liuwuliuyun commented 1 year ago

Hi @kliseb , thanks for raising this issue. I will try to test locally about this property and raise PR to fix it if possible.

kliseb commented 1 year ago

Hi @liuwuliuyun, we're running into the same problem with changing rai_policy_name. Should I open a new issue for this?

kliseb commented 1 year ago

I found a bug, so I'll open a new issue

github-actions[bot] commented 6 months ago

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.