-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.tf
More file actions
27 lines (23 loc) · 731 Bytes
/
main.tf
File metadata and controls
27 lines (23 loc) · 731 Bytes
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
# Service account the Cloud Run service runs as
resource "google_service_account" "app" {
account_id = "${local.service_name}-sa"
display_name = "${local.service_name} service account"
}
# Cloud Run service
resource "google_cloud_run_v2_service" "app" {
name = local.service_name
location = local.region
template {
service_account = google_service_account.app.email
containers {
image = local.image
}
}
}
# Allow unauthenticated (public) access to the service
resource "google_cloud_run_v2_service_iam_member" "public_access" {
name = google_cloud_run_v2_service.app.name
location = google_cloud_run_v2_service.app.location
role = "roles/run.invoker"
member = "allUsers"
}