-
Notifications
You must be signed in to change notification settings - Fork 0
/
authority.tf
66 lines (48 loc) · 2.13 KB
/
authority.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
locals {
authority_db_name = "veraid-authority"
authority_api_auth_audience = "https://github.com/relaycorp/letro-cloud"
}
module "authority" {
source = "relaycorp/veraid-authority/google"
version = "1.4.1"
instance_name = local.instance_name
docker_image_tag = var.veraid_authority_docker_image_tag
project_id = var.google_project_id
region = var.google_region
mongodb_uri = "${mongodbatlas_serverless_instance.authority.connection_strings_standard_srv}/?${local.mongodb_connection_options}"
mongodb_db = local.authority_db_name
mongodb_user = mongodbatlas_database_user.authority.username
mongodb_password = random_password.mongodb_authority_user_password.result
api_auth_audiences = [var.veraid_authority_api_auth_audience, local.authority_api_auth_audience]
superadmin_email = var.superadmin_email_address
kms_protection_level = "HSM"
awala_endpoint_enabled = true
awala_endpoint_incoming_messages_topic = module.endpoint.pubsub_topics.incoming_messages
awala_endpoint_outgoing_messages_topic = module.endpoint.pubsub_topics.outgoing_messages
# Cost optimisation
awala_backend_min_instance_count = var.veraid_authority_awala_backend_min_instance_count
queue_min_instance_count = var.veraid_authority_queue_min_instance_count
depends_on = [time_sleep.wait_for_services]
}
# ===== MongoDB
resource "mongodbatlas_serverless_instance" "authority" {
project_id = var.mongodb_atlas_project_id
name = "veraid-authority"
provider_settings_backing_provider_name = "GCP"
provider_settings_provider_name = "SERVERLESS"
provider_settings_region_name = var.mongodb_atlas_region
termination_protection_enabled = true
}
resource "mongodbatlas_database_user" "authority" {
project_id = var.mongodb_atlas_project_id
username = "veraid-authority"
password = random_password.mongodb_authority_user_password.result
auth_database_name = "admin"
roles {
role_name = "readWrite"
database_name = local.authority_db_name
}
}
resource "random_password" "mongodb_authority_user_password" {
length = 32
}