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

Too many partition key paths for partition key path parameter in CosmosDB SQL Database containers deployment using Terraform #28310

Open
1 task done
waynebrantley opened this issue Dec 17, 2024 · 1 comment

Comments

@waynebrantley
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 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.9.6

AzureRM Provider Version

4.14.-

Affected Resource(s)/Data Source(s)

azurerm_cosmosdb_sql_container

Terraform Configuration Files

resource "azurerm_cosmosdb_sql_container" "example" {
  name                  = "example-container"
  resource_group_name   = data.azurerm_cosmosdb_account.example.resource_group_name
  account_name          = data.azurerm_cosmosdb_account.example.name
  database_name         = azurerm_cosmosdb_sql_database.example.name
  partition_key_paths   = ["/definition/id", "/definition/state"]
  partition_key_version = 1
}

Debug Output/Panic Output

Too many partition key paths (2) specified. A maximum of 1 is allowed

Expected Behaviour

should have used the paths

Actual Behaviour

gave error of Too many partition key paths (2) specified. A maximum of 1 is allowed

Steps to Reproduce

terraform apply

Important Factoids

No response

References

Like this issue - but using 'paths' correctly. #26961

@neil-yechenwei
Copy link
Contributor

Thanks for raising this issue. Seems it works fine with below tf config. Hopes it would be helpful.

provider "azurerm" {
  features {}
}

resource "azurerm_resource_group" "test" {
  name     = "acctestRG-cosmos-test01"
  location = "eastus"
}

resource "azurerm_cosmosdb_account" "test" {
  name                = "acctest-ca-test01"
  location            = azurerm_resource_group.test.location
  resource_group_name = azurerm_resource_group.test.name
  offer_type          = "Standard"
  kind                = "GlobalDocumentDB"

  consistency_policy {
    consistency_level = "Strong"
  }

  geo_location {
    location          = azurerm_resource_group.test.location
    failover_priority = 0
  }
}

resource "azurerm_cosmosdb_sql_database" "test" {
  name                = "acctest-csd-test01"
  resource_group_name = azurerm_cosmosdb_account.test.resource_group_name
  account_name        = azurerm_cosmosdb_account.test.name
}

resource "azurerm_cosmosdb_sql_container" "test" {
  name                  = "acctest-CSQLC-test01"
  resource_group_name   = azurerm_cosmosdb_account.test.resource_group_name
  account_name          = azurerm_cosmosdb_account.test.name
  database_name         = azurerm_cosmosdb_sql_database.test.name
  partition_key_kind    = "MultiHash"
  partition_key_paths   = ["/definition", "/id", "/sessionId"]
  partition_key_version = 2
}

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