-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgcp-packer.tf
79 lines (70 loc) · 3.74 KB
/
gcp-packer.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
# Main Project
resource "google_service_account" "packer" {
account_id = "infra-packer"
display_name = "infra-packer"
description = "Build VM images"
}
# Note: the Terraform service account must be given the Project IAM Admin role or another role with
# the resourcemanager.projects.setIamPolicy permission, such as the Security Admin role, so that it
# can manage the roles for GCP's own service accounts. You can manually do this from the IAM & Admin
# console.
resource "google_project_iam_member" "compute_service_pkr" {
project = google_project.foundations.project_id
role = "roles/compute.instanceAdmin.v1"
member = "serviceAccount:${google_service_account.packer.email}"
}
# Note: the Terraform service account must be given the Project IAM Admin role or another role with
# the resourcemanager.projects.setIamPolicy permission, such as the Security Admin role, so that it
# can manage the roles for GCP's own service accounts. You can manually do this from the IAM & Admin
# console.
resource "google_project_iam_member" "iap_service_pkr" {
project = google_project.foundations.project_id
role = "roles/iap.tunnelResourceAccessor"
member = "serviceAccount:${google_service_account.packer.email}"
}
# Note: the Terraform service account must be given the Project IAM Admin role or another role with
# the resourcemanager.projects.setIamPolicy permission, such as the Security Admin role, so that it
# can manage the roles for GCP's own service accounts. You can manually do this from the IAM & Admin
# console.
resource "google_project_iam_member" "iam_service_pkr" {
project = google_project.foundations.project_id
role = "roles/iam.serviceAccountUser"
member = "serviceAccount:${google_service_account.packer.email}"
}
# Planktoscope Project
resource "google_service_account" "packer_planktoscope" {
provider = google.planktoscope
account_id = "infra-packer"
display_name = "infra-packer"
description = "Build VM images"
}
# Note: the Terraform service account must be given the Project IAM Admin role or another role with
# the resourcemanager.projects.setIamPolicy permission, such as the Security Admin role, so that it
# can manage the roles for GCP's own service accounts. You can manually do this from the IAM & Admin
# console.
resource "google_project_iam_member" "compute_service_pkr_planktoscope" {
provider = google.planktoscope
project = google_project.foundations_planktoscope.project_id
role = "roles/compute.instanceAdmin.v1"
member = "serviceAccount:${google_service_account.packer_planktoscope.email}"
}
# Note: the Terraform service account must be given the Project IAM Admin role or another role with
# the resourcemanager.projects.setIamPolicy permission, such as the Security Admin role, so that it
# can manage the roles for GCP's own service accounts. You can manually do this from the IAM & Admin
# console.
resource "google_project_iam_member" "iap_service_pkr_planktoscope" {
provider = google.planktoscope
project = google_project.foundations_planktoscope.project_id
role = "roles/iap.tunnelResourceAccessor"
member = "serviceAccount:${google_service_account.packer_planktoscope.email}"
}
# Note: the Terraform service account must be given the Project IAM Admin role or another role with
# the resourcemanager.projects.setIamPolicy permission, such as the Security Admin role, so that it
# can manage the roles for GCP's own service accounts. You can manually do this from the IAM & Admin
# console.
resource "google_project_iam_member" "iam_service_pkr_planktoscope" {
provider = google.planktoscope
project = google_project.foundations_planktoscope.project_id
role = "roles/iam.serviceAccountUser"
member = "serviceAccount:${google_service_account.packer_planktoscope.email}"
}