azurermCosmosdbCassandraTable
Manages a Cassandra Table within a Cosmos DB Cassandra Keyspace.
Example Usage
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
this,
"example",
{
location: "West Europe",
name: "tflex-cosmosdb-account-rg",
}
);
const azurermCosmosdbAccountExample =
new azurerm.cosmosdbAccount.CosmosdbAccount(this, "example_1", {
capabilities: [
{
name: "EnableCassandra",
},
],
consistency_policy: [
{
consistency_level: "Strong",
},
],
geo_location: [
{
failover_priority: 0,
location: azurermResourceGroupExample.location,
},
],
location: azurermResourceGroupExample.location,
name: "tfex-cosmosdb-account",
offer_type: "Standard",
resource_group_name: azurermResourceGroupExample.name,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermCosmosdbAccountExample.overrideLogicalId("example");
const azurermCosmosdbCassandraKeyspaceExample =
new azurerm.cosmosdbCassandraKeyspace.CosmosdbCassandraKeyspace(
this,
"example_2",
{
account_name: azurermCosmosdbAccountExample.name,
name: "tfex-cosmos-cassandra-keyspace",
resource_group_name: azurermCosmosdbAccountExample.resourceGroupName,
throughput: 400,
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermCosmosdbCassandraKeyspaceExample.overrideLogicalId("example");
const azurermCosmosdbCassandraTableExample =
new azurerm.cosmosdbCassandraTable.CosmosdbCassandraTable(this, "example_3", {
cassandra_keyspace_id: azurermCosmosdbCassandraKeyspaceExample.id,
name: "testtable",
schema: [
{
column: [
{
name: "test1",
type: "ascii",
},
{
name: "test2",
type: "int",
},
],
partition_key: [
{
name: "test1",
},
],
},
],
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermCosmosdbCassandraTableExample.overrideLogicalId("example");
Argument Reference
The following arguments are supported:
-
name
- (Required) Specifies the name of the Cosmos DB Cassandra Table. Changing this forces a new resource to be created. -
cassandraKeyspaceId
- (Required) The ID of the Cosmos DB Cassandra Keyspace to create the table within. Changing this forces a new resource to be created. -
schema
- (Required) Aschema
block as defined below. -
throughput
- (Optional) The throughput of Cassandra KeySpace (RU/s). Must be set in increments of100
. The minimum value is400
. This must be set upon database creation otherwise it cannot be updated without a manual terraform destroy-apply. -
defaultTtl
- (Optional) Time to live of the Cosmos DB Cassandra table. Possible values are at least1
.1
means the Cassandra table never expires. -
analyticalStorageTtl
- (Optional) Time to live of the Analytical Storage. Possible values are between1
and2147483647
except0
.1
means the Analytical Storage never expires. Changing this forces a new resource to be created.
\~> Note: throughput has a maximum value of 1000000
unless a higher limit is requested via Azure Support
autoscaleSettings
- (Optional) AnautoscaleSettings
block as defined below. This must be set upon database creation otherwise it cannot be updated without a manual terraform destroy-apply.
\~> Note: Switching between autoscale and manual throughput is not supported via Terraform and must be completed via the Azure Portal and refreshed.
An autoscaleSettings
block supports the following:
maxThroughput
- (Optional) The maximum throughput of the Cassandra Table (RU/s). Must be between1,000
and1,000,000
. Must be set in increments of1,000
. Conflicts withthroughput
.
A schema
block supports the following:
column
- (Required) One or morecolumn
blocks as defined below.partitionKey
- (Required) One or morepartitionKey
blocks as defined below.clusterKey
- (Optional) One or moreclusterKey
blocks as defined below.
A column
block supports the following:
name
- (Required) Name of the column to be created.type
- (Required) Type of the column to be created.
A clusterKey
block supports the following:
name
- (Required) Name of the cluster key to be created.orderBy
- (Required) Order of the key. Currently supported values areasc
anddesc
.
A partitionKey
block supports the following:
name
- (Required) Name of the column to partition by.
Attributes Reference
The following attributes are exported:
id
- the ID of the CosmosDB Cassandra Table.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the CosmosDB Cassandra KeySpace.update
- (Defaults to 30 minutes) Used when updating the CosmosDB Cassandra KeySpace.read
- (Defaults to 5 minutes) Used when retrieving the CosmosDB Cassandra KeySpace.delete
- (Defaults to 30 minutes) Used when deleting the CosmosDB Cassandra Table.
Import
Cosmos Cassandra Table can be imported using the resourceId
, e.g.