Spaces:
Runtime error
Runtime error
File size: 5,315 Bytes
b6f0f70 |
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 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
# Cloud Run Service
resource "google_cloud_run_v2_service" "cloud_run_service" {
name = var.cloud_run_name
project = var.cloud_run_project
description = var.cloud_run_description
location = var.cloud_run_location
ingress = var.cloud_run_ingress
template {
# revision = var.cloud_run_revision
service_account = var.cloud_run_service_account
containers {
image = var.cloud_run_image
ports {
container_port = var.cloud_run_port
}
resources {
limits = {
cpu = var.cloud_run_cpu
memory = var.cloud_run_memory
}
cpu_idle = var.cloud_run_cpu_idle
startup_cpu_boost = var.cloud_run_cpu_boost
}
# startup_probe {
# period_seconds = var.cloud_run_startup_probe["period_seconds"]
# timeout_seconds = var.cloud_run_startup_probe["timeout_seconds"]
# failure_threshold = var.cloud_run_startup_probe["failure_threshold"]
# initial_delay_seconds = var.cloud_run_startup_probe["initial_delay_seconds"]
# http_get {
# path = var.cloud_run_startup_probe["http_path"]
# port = var.cloud_run_startup_probe["http_port"]
# }
# }
liveness_probe {
period_seconds = var.cloud_run_liveness_probe["period_seconds"]
timeout_seconds = var.cloud_run_liveness_probe["timeout_seconds"]
failure_threshold = var.cloud_run_liveness_probe["failure_threshold"]
initial_delay_seconds = var.cloud_run_liveness_probe["initial_delay_seconds"]
http_get {
path = var.cloud_run_liveness_probe["http_path"]
port = var.cloud_run_liveness_probe["http_port"]
}
}
# Environment Variables
env {
name = "DATABASE_PORT"
value = var.cloud_run_envars["DATABASE_PORT"]
}
env {
name = "POSTGRES_USER"
value = var.cloud_run_envars["POSTGRES_USER"]
}
env {
name = "POSTGRES_DB"
value = var.cloud_run_envars["POSTGRES_DB"]
}
env {
name = "POSTGRES_HOST"
value = var.cloud_run_envars["POSTGRES_HOST"]
}
env {
name = "POSTGRES_HOSTNAME"
value = var.cloud_run_envars["POSTGRES_HOSTNAME"]
}
env {
name = "ACCESS_TOKEN_EXPIRES_IN"
value = var.cloud_run_envars["ACCESS_TOKEN_EXPIRES_IN"]
}
env {
name = "REFRESH_TOKEN_EXPIRES_IN"
value = var.cloud_run_envars["REFRESH_TOKEN_EXPIRES_IN"]
}
env {
name = "JWT_ALGORITHM"
value = var.cloud_run_envars["JWT_ALGORITHM"]
}
env {
name = "CLIENT_ORIGIN"
value = var.cloud_run_envars["CLIENT_ORIGIN"]
}
# Secrets
env {
name = "JWT_PUBLIC_KEY"
value_source {
secret_key_ref {
# secret = google_secret_manager_secret.secret.secret_id
secret = var.cloud_run_envars["JWT_PUBLIC_KEY"]
version = "1"
}
}
}
env {
name = "JWT_PRIVATE_KEY"
value_source {
secret_key_ref {
# secret = google_secret_manager_secret.secret.secret_id
secret = var.cloud_run_envars["JWT_PRIVATE_KEY"]
version = "1"
}
}
}
env {
name = "POSTGRES_PASSWORD"
value_source {
secret_key_ref {
# secret = google_secret_manager_secret.secret.secret_id
secret = var.cloud_run_envars["POSTGRES_PASSWORD"]
version = "1"
}
}
}
}
timeout = "${
var.cloud_run_timeout
}s"
max_instance_request_concurrency = var.cloud_run_max_instance_concurrent
execution_environment = var.cloud_run_execution_environment
scaling {
min_instance_count = var.cloud_run_min_instance
max_instance_count = var.cloud_run_max_instance
}
vpc_access {
# projects/{project}/locations/{location}/connectors/{connector}
connector = "projects/${
var.cloud_run_project
}/locations/${
var.cloud_run_location
}/connectors/${
var.cloud_run_vpc_access_connector
}"
egress = var.cloud_run_vpc_access_egress
}
}
traffic {
percent = var.cloud_run_traffic_percent
type = var.cloud_run_traffic_type
}
}
|