Skip to content

azurermCosmosdbCassandraKeyspace

Manages a Cassandra KeySpace within a Cosmos DB Account.

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");

Argument Reference

The following arguments are supported:

  • name - (Required) Specifies the name of the Cosmos DB Cassandra KeySpace. Changing this forces a new resource to be created.

  • resourceGroupName - (Required) The name of the resource group in which the Cosmos DB Cassandra KeySpace is created. Changing this forces a new resource to be created.

  • accountName - (Required) The name of the Cosmos DB Cassandra KeySpace to create the table within. Changing this forces a new resource to be created.

  • throughput - (Optional) The throughput of Cassandra KeySpace (RU/s). Must be set in increments of 100. The minimum value is 400. This must be set upon database creation otherwise it cannot be updated without a manual terraform destroy-apply.

\~> Note: throughput has a maximum value of 1000000 unless a higher limit is requested via Azure Support

  • autoscaleSettings - (Optional) An autoscaleSettings 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 KeySpace (RU/s). Must be between 1,000 and 1,000,000. Must be set in increments of 1,000. Conflicts with throughput.

Attributes Reference

The following attributes are exported:

  • id - the ID of the CosmosDB Cassandra KeySpace.

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 KeySpace.

Import

Cosmos Cassandra KeySpace can be imported using the resourceId, e.g.

terraform import azurerm_cosmosdb_cassandra_keyspace.ks1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/account1/cassandraKeyspaces/ks1