-
Notifications
You must be signed in to change notification settings - Fork 1
/
mongodb.tf
36 lines (29 loc) · 1.06 KB
/
mongodb.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
locals {
mongodb_uri = "${mongodbatlas_serverless_instance.main.connection_strings_standard_srv}/?retryWrites=true&w=majority"
gateway_db_name = "awala-gateway"
}
resource "mongodbatlas_serverless_instance" "main" {
project_id = var.mongodbatlas_project_id
name = "gateway"
provider_settings_backing_provider_name = "GCP"
provider_settings_provider_name = "SERVERLESS"
provider_settings_region_name = var.mongodbatlas_region
}
resource "mongodbatlas_project_ip_access_list" "main" {
project_id = var.mongodbatlas_project_id
comment = "See https://github.com/relaycorp/cloud-gateway/issues/95"
cidr_block = "0.0.0.0/0"
}
resource "mongodbatlas_database_user" "gateway" {
project_id = var.mongodbatlas_project_id
username = "awala-gateway"
password = random_password.mongodb_gateway_user_password.result
auth_database_name = "admin"
roles {
role_name = "readWrite"
database_name = local.gateway_db_name
}
}
resource "random_password" "mongodb_gateway_user_password" {
length = 32
}