-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathservice_accounts.tf
53 lines (45 loc) · 1.82 KB
/
service_accounts.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
data "terraform_remote_state" "staging_1" {
backend = "s3"
config {
bucket = "travis-terraform-state"
key = "terraform-config/gce-staging-1.tfstate"
region = "us-east-1"
dynamodb_table = "travis-terraform-state"
}
}
data "terraform_remote_state" "production_2" {
backend = "s3"
config {
bucket = "travis-terraform-state"
key = "terraform-config/gce-production-2.tfstate"
region = "us-east-1"
dynamodb_table = "travis-terraform-state"
}
}
data "terraform_remote_state" "production_3" {
backend = "s3"
config {
bucket = "travis-terraform-state"
key = "terraform-config/gce-production-3.tfstate"
region = "us-east-1"
dynamodb_table = "travis-terraform-state"
}
}
resource "google_project_iam_member" "staging_2_workers" {
count = "${length(data.terraform_remote_state.staging_2.workers_service_account_emails)}"
project = "${var.project}"
role = "roles/compute.imageUser"
member = "serviceAccount:${element(data.terraform_remote_state.staging_2.workers_service_account_emails, count.index)}"
}
resource "google_project_iam_member" "production_2_workers" {
count = "${length(data.terraform_remote_state.production_2.workers_service_account_emails)}"
project = "${var.project}"
role = "roles/compute.imageUser"
member = "serviceAccount:${element(data.terraform_remote_state.production_2.workers_service_account_emails, count.index)}"
}
resource "google_project_iam_member" "production_3_workers" {
count = "${length(data.terraform_remote_state.production_3.workers_service_account_emails)}"
project = "${var.project}"
role = "roles/compute.imageUser"
member = "serviceAccount:${element(data.terraform_remote_state.production_3.workers_service_account_emails, count.index)}"
}