-
Notifications
You must be signed in to change notification settings - Fork 0
/
letro.tf
131 lines (111 loc) · 2.86 KB
/
letro.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
locals {
letro_db_name = "letro"
}
resource "google_cloud_run_v2_service" "letro" {
name = "letro"
location = var.google_region
ingress = "INGRESS_TRAFFIC_INTERNAL_ONLY"
template {
timeout = "3s"
service_account = google_service_account.letro.email
execution_environment = "EXECUTION_ENVIRONMENT_GEN2"
max_instance_request_concurrency = var.letro_max_instance_request_concurrency
containers {
name = "letro"
image = "${var.letro_docker_image_name}:${var.letro_docker_image_tag}"
env {
name = "VERSION"
value = var.letro_docker_image_tag
}
env {
name = "MONGODB_URI"
value = "${mongodbatlas_serverless_instance.letro.connection_strings_standard_srv}/?${local.mongodb_connection_options}"
}
env {
name = "MONGODB_DB"
value = local.letro_db_name
}
env {
name = "MONGODB_USER"
value = mongodbatlas_database_user.letro.username
}
env {
name = "MONGODB_PASSWORD"
value_source {
secret_key_ref {
secret = google_secret_manager_secret.letro_mongodb_password.id
version = "latest"
}
}
}
env {
name = "CE_TRANSPORT"
value = "google-pubsub"
}
env {
name = "CE_GPUBSUB_TOPIC"
value = module.endpoint.pubsub_topics.outgoing_messages
}
env {
name = "VAUTH_API_URL"
value = module.authority.api_url
}
env {
name = "VAUTH_API_AUDIENCE"
value = local.authority_api_auth_audience
}
env {
name = "LOG_LEVEL"
value = var.letro_log_level
}
env {
name = "LOG_TARGET"
value = "gcp"
}
env {
name = "REQUEST_ID_HEADER"
value = "X-Cloud-Trace-Context"
}
resources {
startup_cpu_boost = true
cpu_idle = false
limits = {
cpu = 1
memory = "512Mi"
}
}
startup_probe {
initial_delay_seconds = 3
failure_threshold = 3
period_seconds = 10
timeout_seconds = 3
http_get {
path = "/"
port = 8080
}
}
liveness_probe {
initial_delay_seconds = 0
failure_threshold = 3
period_seconds = 20
timeout_seconds = 3
http_get {
path = "/"
port = 8080
}
}
}
scaling {
min_instance_count = var.letro_min_instance_count
max_instance_count = var.letro_max_instance_count
}
}
depends_on = [
google_secret_manager_secret_iam_binding.letro_mongodb_password_reader,
]
}
resource "google_service_account" "letro" {
project = var.google_project_id
account_id = "letro-server"
display_name = "Letro server"
}