Terraform module which helps you quickly deploy an opinionated AI/RAG stack to Azure, provided by DataStax.
It offers multiple easy-to-deploy components, including:
- Langflow
- Astra Assistants API
- Astra Vector Databases
Links:
- Root git repo: https://github.com/datastax/terraform-datastax-ai-stack
- Module registry: https://registry.terraform.io/modules/datastax/ai-stack/azure/latest
You will, of course, need a valid Azure account, and have the azurerm provider set up.
You may want a custom domain to attach to the Langflow/Assistants services, but it is not required.
To allow the module to configure necessary any DNS/Custom Domain settings, you'll also need to have an Azure DNS zone set up; otherwise, you will manually have to register your custom domains.
module "datastax-ai-stack-azure" {
source = "datastax/ai-stack/azure"
version = "~> 1.0"
resource_group_config = {
create_resource_group = {
name = "datastax-ai-stack"
location = "East US"
}
}
domain_config = {
auto_azure_dns_setup = true
dns_zones = {
default = { dns_zone = var.dns_zone }
}
}
langflow = {
subdomain = "langflow"
postgres_db = {
sku_name = "B_Standard_B1ms"
}
}
assistants = {
subdomain = "assistants"
astra_db = {
deletion_protection = false
}
}
vector_dbs = [{
name = "my_db"
keyspaces = ["main_keyspace", "other_keyspace"]
deletion_protection = false
}]
}| Name | Version |
|---|---|
| astra | >= 2.3.3 |
| azurerm | >= 3.79.0 |
Sets the resource group to use for the deployment. If resource_group_name is set, that group will be used. If create_resource_group is set, a group will be created with the given options. One of the two must be set.
| Field | Description | Type |
|---|---|---|
| resource_group_name | The name of the resource group to use. | optional(string) |
| create_resource_group | Options to use when creating a new resource group. - name: The name of the resource group to create. - location: The location to create the resource group in (e.g. "East US"). |
optional(object({ |
Options for setting up domain names and DNS records.
| Field | Description | Type |
|---|---|---|
| auto_azure_dns_setup | If true, AzureDNS will be automatically set up. dns_zones must be set if this is true. Otherwise, the custom domains, if desired, must be set manually. |
bool |
| dns_zones | A map of components (or a default value) to their DNS zones. The valid keys are {default, langflow, assistants}. For each, dns_zone must be set, and resource_group_name may be set for further DNS zone filtering.- dns_zone: The name (e.g. "example.com") of the existing DNS zone to use. - resource_group_name: The resource group that the DNS zone is in. If not set, the first DNS zone matching the name will be used. |
optional(map(object({ |
Defaults for ECS deployments. Some fields may be overridable on a per-component basis.
| Field | Description | Type |
|---|---|---|
| min_instances | The minimum number of instances to run. Defaults to 1. Must be >= 1. | optional(number) |
| max_instances | The maximum number of instances to run. Defaults to 20. | optional(number) |
Options for the Astra Assistant API service.
| Field | Description | Type |
|---|---|---|
| subdomain | The subdomain to use for the service, if domain_config.auto_azure_dns_setup is true. Should be null if domain_config.auto_azure_dns_setup is false. |
optional(string) |
| containers | Environment variables to set for the service. - cpu: The amount of CPU to allocate to the service. Defaults to 1024. - memory: The amount of memory to allocate to the service. Defaults to "2048Mi". |
optional(object({ |
| deployment | Options for the deployment. - image_version: The image version to use for the deployment; defaults to "latest". - min_instances: The minimum number of instances to run. Defaults to 1. Must be >= 1. - max_instances: The maximum number of instances to run. Defaults to 20. |
optional(object({ |
| astra_db | Options for the database Astra Assistants uses. Will be created even if this is not set. - regions: The regions to deploy the database to. Defaults to the first available region. - cloud_provider: The cloud provider to use for the database. Defaults to "azure". - deletion_protection: The database can't be deleted when this value is set to true. The default is false. |
object({ |
Options for the Langflow service.
| Field | Description | Type |
|---|---|---|
| subdomain | The subdomain to use for the service, if domain_config.auto_azure_dns_setup is true. Should be null if domain_config.auto_azure_dns_setup is false. |
optional(string) |
| containers | Environment variables to set for the service. - cpu: The amount of CPU to allocate to the service. Defaults to 1. - memory: The amount of memory to allocate to the service. Defaults to "2Gi". |
optional(object({ |
| deployment | Options for the deployment. - image_version: The image version to use for the deployment; defaults to "latest". - min_instances: The minimum number of instances to run. Defaults to 1. Must be >= 1. - max_instances: The maximum number of instances to run. Defaults to 20. |
optional(object({ |
| postgres_db | Creates a basic Postgres instance to enable proper data persistence. Recommended to provide your own via the LANGFLOW_DATBASE_URL env var in production use cases. Will default to ephemeral SQLite instances if not set. - sku_name: The SKU Name for the PostgreSQL Flexible Server. The name of the SKU follows the tier + name pattern (e.g. B_Standard_B1ms, GP_Standard_D2s_v3, MO_Standard_E4s_v3). - max_storage: The max storage (in MB). Possible values are 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4193280, 4194304, 8388608, 16777216 and 33553408. Defaults to 32768 (MB). - location: The Azure Region where the db instance should exist. |
optional(object({ |
Quickly sets up vector-enabled Astra Databases for your project.
| Field | Description | Type |
|---|---|---|
| name | The name of the database to create. | string |
| regions | The regions to deploy the database to. Defaults to the first available region. | optional(set(string)) |
| keyspaces | The keyspaces to use for the database. The first keyspace will be used as the initial one for the database. Defaults to just "default_keyspace". | optional(list(string)) |
| cloud_provider | The cloud provider to use for the database. Defaults to "azure". | optional(string) |
| deletion_protection | The database can't be deleted when this value is set to true. The default is false. | optional(bool) |
A map of container apps to their fully-qualified domain names (if it exists)
"container_app_fqdns": {
"astra-assistants": "astra-assistants-service--123abcd.grayocean-1234abcd.eastus.azurecontainerapps.io",
"langflow": "langflow-service--123abcd.grayocean-1234abcd.eastus.azurecontainerapps.io",
}A map of DB IDs => DB info for all of the dbs created (from the assistants module and the vector_dbs module), e.g:
"astra_vector_dbs" = {
"12345678-abcd-efgh-1234-abcd1234efgh" = {
name = "assistant_api_db"
keyspaces = ["assistant_api"]
regions = ["us-east1"]
endpoint = "https://12345678-abcd-efgh-1234-abcd1234efgh-us-east1.apps.astra.datastax.com"
}
}