# terraform-gcp-ai-stack **Repository Path**: mirrors_datastax/terraform-gcp-ai-stack ## Basic Information - **Project Name**: terraform-gcp-ai-stack - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-07-25 - **Last Updated**: 2025-12-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # DataStax AI stack (GCP) Terraform module which helps you quickly deploy an opinionated AI/RAG stack to GCP, 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/gcp/latest ## Prerequisites You will, of course, need a valid GCP account, and have the `google` provider set up. You may want a custom domain to attach to the Langflow/Assistants services, but it is not required. ## Basic usage ```hcl module "datastax-ai-stack-gcp" { source = "datastax/ai-stack/gcp" version = "~> 1.0" project_config = { create_project = { billing_account = var.billing_account } } domain_config = { auto_cloud_dns_setup = true managed_zones = { default = { dns_name = "${var.dns_name}." } } } langflow = { domain = "langflow.${var.dns_name}" postgres_db = { tier = "db-f1-micro" deletion_protection = false } } assistants = { domain = "assistants.${var.dns_name}" astra_db = { deletion_protection = false } } vector_dbs = [{ name = "my_db" keyspaces = ["main_keyspace", "other_keyspace"] deletion_protection = false }] } ``` ## Required providers | Name | Version | |--------|-----------| | astra | >= 2.3.3 | | google | >= 5.12.0 | ## Inputs ### `project_config` (required) Sets the project to use for the deployment. If `project_id` is set, that project will be used. If `create_project` is set, a project will be created with a randomly generated ID and the given options. One of the two must be set. | Field | Description | Type | | ----------------- | ----------- | ---- | | project_id | The ID of the project to use. | `optional(string)` | | create_project | Options to use when creating a new project.
- name: The name of the project to create. If not set, a random name will be generated.
- org_id: The ID of the organization to create the project in.
- billing_account: The ID of the billing account to associate with the project. |
optional(object({
name = optional(string)
org_id = optional(string)
billing_account = string
}))
| ### `domain_config` (required if using DNS) Options for setting up domain names and DNS records. | Field | Description | Type | | ---------------------- | ----------- | ---- | | auto_cloud_dns_setup | If `true`, Cloud DNS will be automatically set up. `managed_zones` must be set if this is true. If true, a `name_servers` map will be output; otherwise, you must set each domain to the output `load_balancer_ip` w/ an A record. | `bool` | | managed_zones | A map of components (or a default value) to their managed zones. The valid keys are {default, langflow, assistants}. For each, either `dns_name` or `zone_name` must be set.
- dns_name: The DNS name (e.g. "example.com.") to use for the managed zone (which will be created).
- zone_name: The ID of the existing managed zone to use. |
optional(map(object({
dns_name = optional(string)
zone_name = optional(string)
})))
| ### `deployment_defaults` (optional) 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)` | | location | The location of the cloud run services. | `optional(string)` | ### `assistants` (optional) Options for the Astra Assistant API service. | Field | Description | Type | | ------------ | ----------- | ---- | | domain | The domain name to use for the service; used in the listener routing rules. | `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 "2048Mi". |
optional(object({
env = optional(map(string))
cpu = optional(string)
memory = optional(string)
}))
| | 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.
- location: The location of the cloud run service. |
optional(object({
image_version = optional(string)
min_instances = optional(number)
max_instances = optional(number)
location = optional(string)
}))
| | 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 "gcp".
- deletion_protection: The database can't be deleted when this value is set to true. The default is false. |
optional(object({
regions = optional(set(string))
deletion_protection = optional(bool)
cloud_provider = optional(string)
}))
| ### `langflow` (optional) Options for the Langflow service. | Field | Description | Type | | ------------ | ----------- | ---- | | domain | The domain name to use for the service; used in the listener routing rules. | `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 2048 (Mi). |
optional(object({
env = optional(map(string))
cpu = optional(string)
memory = optional(string)
}))
| | 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.
- location: The location of the cloud run service. |
optional(object({
image_version = optional(string)
min_instances = optional(number)
max_instances = optional(number)
location = optional(string)
}))
| | 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.
- tier: The machine type to use. https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1beta4/tiers
- region: The region for the db instance; defaults to the provider's region.
- deletion_protection: The database can't be deleted when this value is set to true. The default is false.
- initial_storage: The size of the data disk in GB. Must be >= 10GB.
- max_storage: The maximum size to which the storage capacity can be autoscaled. The default value is 0, which specifies that there is no limit. |
optional(object({
tier = string
region = optional(string)
deletion_protection = optional(bool)
initial_storage = optional(number)
max_storage = optional(number)
}))
| ### `vector_dbs` (optional) 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 "gcp". | `optional(string)` | | deletion_protection | The database can't be deleted when this value is set to true. The default is false. | `optional(bool)` | ## Outputs ### `load_balancer_ip` (`string`) The IP address of the created ELB through which to access the Cloud Run services w/ a custom domain ### `project_id` (`string`) The ID of the created project (or regurgitated if an existing one was used) ### `nameservers` (`map(list(string))`) The nameservers that need to be set for any created managed zones, e.g: ```hcl "name_servers" = { "gcp.example.com." = tolist([ "ns-cloud-c1.googledomains.com.", "ns-cloud-c2.googledomains.com.", "ns-cloud-c3.googledomains.com.", "ns-cloud-c4.googledomains.com.", ]) } ``` ### `service_uris` (`map(string)`) The map of the services to the URLs you would use to access them, e.g.: ```hcl "service_uris" = { "assistants" = "https://astra-assistants-service-abcdefghij-kl.a.run.app" "langflow" = "https://langflow.gcp.example.com" } ``` ### `astra_vector_dbs` (`map(object)`) A map of DB IDs => DB info for all of the dbs created (from the `assistants` module and the `vector_dbs` module), e.g: ```hcl "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" } } ```