Skip to content

Commit b8d8dc8

Browse files
committed
Adds missing roles, org_id var and update readme
1 parent 4e6843e commit b8d8dc8

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

1-bootstrap/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ Within the repository, you'll find `backend.tf` files that define the GCS bucket
298298
| common\_folder\_id | Folder ID in which to create all application admin projects, must be prefixed with 'folders/' | `string` | n/a | yes |
299299
| envs | Environments | <pre>map(object({<br> billing_account = string<br> folder_id = string<br> network_project_id = string<br> network_self_link = string<br> org_id = string<br> subnets_self_links = list(string)<br> }))</pre> | n/a | yes |
300300
| location | Location for build buckets. | `string` | `"us-central1"` | no |
301+
| org\_id | Organization ID | `string` | n/a | yes |
301302
| project\_id | Project ID for initial resources | `string` | n/a | yes |
302303
| tf\_apply\_branches | List of git branches configured to run terraform apply Cloud Build trigger. All other branches will run plan by default. | `list(string)` | <pre>[<br> "development",<br> "nonproduction",<br> "production"<br>]</pre> | no |
303304
| trigger\_location | Location of for Cloud Build triggers created in the workspace. If using private pools should be the same location as the pool. | `string` | `"us-central1"` | no |

1-bootstrap/iam.tf

+13-6
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,12 @@ resource "google_folder_iam_member" "app_factory_project_creator" {
123123
folder = var.common_folder_id
124124
}
125125

126-
resource "google_folder_iam_member" "app_factory_folder_viewer" {
127-
for_each = tomap({ for i, obj in local.expanded_environment_with_service_accounts : i => obj if obj.multitenant_pipeline == "applicationfactory" })
128-
129-
role = "roles/resourcemanager.folderViewer"
130-
member = "serviceAccount:${each.value.email}"
131-
folder = var.common_folder_id
126+
// needed by terraform-vet to get parent folder
127+
resource "google_organization_iam_member" "app_factory_folder_viewer" {
128+
for_each = tomap({ for i, obj in local.expanded_environment_with_service_accounts : i => obj if obj.multitenant_pipeline == "applicationfactory" })
129+
role = "roles/resourcemanager.folderViewer"
130+
org_id = var.org_id
131+
member = "serviceAccount:${each.value.email}"
132132
}
133133

134134
resource "google_project_iam_member" "cloud_build_worker_pool_user" {
@@ -138,3 +138,10 @@ resource "google_project_iam_member" "cloud_build_worker_pool_user" {
138138
member = "serviceAccount:${each.value}"
139139
project = local.worker_pool_project
140140
}
141+
142+
resource "google_organization_iam_member" "policyAdmin_role" {
143+
for_each = tomap({ for i, obj in local.expanded_environment_with_service_accounts : i => obj })
144+
role = "roles/accesscontextmanager.policyAdmin"
145+
org_id = var.org_id
146+
member = "serviceAccount:${each.value.email}"
147+
}

1-bootstrap/variables.tf

+5
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,8 @@ variable "access_level_name" {
179179
type = string
180180
default = null
181181
}
182+
183+
variable "org_id" {
184+
description = "Organization ID"
185+
type = string
186+
}

0 commit comments

Comments
 (0)