-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.tf
70 lines (62 loc) · 1.58 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
terraform {
required_providers {
mongodbatlas = {
source = "mongodb/mongodbatlas"
}
}
required_version = ">= 0.13"
}
provider "mongodbatlas" {
public_key = var.public_key
private_key = var.private_key
}
resource "mongodbatlas_project" "rag_project" {
name = var.project_name
org_id = var.atlas_org_id
}
resource "mongodbatlas_advanced_cluster" "rag_cluster" {
project_id = mongodbatlas_project.rag_project.id
name = var.cluster_name
cluster_type = "REPLICASET"
replication_specs {
region_configs {
electable_specs {
instance_size = "M10"
node_count = 3
}
provider_name = "AWS"
region_name = "EU_WEST_1"
priority = 7
}
}
}
resource "mongodbatlas_project_ip_access_list" "ip_list" {
project_id = mongodbatlas_project.rag_project.id
ip_address = var.ip_address
}
resource "mongodbatlas_database_user" "db_user" {
username = var.db_username
password = var.db_password
project_id = mongodbatlas_project.rag_project.id
auth_database_name = "admin"
roles {
role_name = "readWrite"
database_name = "rag"
}
}
resource "mongodbatlas_search_index" "vector_search" {
name = "search-index"
project_id = mongodbatlas_project.rag_project.id
cluster_name = mongodbatlas_advanced_cluster.rag_cluster.name
type = "vectorSearch"
database = "rag"
collection_name = "vector_store"
fields = <<-EOF
[{
"type": "vector",
"path": "embedding",
"numDimensions": 1536,
"similarity": "cosine"
}]
EOF
}