-
Notifications
You must be signed in to change notification settings - Fork 1
/
google_project_iam_member.tf
100 lines (76 loc) · 2.22 KB
/
google_project_iam_member.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#
# GKE
#
resource "google_project_iam_member" "gke_developers" {
# The resource is required for users to access the polyaxon GKE clusterr.
# If accessing with SSH tunnel is not appropriate, we have to consider alternative way.
for_each = toset(var.polyaxon_users)
project = var.gcp_project
role = "roles/container.developer"
member = each.key
}
#
# GCS
#
resource "google_project_iam_member" "storage_admin_polyaxon" {
project = var.gcp_project
role = "roles/storage.admin"
member = "serviceAccount:${google_service_account.polyaxon.email}"
}
resource "google_project_iam_member" "storage_admin_gcr" {
project = var.gcp_project
role = "roles/storage.objectAdmin"
member = "serviceAccount:${google_service_account.polyaxon_gcr_access.email}"
}
#
# Cloud TPU
#
resource "google_project_iam_member" "tpu_admin_for_polyaxon_service_account" {
project = var.gcp_project
role = "roles/tpu.admin"
member = "serviceAccount:${google_service_account.polyaxon.email}"
}
resource "google_project_iam_member" "tpu_admin_for_polyaxon_users" {
for_each = toset(var.polyaxon_users)
project = var.gcp_project
role = "roles/tpu.admin"
member = each.key
}
#
# BigQuery
#
resource "google_project_iam_member" "polyaxon_sa_is_bigquery_user" {
project = var.gcp_project
role = "roles/bigquery.user"
member = "serviceAccount:${google_service_account.polyaxon.email}"
}
resource "google_project_iam_member" "bq_user_for_polyaxon_users" {
for_each = toset(var.polyaxon_users)
project = var.gcp_project
role = "roles/bigquery.user"
member = each.key
}
#
# Logging
#
resource "google_project_iam_member" "logging_viewer_for_polyaxon_users" {
for_each = toset(var.polyaxon_users)
project = var.gcp_project
role = "roles/logging.viewer"
member = each.key
}
#
# Stackdriver
#
resource "google_project_iam_member" "stackdriver_accounts_viewer_developers" {
for_each = toset(var.polyaxon_users)
project = var.gcp_project
role = "roles/stackdriver.accounts.viewer"
member = each.key
}
resource "google_project_iam_member" "monitoring_viewer_developers" {
for_each = toset(var.polyaxon_users)
project = var.gcp_project
role = "roles/monitoring.viewer"
member = each.key
}