-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcloudRun.tf
85 lines (72 loc) · 2 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
77
78
79
80
81
82
83
84
85
resource "google_project_service" "run_api" {
service = "run.googleapis.com"
disable_on_destroy = false
}
resource "google_cloud_run_service" "devxp_deployment" {
name = var.gcr_name
location = var.gcr_location
autogenerate_revision_name = true
template {
spec {
containers {
image = "gcr.io/${var.gc_project_id}/${var.gcr_image_name}:${var.SHA}"
env {
name = "CONNECTION_STRING"
value = var.CONNECTION_STRING
}
env {
name = "GITHUB_CLIENT_ID"
value = var.GITHUB_CLIENT_ID
}
env {
name = "GITHUB_CLIENT_SECRET"
value = var.GITHUB_CLIENT_SECRET
}
}
}
}
traffic {
percent = 100
latest_revision = true
}
# Waits for the Cloud Run API to be enabled
depends_on = [google_project_service.run_api]
}
resource "google_cloud_run_service_iam_member" "run_all_users" {
service = google_cloud_run_service.devxp_deployment.name
location = google_cloud_run_service.devxp_deployment.location
project = google_cloud_run_service.devxp_deployment.project
role = "roles/run.invoker"
member = "allUsers"
}
output "service_url" {
value = google_cloud_run_service.devxp_deployment.status[0].url
}
resource "google_cloud_run_domain_mapping" "devxp" {
location = var.gcr_location
name = var.gcr_domain
metadata {
namespace = var.gc_project_id
}
spec {
route_name = google_cloud_run_service.devxp_deployment.name
}
}
output "CNAME_required_records" {
value = google_cloud_run_domain_mapping.devxp.status[0]
}
# resource "google_cloud_run_domain_mapping" "www-devxp" {
# location = var.gcr_location
# name = var.gcr_domain_www
#
# metadata {
# namespace = var.gc_project_id
# }
#
# spec {
# route_name = google_cloud_run_service.devxp_deployment.name
# }
# }
# output "CNAME_required_records_www" {
# value = google_cloud_run_domain_mapping.www-devxp.status[0]
# }