File tree 5 files changed +29
-0
lines changed
modules/meshcloud-replicator-service-account 5 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
6
6
and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
7
7
8
+ ## [ Unreleased]
9
+
10
+ ### Added
11
+
12
+ - Option to provide replicator service account project deletion permission on specified landing zone folders
13
+
8
14
## [ v0.2.0]
9
15
10
16
### Added
Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ module "replicator_sa" {
26
26
27
27
landing_zone_folder_ids = var. landing_zone_folder_ids
28
28
29
+ can_delete_projects_in_landing_zone_folder_ids = var. can_delete_projects_in_landing_zone_folder_ids
30
+
29
31
billing_account_id = var. billing_account_id
30
32
31
33
service_account_key = var. service_account_keys
Original file line number Diff line number Diff line change @@ -72,6 +72,14 @@ resource "google_folder_iam_member" "replicator_service" {
72
72
member = " serviceAccount:${ google_service_account . replicator_service . email } "
73
73
}
74
74
75
+ resource "google_folder_iam_member" "replicator_service_project_deleter" {
76
+ for_each = var. can_delete_projects_in_landing_zone_folder_ids
77
+
78
+ folder = each. value
79
+ role = " roles/resourcemanager.projectDeleter"
80
+ member = " serviceAccount:${ google_service_account . replicator_service . email } "
81
+ }
82
+
75
83
/*
76
84
Billing Accounts are associated with an organization and can thus inherit organization level role assignments
77
85
see https://cloud.google.com/billing/docs/how-to/billing-access).
Original file line number Diff line number Diff line change @@ -18,6 +18,12 @@ variable "landing_zone_folder_ids" {
18
18
description = " GCP Folders that make up the Landing Zone. The service account will only receive permissions on these folders."
19
19
}
20
20
21
+ variable "can_delete_projects_in_landing_zone_folder_ids" {
22
+ type = set (string )
23
+ description = " The service account will have projectDeleter role only on the specified landing zone IDs."
24
+ default = []
25
+ }
26
+
21
27
variable "billing_org_id" {
22
28
type = string
23
29
description = " GCP Organization Id that holds billing account"
Original file line number Diff line number Diff line change @@ -23,6 +23,13 @@ variable "landing_zone_folder_ids" {
23
23
description = " GCP Folders that make up the Landing Zone. The service account will only receive permissions on these folders."
24
24
}
25
25
26
+ variable "can_delete_projects_in_landing_zone_folder_ids" {
27
+ type = set (string )
28
+ description = " The service account will have projectDeleter role only on the specified landing zone IDs."
29
+ default = []
30
+ }
31
+
32
+
26
33
variable "cloud_billing_export_project_id" {
27
34
type = string
28
35
description = " GCP Project where the BiqQuery table resides that holds the Cloud Billing export to BigQuery. See https://cloud.google.com/billing/docs/how-to/export-data-bigquery"
You can’t perform that action at this time.
0 commit comments