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