Skip to content

Commit 62f79b0

Browse files
committed
Fixing org onboarding for GCP
1 parent 615bf04 commit 62f79b0

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

modules/vm-workload-scanning/organizational.tf

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@ data "google_organization" "org" {
1414
#---------------------------------------------------------------------------------------------
1515
# role permissions for CSPM (GCP Predefined Roles for Sysdig Cloud Secure Posture Management)
1616
#---------------------------------------------------------------------------------------------
17-
resource "google_organization_iam_member" "controller" {
18-
# adding ciem role with permissions to the service account alongside cspm roles
19-
for_each = var.is_organizational ? toset([
17+
resource "google_organization_iam_custom_role" "custom_role" {
18+
count = var.is_organizational ? 1 : 0
19+
20+
org_id = data.google_organization.org[0].org_id
21+
role_id = "vmWorkloadScanningRole"
22+
title = "VM Workload Scanning Role"
23+
permissions = [
2024
"artifactregistry.repositories.downloadArtifacts",
2125
"artifactregistry.repositories.get",
2226
"artifactregistry.repositories.list",
@@ -25,11 +29,16 @@ resource "google_organization_iam_member" "controller" {
2529
"storage.objects.get",
2630
"storage.buckets.list",
2731
"storage.objects.list",
32+
"iam.serviceAccounts.getAccessToken"
33+
]
34+
}
2835

29-
# workload identity federation
30-
"iam.serviceAccounts.getAccessToken"]) : []
36+
resource "google_organization_iam_member" "controller" {
37+
for_each = var.is_organizational ? toset([
38+
"roles/${google_organization_iam_custom_role.custom_role[0].role_id}"
39+
]) : []
3140

3241
org_id = data.google_organization.org[0].org_id
3342
role = each.key
3443
member = "serviceAccount:${google_service_account.controller.email}"
35-
}
44+
}

0 commit comments

Comments
 (0)