-
Notifications
You must be signed in to change notification settings - Fork 0
/
repogroup_misfortune.tf
77 lines (64 loc) · 2.33 KB
/
repogroup_misfortune.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
module "misfortune_backend_repo" {
source = "github.com/BlindfoldedSurgery/terraform-repo-module?ref=v7.4.0"
name = "wheel-of-misfortune-backend"
description = "Wheel of Misfortune backend service"
}
module "misfortune_app_repo" {
source = "github.com/BlindfoldedSurgery/terraform-repo-module?ref=v7.4.0"
name = "wheel-of-misfortune-app"
description = "Wheel of Misfortune web frontend"
required_status_checks = [
"Check Format",
"Lint",
"Build Web Package",
"validate-renovate-config / validate",
]
}
# IAM
resource "google_service_account" "misfortune" {
provider = google.misfortune
account_id = "misfortune"
display_name = "Backend"
}
data "google_iam_role" "datastore_user" {
provider = google.misfortune
name = "roles/datastore.user"
}
resource "google_project_iam_member" "misfortune_datastore_user" {
provider = google.misfortune
project = google_service_account.misfortune.project
role = data.google_iam_role.datastore_user.id
member = google_service_account.misfortune.member
}
resource "google_service_account" "misfortune_test" {
provider = google.misfortune
account_id = "misfortune-test"
display_name = "Backend Tests"
}
resource "google_project_iam_member" "misfortune_test_datastore_user" {
provider = google.misfortune
project = google_service_account.misfortune.project
role = data.google_iam_role.datastore_user.id
member = google_service_account.misfortune_test.member
}
# Service Account key for runtime access
resource "google_service_account_key" "misfortune_runtime" {
provider = google.misfortune
service_account_id = google_service_account.misfortune.account_id
}
resource "doppler_secret" "misfortune_gsa_json" {
project = "prep"
config = "prd"
name = "MISFORTUNE_GSA_JSON"
value = base64decode(google_service_account_key.misfortune_runtime.private_key)
}
# Service Account key for pipeline
resource "google_service_account_key" "misfortune_test" {
provider = google.misfortune
service_account_id = google_service_account.misfortune_test.account_id
}
resource "github_actions_secret" "misfortune_test_gsa_json" {
repository = module.misfortune_backend_repo.name
secret_name = "TEST_GSA_JSON_B64"
plaintext_value = google_service_account_key.misfortune_test.private_key
}