Skip to content

Commit d355de3

Browse files
committed
feature(trieve-aws): simplified trieve terraform for easier cloud native
install
1 parent d2b884c commit d355de3

3 files changed

Lines changed: 3 additions & 249 deletions

File tree

terraform/aws/trieve-aws/main.tf

Lines changed: 1 addition & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,6 @@ provider "aws" {
1111
region = var.aws_region
1212
}
1313

14-
data "aws_vpc" "existing" {
15-
count = var.create_vpc ? 0 : 1
16-
17-
filter {
18-
name = "vpc-id"
19-
values = [var.vpc_id]
20-
}
21-
}
22-
23-
locals {
24-
vpc = var.create_vpc ? module.vpc.vpc_id : var.vpc_id
25-
}
26-
2714
# VPC Module
2815
module "vpc" {
2916
source = "terraform-aws-modules/vpc/aws"
@@ -60,7 +47,7 @@ module "eks" {
6047
version = "~> 19.0"
6148

6249
cluster_name = var.name
63-
cluster_version = "1.28"
50+
cluster_version = "1.32"
6451

6552
vpc_id = module.vpc.vpc_id
6653
subnet_ids = module.vpc.private_subnets
@@ -76,24 +63,6 @@ module "eks" {
7663
ami_type = "AL2_x86_64"
7764
}
7865

79-
qdrant = {
80-
min_size = var.qdrant_min_size
81-
max_size = var.qdrant_max_size
82-
desired_size = var.qdrant_desired_capacity
83-
84-
instance_types = [var.instance_type_qdrant]
85-
capacity_type = "ON_DEMAND"
86-
ami_type = "AL2_x86_64"
87-
88-
taints = [
89-
{
90-
key = "qdrant-node"
91-
value = "present"
92-
effect = "NO_SCHEDULE"
93-
}
94-
]
95-
}
96-
9766
gpu = {
9867
min_size = var.gpu_min_size
9968
max_size = var.gpu_max_size
@@ -130,103 +99,3 @@ module "eks" {
13099
}
131100
}
132101
}
133-
134-
resource "aws_db_subnet_group" "database" {
135-
name = "${var.name}-db-subnet-group"
136-
subnet_ids = concat(module.vpc.public_subnets, module.vpc.private_subnets)
137-
138-
tags = {
139-
Name = "${var.name}-db-subnet-group"
140-
}
141-
}
142-
143-
resource "aws_security_group" "postgres" {
144-
name = "postgres"
145-
vpc_id = module.vpc.vpc_id
146-
147-
ingress {
148-
from_port = 5432
149-
to_port = 5432
150-
protocol = "tcp"
151-
cidr_blocks = ["0.0.0.0/0"]
152-
}
153-
154-
egress {
155-
from_port = 5432
156-
to_port = 5432
157-
protocol = "tcp"
158-
cidr_blocks = ["0.0.0.0/0"]
159-
}
160-
}
161-
162-
# RDS Module
163-
module "db" {
164-
source = "terraform-aws-modules/rds/aws"
165-
version = "6.10.0"
166-
167-
count = var.use_rds ? 1 : 0
168-
169-
identifier = "${var.name}-rds"
170-
171-
engine = "postgres"
172-
engine_version = "14"
173-
family = "postgres14"
174-
major_engine_version = "14"
175-
instance_class = var.rds_instance_size
176-
177-
allocated_storage = var.rds_storage_size_gb
178-
179-
db_name = "trieve"
180-
username = "trieve"
181-
port = 5432
182-
183-
multi_az = false
184-
db_subnet_group_name = aws_db_subnet_group.database.name
185-
vpc_security_group_ids = [aws_security_group.postgres.id]
186-
187-
maintenance_window = "Mon:00:00-Mon:03:00"
188-
backup_window = "03:00-06:00"
189-
190-
manage_master_user_password = false
191-
password = var.rds_master_password
192-
193-
# Disable backups to create DB faster
194-
backup_retention_period = 0
195-
196-
tags = {
197-
Name = "${var.name}-rds"
198-
}
199-
}
200-
201-
resource "aws_security_group" "redis" {
202-
name = "redis"
203-
vpc_id = module.vpc.vpc_id
204-
205-
ingress {
206-
from_port = 6379
207-
to_port = 6379
208-
protocol = "tcp"
209-
cidr_blocks = ["0.0.0.0/0"]
210-
}
211-
212-
}
213-
214-
resource "aws_elasticache_subnet_group" "redis_subnet_group" {
215-
name = "${var.name}-redis-security-group"
216-
subnet_ids = module.vpc.private_subnets
217-
}
218-
219-
resource "aws_elasticache_cluster" "cache_cluster" {
220-
cluster_id = "${var.name}-redis-cluster"
221-
engine = "redis"
222-
node_type = var.instance_type_redis
223-
num_cache_nodes = var.cluster_size_redis
224-
parameter_group_name = "default.redis7"
225-
engine_version = "7.1"
226-
security_group_ids = [aws_security_group.redis.id]
227-
subnet_group_name = aws_elasticache_subnet_group.redis_subnet_group.name
228-
}
229-
230-
output "redis_output" {
231-
value = aws_elasticache_cluster.cache_cluster.cache_nodes[0].address
232-
}
Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
variable "vpc_id" {
2-
type = string
3-
default = ""
4-
}
5-
61
variable "create_vpc" {
72
type = bool
83
default = true
@@ -13,34 +8,6 @@ variable "aws_region" {
138
default = "us-west-2"
149
}
1510

16-
variable "use_rds" {
17-
type = bool
18-
default = true
19-
}
20-
21-
variable "rds_instance_size" {
22-
type = string
23-
default = "db.t3.medium"
24-
}
25-
26-
variable "rds_storage_size_gb" {
27-
type = number
28-
default = 100
29-
}
30-
31-
variable "rds_engine" { default = "postgres" }
32-
33-
variable "rds_engine_version" { default = "14" }
34-
35-
variable "rds_family" { default = "postgres14" }
36-
37-
variable "rds_major_engine_version" { default = "14" }
38-
39-
variable "use_elasticache" {
40-
type = bool
41-
default = true
42-
}
43-
4411
variable "name" {
4512
type = string
4613
default = "eks-nodes"
@@ -66,39 +33,11 @@ variable "gpu_desired_capacity" {
6633
default = 1
6734
}
6835

69-
variable "instance_type_qdrant" {
70-
type = string
71-
default = "r5.8xlarge"
72-
}
73-
74-
variable "qdrant_max_size" {
75-
type = number
76-
default = 4
77-
}
78-
79-
variable "qdrant_min_size" {
80-
type = number
81-
default = 4
82-
}
83-
84-
variable "qdrant_desired_capacity" {
85-
type = number
86-
default = 4
87-
}
88-
8936
variable "instance_type_standard" {
9037
type = string
9138
default = "t3.2xlarge"
9239
}
9340

94-
variable "instance_type_redis" { default = "cache.t3.medium" }
95-
96-
variable "engine_version_redis" { default = "6.x" }
97-
98-
variable "family_redis" { default = "redis6.x" }
99-
100-
variable "cluster_size_redis" { default = 1 }
101-
10241
variable "standard_max_size" {
10342
type = number
10443
default = 3
@@ -114,24 +53,8 @@ variable "standard_desired_capacity" {
11453
default = 2
11554
}
11655

117-
variable "ebs_optimized" {
118-
type = bool
119-
default = false
120-
}
121-
122-
variable "public_ip" {
123-
type = bool
124-
default = false
125-
}
126-
12756
variable "install_alb_controller" {
12857
type = bool
12958
default = true
13059
description = "Whether to install the AWS Load Balancer Controller"
13160
}
132-
133-
variable "pod_identity_version" { default = "v1.2.0-eksbuild.1" }
134-
135-
variable "rds_master_password" {
136-
type = string
137-
}

terraform/aws/trieve.tf

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,57 +2,19 @@ module "trieve" {
22
source = "./trieve-aws"
33

44
# General Configuration
5-
aws_region = "us-east-2"
5+
aws_region = "us-east-1"
66
name = "trieve-aws-cluster"
77

8-
# VPC Configuration
9-
create_vpc = true
10-
11-
# RDS Configuration
12-
use_rds = true
13-
rds_instance_size = "db.t3.small"
14-
rds_storage_size_gb = 20
15-
rds_engine = "postgres"
16-
rds_engine_version = "14"
17-
rds_family = "postgres14"
18-
rds_major_engine_version = "14"
19-
rds_master_password = "makeamoresecurepasswordrighthere"
20-
21-
# Elasticache Configuration
22-
use_elasticache = true
23-
24-
instance_type_redis = "cache.m5.2xlarge"
25-
cluster_size_redis = 1
26-
278
# EKS Node Group Configuration
28-
instance_type_gpu = "g5.xlarge"
9+
instance_type_gpu = "g6.xlarge"
2910
gpu_max_size = 8
3011
gpu_min_size = 1
3112
gpu_desired_capacity = 5
3213

33-
instance_type_qdrant = "m5.xlarge"
34-
qdrant_max_size = 8
35-
qdrant_min_size = 0
36-
qdrant_desired_capacity = 8
37-
3814
instance_type_standard = "c7a.xlarge"
3915
standard_max_size = 3
4016
standard_min_size = 0
4117
standard_desired_capacity = 1
42-
43-
# EBS Config
44-
ebs_optimized = false
45-
46-
# Use public IP for the cluster
47-
public_ip = false
48-
4918
# Application Load Balancer
5019
install_alb_controller = true
51-
52-
# Pod Identity
53-
pod_identity_version = "v1.2.0-eksbuild.1"
54-
}
55-
56-
output "redis" {
57-
value = module.trieve.redis_output
5820
}

0 commit comments

Comments
 (0)