Skip to content

azurermCosmosdbCassandraDatacenter

Manages a Cassandra Datacenter.

\~> NOTE: In order for the azureManagedInstancesForApacheCassandra to work properly the product requires the azureCosmosDb Application ID to be present and working in your tenant. If the azureCosmosDb Application ID is missing in your environment you will need to have an administrator of your tenant run the following command to add the azureCosmosDb Application ID to your tenant:

New-AzADServicePrincipal -ApplicationId a232010e-820c-4083-83bb-3ace5fc29d0b

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";
import * as azuread from "./.gen/providers/azuread";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm, azuread.
For a more precise conversion please use the --provider flag in convert.*/
new azurerm.provider.AzurermProvider(this, "azurerm", {
  features: [{}],
});
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "accexample-rg",
  }
);
const azurermVirtualNetworkExample = new azurerm.virtualNetwork.VirtualNetwork(
  this,
  "example_2",
  {
    address_space: ["10.0.0.0/16"],
    location: azurermResourceGroupExample.location,
    name: "example-vnet",
    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.*/
azurermVirtualNetworkExample.overrideLogicalId("example");
const dataAzureadServicePrincipalExample =
  new azuread.dataAzureadServicePrincipal.DataAzureadServicePrincipal(
    this,
    "example_3",
    {
      display_name: "Azure Cosmos DB",
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
dataAzureadServicePrincipalExample.overrideLogicalId("example");
const azurermRoleAssignmentExample = new azurerm.roleAssignment.RoleAssignment(
  this,
  "example_4",
  {
    principal_id: dataAzureadServicePrincipalExample.objectId,
    role_definition_name: "Network Contributor",
    scope: azurermVirtualNetworkExample.id,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermRoleAssignmentExample.overrideLogicalId("example");
const azurermSubnetExample = new azurerm.subnet.Subnet(this, "example_5", {
  address_prefixes: ["10.0.1.0/24"],
  name: "example-subnet",
  resource_group_name: azurermResourceGroupExample.name,
  virtual_network_name: azurermVirtualNetworkExample.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.*/
azurermSubnetExample.overrideLogicalId("example");
const azurermCosmosdbCassandraClusterExample =
  new azurerm.cosmosdbCassandraCluster.CosmosdbCassandraCluster(
    this,
    "example_6",
    {
      default_admin_password: "Password1234",
      delegated_management_subnet_id: azurermSubnetExample.id,
      depends_on: [`\${${azurermRoleAssignmentExample.fqn}}`],
      location: azurermResourceGroupExample.location,
      name: "example-cluster",
      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.*/
azurermCosmosdbCassandraClusterExample.overrideLogicalId("example");
const azurermCosmosdbCassandraDatacenterExample =
  new azurerm.cosmosdbCassandraDatacenter.CosmosdbCassandraDatacenter(
    this,
    "example_7",
    {
      availability_zones_enabled: false,
      cassandra_cluster_id: azurermCosmosdbCassandraClusterExample.id,
      delegated_management_subnet_id: azurermSubnetExample.id,
      disk_count: 4,
      location: azurermCosmosdbCassandraClusterExample.location,
      name: "example-datacenter",
      node_count: 3,
      sku_name: "Standard_DS14_v2",
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermCosmosdbCassandraDatacenterExample.overrideLogicalId("example");

Arguments Reference

The following arguments are supported:

  • name - (Required) The name which should be used for this Cassandra Datacenter. Changing this forces a new Cassandra Datacenter to be created.

  • location - (Required) The Azure Region where the Cassandra Datacenter should exist. Changing this forces a new Cassandra Datacenter to be created.

  • cassandraClusterId - (Required) The ID of the Cassandra Cluster. Changing this forces a new Cassandra Datacenter to be created.

  • delegatedManagementSubnetId - (Required) The ID of the delegated management subnet for this Cassandra Datacenter. Changing this forces a new Cassandra Datacenter to be created.

  • nodeCount - (Optional) The number of nodes the Cassandra Datacenter should have. The number should be equal or greater than 3. Defaults to 3.


  • backupStorageCustomerKeyUri - (Optional) The key URI of the customer key to use for the encryption of the backup Storage Account.

  • base64EncodedYamlFragment - (Optional) The fragment of the cassandra.yaml configuration file to be included in the cassandra.yaml for all nodes in this Cassandra Datacenter. The fragment should be Base64 encoded and only a subset of keys is allowed.

  • diskSku - (Optional) The Disk SKU that is used for this Cassandra Datacenter. Defaults to p30.

  • managedDiskCustomerKeyUri - (Optional) The key URI of the customer key to use for the encryption of the Managed Disk.

  • skuName - (Optional) Determines the selected sku.

  • diskCount - (Optional) Determines the number of p30 disks that are attached to each node.

  • availabilityZonesEnabled - (Optional) Determines whether availability zones are enabled. Defaults to true.

Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:

  • id - The ID of the Cassandra Datacenter.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 60 minutes) Used when creating the Cassandra Datacenter.
  • read - (Defaults to 5 minutes) Used when retrieving the Cassandra Datacenter.
  • update - (Defaults to 60 minutes) Used when updating the Cassandra Datacenter.
  • delete - (Defaults to 60 minutes) Used when deleting the Cassandra Datacenter.

Import

Cassandra Datacenters can be imported using the resourceId, e.g.

terraform import azurerm_cosmosdb_cassandra_datacenter.example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DocumentDB/cassandraClusters/cluster1/dataCenters/dc1