-
Notifications
You must be signed in to change notification settings - Fork 0
/
this_repo.tf
58 lines (52 loc) · 1.63 KB
/
this_repo.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
module "self_repo" {
source = "github.com/BlindfoldedSurgery/terraform-repo-module?ref=v8.0.3"
name = "terraform"
required_status_checks = [
"validate",
"plan",
]
description = "Organization infrastructure, including GitHub repositories"
}
resource "google_service_account" "self" {
account_id = "github-actions-ci"
display_name = "GitHub Actions"
}
resource "google_project_iam_member" "self_roles" {
for_each = toset([
"roles/iam.securityReviewer",
"roles/iam.serviceAccountViewer",
"roles/pubsub.admin",
"roles/storage.objectAdmin",
])
project = google_service_account.self.project
role = each.key
member = google_service_account.self.member
}
resource "google_project_iam_member" "self_roles_for_cancer_project" {
for_each = toset([
"roles/iam.securityReviewer",
"roles/iam.serviceAccountViewer",
"roles/pubsub.admin",
"roles/storage.objectAdmin",
])
project = google_service_account.cancer.project
role = each.key
member = google_service_account.self.member
}
resource "google_project_iam_member" "self_roles_for_misfortune_project" {
for_each = toset([
"roles/iam.securityReviewer",
"roles/iam.serviceAccountViewer",
])
project = google_service_account.misfortune.project
role = each.key
member = google_service_account.self.member
}
resource "google_service_account_key" "self" {
service_account_id = google_service_account.self.account_id
}
resource "github_actions_secret" "self_gsa" {
repository = module.self_repo.name
secret_name = "GOOGLE_SA_JSON"
plaintext_value = base64decode(google_service_account_key.self.private_key)
}