-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudRun.tf
76 lines (66 loc) · 2.04 KB
/
cloudRun.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
resource "google_cloud_run_service" "default" {
name = var.cloudRun_container_name
location = var.region
template {
metadata {
annotations = {
"autoscaling.knative.dev/maxScale" = var.cloudRun_autoScaling_max
"run.googleapis.com/cloudsql-instances" = google_sql_database_instance.instance.connection_name
}
}
spec {
timeout_seconds = var.cloudRun_timeout_seconds
containers {
// image = "us-docker.pkg.dev/cloudrun/container/hello"
image = "gcr.io/${var.project_id}/${var.cloudRun_container_name}:latest"
env {
name = var.cloudRun_environment_variable1_name
value = var.cloudRun_environment_variable1_value
}
env {
name = var.cloudRun_environment_variable2_name
value = var.cloudRun_environment_variable2_value
}
env {
name = var.cloudRun_environment_variable3_name
value = var.cloudRun_environment_variable3_value
}
env {
name = var.cloudRun_environment_variable4_name
value = var.cloudRun_environment_variable4_value
}
env {
name = var.cloudRun_environment_variable5_name
value = var.cloudRun_environment_variable5_value
}
ports {
container_port = var.cloudRun_container_port
}
resources {
limits = {
cpu = var.cloudRun_cpu_limit
memory = var.cloudRun_memory_limit
}
}
}
}
}
traffic {
percent = var.cloudRun_traffic_percent
latest_revision = var.cloudRun_latest_revision
}
}
data "google_iam_policy" "noauth" {
binding {
role = "roles/run.invoker"
members = [
"allUsers",
]
}
}
resource "google_cloud_run_service_iam_policy" "noauth" {
location = google_cloud_run_service.default.location
project = google_cloud_run_service.default.project
service = google_cloud_run_service.default.name
policy_data = data.google_iam_policy.noauth.policy_data
}