Creating a table in Cosmos Cassandra with static property along with the datatype fails! Creating a table using CQL after the keyspace is deployed works fine with static fields. Anyone else facing same or similar issues? Here is a github issue: https://github.com/Azure/azure-rest-api-specs/issues/26506
I tried running terraform apply with the below script
resource "azurerm_resource_group" "example" {
name = "tflex-cosmosdb-account-rg"
location = "West Europe"
}
resource "azurerm_cosmosdb_account" "example" {
name = "tfex-cosmosdb-account"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
offer_type = "Standard"
capabilities {
name = "EnableCassandra"
}
consistency_policy {
consistency_level = "Strong"
}
geo_location {
location = azurerm_resource_group.example.location
failover_priority = 0
}
}
resource "azurerm_cosmosdb_cassandra_keyspace" "example" {
name = "tfex-cosmos-cassandra-keyspace"
resource_group_name = azurerm_cosmosdb_account.example.resource_group_name
account_name = azurerm_cosmosdb_account.example.name
throughput = 400
}
resource "azurerm_cosmosdb_cassandra_table" "example" {
name = "testtable"
cassandra_keyspace_id = azurerm_cosmosdb_cassandra_keyspace.example.id
schema {
column {
name = "id"
type = "uuid"
}
column {
name = "type"
type = "text"
}
column {
name = "source"
type = "text"
}
column {
name = "time"
type = "timestamp"
}
column {
name = "entity"
type = "text"
}
column {
name = "ownerid"
type = "uuid"
}
column {
name = "ownertype"
type = "text"
}
column {
name = "data"
type = "blob"
}
column {
name = "sequence"
type = "int"
}
column {
name = "cloudeventview"
type = "blob static"
}
column {
name = "lastupdated"
type = "timestamp static"
}
partition_key {
name = "ownertype"
}
partition_key {
name = "ownerid"
}
cluster_key {
name = "sequence"
order_by = "Desc"
}
}
}
Table got created, but without static fields. According to the documentation from Azure Static is supported for datatype declaration.
In Cassandra, static columns are shared by all rows of the same partition.
Looking at your Terraform script, you've defined the
cloudeventviewandlastupdatedcolumns as static. However, the issue might be in the syntax used for defining static columns. The standard syntax for defining a static column in CQL iscolumn_name type static, but this syntax might not translate directly in Terraform.Ensure that the Terraform provider you are using supports the syntax for defining static columns. It's possible that the syntax might be different or that the current version of the provider has limitations
My terraform configuration:
main.tf:
Output:
ref: Apache Cassandra features supported by Azure Cosmos DB for Apache Cassandra | Microsoft Learn