-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample.tf
85 lines (72 loc) · 2.88 KB
/
example.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
module "gke-cluster" {
source = "github.com/terraform-google-modules/terraform-google-kubernetes-engine//modules/cluster"
}
resource "google_service_account" "some-account" {
account_id = "some-account"
project = "foo"
}
resource "google_service_account_iam_member" "sa-member" {
service_account_id = google_service_account.some-account.account_id
role = "roles/iam.workloadIdentityUser"
member = "principalSet://iam.googleapis.com/${google_iam_workload_identity_pool.something-something.name}/attribute.repository/my-github/repository-name"
}
resource "google_service_account_iam_member" "sa-member2" {
service_account_id = google_service_account.foo-bar.account_id
role = "roles/iam.workloadIdentityUser"
member = "principalSet://iam.googleapis.com/${google_iam_workload_identity_pool.something-something.name}/attribute.repository/my-github/repository-name"
}
#resource "google_pubsub_topic" "foo" {
# name = "foo"
# labels = {
# foo = "bar"
# }
#}
# resource "google_pubsub_topic" "foo" {
# name = "foo"
# labels = {
# foo = "bar"
# }
# }
variable "project_id" {
type = string
default = "foo-bar"
}
resource "google_service_account_iam_member" "some-workloadIdentityUser" {
service_account_id = google_service_account.some.name
role = "roles/iam.workloadIdentityUser"
member = "serviceAccount:foo.svc.id.goog[kube-system/bar]"
}
# ---------------------------------------------------- #
# ---- some-team google artifact registry resource --- #
resource "google_artifact_registry_repository" "some-image-registry" {
project = var.project_id
location = "us"
repository_id = "some-images"
description = "some repository"
format = "DOCKER"
}
resource "google_service_account_iam_member" "some_service-account_impersonation" {
service_account_id = "projects/my-project-id/serviceAccounts/[email protected]"
role = "roles/iam.workloadIdentityUser"
member = "principalSet://iam.googleapis.com/${module.my-cluster.iam-workload_identity-pool}/attribute.repository/my-org/my-repo"
}
resource "google_pubsub_topic_iam_binding" "some_team_pubsub-topic_publisher" {
project = var.project_id
topic = google_pubsub_topic.some_team-pubsub.name
role = "roles/pubsub.publisher"
members = [
"serviceAccount:${google_service_account.some-team_service-account.email}",
"serviceAccount:[email protected]",
"group:[email protected]",
]
}
resource "google_pubsub_subscription" "some_team-name_engineer_subscription" {
name = "some_team-name_engineer_subscription"
topic = google_pubsub_topic.some_team-name_topic.name
bigquery_config {
table = "my-project-id.some.table-name"
}
labels = {
team = "some-team-name"
}
}