This repository has been archived by the owner on Jan 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
iam.tf
55 lines (46 loc) · 1.76 KB
/
iam.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
resource "google_service_account" "terraform_sa" {
account_id = "terraform"
display_name = "Terraform Service Account"
}
resource "google_service_account_key" "terraform_key" {
service_account_id = google_service_account.terraform_sa.name
}
output "terraform_private_key" {
value = google_service_account_key.terraform_key.private_key
sensitive = true
}
resource "google_project_iam_member" "cloudbuild_binding" {
project = var.project_id
role = "roles/cloudbuild.builds.builder"
member = "serviceAccount:${google_service_account.terraform_sa.email}"
}
resource "google_project_iam_member" "cloudscheduler_binding" {
project = var.project_id
role = "roles/cloudscheduler.admin"
member = "serviceAccount:${google_service_account.terraform_sa.email}"
}
resource "google_project_iam_member" "cloudstorage_binding" {
project = var.project_id
role = "roles/storage.admin"
member = "serviceAccount:${google_service_account.terraform_sa.email}"
}
resource "google_project_iam_member" "cloudfunctions_binding" {
project = var.project_id
role = "roles/cloudfunctions.admin"
member = "serviceAccount:${google_service_account.terraform_sa.email}"
}
resource "google_project_iam_member" "compute_binding" {
project = var.project_id
role = "roles/compute.instanceAdmin.v1"
member = "serviceAccount:${google_service_account.terraform_sa.email}"
}
resource "google_project_iam_member" "iam_binding" {
project = var.project_id
role = "roles/iam.serviceAccountUser"
member = "serviceAccount:${google_service_account.terraform_sa.email}"
}
resource "google_project_iam_member" "cloudrun_binding" {
project = var.project_id
role = "roles/run.admin"
member = "serviceAccount:${google_service_account.terraform_sa.email}"
}