> ## Documentation Index
> Fetch the complete documentation index at: https://docs.asymptotelabs.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Terraform

> Create the Kubernetes cluster and services self-hosted Asymptote needs on AWS, Google Cloud or Azure.

> [!NOTE]
>
> **Planned release.** Self-hosted Asymptote is in development and offered to design partners through a Private Deployment engagement; the Helm chart and Terraform modules described in this section are not generally available yet. This section describes the planned release: chart names, values keys and paths may change before it ships. Today's Asymptote Cloud dashboard uses hosted services for sign-in and product analytics; the self-hosted release replaces them, as described in [System Architecture](https://docs.asymptotelabs.ai/self-hosting/system-architecture.md#hosted-services-in-asymptote-cloud). [Contact us](https://asymptotelabs.ai/contact) to take part.

Asymptote's reference Terraform creates everything the [Helm chart](https://docs.asymptotelabs.ai/self-hosting/kubernetes.md) needs in an empty account, project or subscription. Use it as is, or as a starting point for your own modules. It does not install the chart; do that next, with the outputs it prints.

## What it creates

| | AWS | Google Cloud | Azure |
| - | - | - | - |
| Network | VPC with private subnets and NAT | VPC with private subnets and Cloud NAT | Virtual network with private subnets and NAT gateway |
| Kubernetes | EKS cluster and node groups | GKE cluster and node pools | AKS cluster and node pools |
| PostgreSQL | RDS for PostgreSQL, Multi-AZ | Cloud SQL for PostgreSQL, high availability | Azure Database for PostgreSQL flexible server, zone-redundant |
| Object storage | S3 bucket, SQS queues with dead-letter queues | Cloud Storage bucket, Pub/Sub topic and subscriptions | Storage account and container, Event Grid to a Storage queue |
| Encryption | KMS key for the bucket, database and volumes | Cloud KMS key for the bucket, database and disks | Key Vault key for the storage account, database and disks |
| Identity for pods | IAM roles for service accounts | Workload Identity | Workload identity |
| Ingress | AWS Load Balancer Controller and ACM certificate | GKE Gateway and Google-managed certificate | Application Gateway for Containers |

Pods reach the bucket, queues and secrets through workload identity, so no cloud access keys are created.

## Setup

> [tab] AWS
>
> ```hcl title="main.tf" theme={null}
> module "asymptote" {
>   source = "<module source>/aws?ref=<version>"
>
>   name   = "asymptote"
>   region = "us-east-1"
>   domain = "asymptote.example.com"
> }
>
> output "helm_values" {
>   value = module.asymptote.helm_values
> }
> ```

> [tab] Google Cloud
>
> ```hcl title="main.tf" theme={null}
> module "asymptote" {
>   source = "<module source>/gcp?ref=<version>"
>
>   name    = "asymptote"
>   project = "example-project"
>   region  = "us-central1"
>   domain  = "asymptote.example.com"
> }
>
> output "helm_values" {
>   value = module.asymptote.helm_values
> }
> ```

> [tab] Azure
>
> ```hcl title="main.tf" theme={null}
> module "asymptote" {
>   source = "<module source>/azure?ref=<version>"
>
>   name     = "asymptote"
>   location = "eastus"
>   domain   = "asymptote.example.com"
> }
>
> output "helm_values" {
>   value = module.asymptote.helm_values
> }
> ```

```bash theme={null}
terraform init
terraform apply
terraform output -raw helm_values > values.generated.yaml
```

`helm_values` holds the cluster-specific part of the chart's values: the bucket, notification source, workload identities and ingress settings. Merge it with your identity provider and LLM settings, then continue with [Kubernetes Deployment](https://docs.asymptotelabs.ai/self-hosting/kubernetes.md), passing both files with `--values`.

## State

Terraform state holds the names and IDs of what it created, not secrets: the modules create no access keys, and the database password is generated into your cloud's secret manager. Keep state in a remote backend with access limited to your platform team.

## Related

* [Deployment Options](https://docs.asymptotelabs.ai/self-hosting/deployment-options.md)
* [Kubernetes Deployment](https://docs.asymptotelabs.ai/self-hosting/kubernetes.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.