-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.tf
45 lines (39 loc) · 1.07 KB
/
build.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
resource "google_project_iam_member" "cloud_builder" {
for_each = toset([
"roles/iam.serviceAccountUser",
"roles/cloudfunctions.developer",
])
role = each.key
member = "serviceAccount:${data.google_project.project.number}@cloudbuild.gserviceaccount.com"
depends_on = [google_project_service.services]
}
resource "google_cloudbuild_trigger" "deploy_trigger" {
name = var.deploy_trigger_name
trigger_template {
branch_name = "master"
repo_name = var.repository_name
}
build {
dynamic "step" {
for_each = google_cloudfunctions_function.functions
content {
name = "gcr.io/cloud-builders/gcloud"
args = [
"functions",
"deploy",
step.value.name,
"--source=.",
"--trigger-http",
"--security-level=secure-always",
"--runtime=${var.runtime}",
"--entry-point=${step.value.entry_point}",
]
timeout = "300s"
}
}
}
depends_on = [
google_project_service.services,
google_project_iam_member.cloud_builder,
]
}