Overview
The Terraform configurations for Onyx live atdeployment/terraform/modules/aws/. They provision a production-grade AWS stack and wire the components together so you can follow up with a Helm install against the resulting EKS cluster.
The modules available are:
onyx
High-level composition module. Orchestrates
vpc, eks, postgres, redis, and s3 with sane defaults. Start here unless you need granular control.vpc
Creates a VPC sized for EKS with multiple public and private subnets and an S3 gateway endpoint.
eks
Provisions an EKS cluster, node groups, EBS CSI driver, metrics server, cluster autoscaler, and optional IRSA for S3 access.
postgres
Amazon RDS for PostgreSQL. Returns a ready-to-use connection URL.
redis
ElastiCache for Redis replication group with optional auth token and transit encryption.
s3
S3 bucket for file storage, scoped to the VPC S3 gateway endpoint.
opensearch
Amazon OpenSearch domain inside the VPC. Supports fine-grained access control, encryption, and CloudWatch logging.
waf
AWS WAF with rate limiting, IP allowlisting, geo restriction, and CloudWatch logging.
Prerequisites
- Terraform CLI 1.x or later
- AWS credentials configured in your environment (
AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY, or an IAM role via instance profile / SSO) - Sufficient IAM permissions to create EKS clusters, RDS instances, ElastiCache groups, VPCs, S3 buckets, and IAM roles
kubectlandhelminstalled for the post-Terraform application deployment step
Quickstart
The example below provisions a complete Onyx AWS stack using the top-levelonyx composition module.
Initialise and apply
Deploy Onyx via Helm
Once the cluster is active, install the Onyx Helm chart. If the EKS module created an IRSA role for S3 access, disable MinIO and reference the generated service account:See Kubernetes for full Helm configuration options.
Using an existing VPC
If you already have a VPC, disable VPC creation and provide your existing resource IDs:Key variables
onyx module
| Variable | Type | Default | Description |
|---|---|---|---|
name | string | "onyx" | Prefix for all resource names. Combined with the Terraform workspace. |
region | string | "us-west-2" | AWS region for all resources. |
postgres_username | string | "postgres" | RDS superuser username. |
postgres_password | string | — | RDS superuser password. Required. |
create_vpc | bool | true | Create a new VPC. Set to false to reuse an existing one. |
public_cluster_enabled | bool | true | Enable public EKS API endpoint. |
private_cluster_enabled | bool | false | Enable private EKS API endpoint. Set to true for production. |
cluster_endpoint_public_access_cidrs | list(string) | [] | Restrict public API access to these CIDR blocks. |
redis_auth_token | string | null | Auth token for the ElastiCache Redis cluster. |
enable_iam_auth | bool | false | Use IAM authentication for RDS instead of a password. |
tags | map(string) | {"project":"onyx"} | Tags applied to all resources. |
WAF variables
| Variable | Default | Description |
|---|---|---|
waf_rate_limit_requests_per_5_minutes | 2000 | Requests per 5 min per IP before blocking. |
waf_api_rate_limit_requests_per_5_minutes | 1000 | API-specific rate limit per IP. |
waf_allowed_ip_cidrs | [] | IPv4 CIDRs allowed through WAF. Empty = no allowlist. |
waf_geo_restriction_countries | [] | Country codes to block. Empty = no restriction. |
waf_enable_logging | true | Log WAF decisions to CloudWatch. |
waf_log_retention_days | 90 | Days to retain WAF logs. |
OpenSearch variables
OpenSearch is opt-in for the AWS stack (theonyx module deploys Vespa on EKS by default):
| Variable | Default | Description |
|---|---|---|
enable_opensearch | false | Create a managed OpenSearch domain. |
opensearch_engine_version | "3.3" | OpenSearch engine version. |
opensearch_instance_type | "r8g.large.search" | Data node instance type. |
opensearch_instance_count | 3 | Number of data nodes. |
opensearch_ebs_volume_size | 512 | EBS volume size (GiB) per node. |
opensearch_master_user_name | null | Master username for fine-grained access control. |
opensearch_master_user_password | null | Master password. |
Module outputs
| Output | Sensitive | Description |
|---|---|---|
cluster_name | No | EKS cluster name |
postgres_connection_url | Yes | Full postgres://... connection string |
redis_connection_url | Yes | ElastiCache endpoint and port |
Terraform workspaces
Theonyx module uses the current Terraform workspace name as a suffix for resource names. Use workspaces to create isolated staging and production environments from a single configuration:
IRSA for S3 access
If you supplys3_bucket_names to the EKS module, it creates an IRSA role and a Kubernetes ServiceAccount named onyx-s3-access in the onyx namespace. Use this to avoid storing long-lived S3 credentials:
