File tree Expand file tree Collapse file tree 11 files changed +113
-71
lines changed Expand file tree Collapse file tree 11 files changed +113
-71
lines changed Original file line number Diff line number Diff line change @@ -84,8 +84,7 @@ locals {
84
84
" roles/dns.admin" ,
85
85
],
86
86
" proj" = [
87
- " roles/resourcemanager.folderViewer" ,
88
- " roles/resourcemanager.folderIamAdmin" ,
87
+ " roles/resourcemanager.folderAdmin" ,
89
88
" roles/artifactregistry.admin" ,
90
89
" roles/compute.networkAdmin" ,
91
90
" roles/compute.xpnAdmin" ,
Original file line number Diff line number Diff line change 7
7
| business\_ unit | The business (ex. business\_ unit\_ 1). | ` string ` | n/a | yes |
8
8
| env | The environment to prepare (ex. development). | ` string ` | n/a | yes |
9
9
| firewall\_ enable\_ logging | Toggle firewall logging for VPC Firewalls. | ` bool ` | ` true ` | no |
10
+ | folder\_ prefix | Name prefix to use for folders created. Should be the same in all steps. | ` string ` | ` "fldr" ` | no |
10
11
| gcs\_ bucket\_ prefix | Name prefix to be used for GCS Bucket | ` string ` | ` "bkt" ` | no |
11
12
| key\_ name | Name to be used for KMS Key | ` string ` | ` "crypto-key-example" ` | no |
12
13
| key\_ rotation\_ period | Rotation period in seconds to be used for KMS Key | ` string ` | ` "7776000s" ` | no |
Original file line number Diff line number Diff line change
1
+ /* *
2
+ * Copyright 2023 Google LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ locals {
18
+ env_business_unit_folder_name = " ${ var . folder_prefix } -${ var . env } -${ var . business_code } "
19
+ }
20
+
21
+ resource "google_folder" "env_business_unit" {
22
+ display_name = local. env_business_unit_folder_name
23
+ parent = local. env_folder_name
24
+ }
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ module "base_shared_vpc_project" {
19
19
20
20
org_id = local. org_id
21
21
billing_account = local. billing_account
22
- folder_id = local . env_folder_name
22
+ folder_id = google_folder . env_business_unit . name
23
23
environment = var. env
24
24
vpc_type = " base"
25
25
shared_vpc_host_project_id = local. base_host_project_id
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ module "floating_project" {
19
19
20
20
org_id = local. org_id
21
21
billing_account = local. billing_account
22
- folder_id = local . env_folder_name
22
+ folder_id = google_folder . env_business_unit . name
23
23
environment = var. env
24
24
project_budget = var. project_budget
25
25
project_prefix = local. project_prefix
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ module "peering_project" {
35
35
36
36
org_id = local. org_id
37
37
billing_account = local. billing_account
38
- folder_id = local . env_folder_name
38
+ folder_id = google_folder . env_business_unit . name
39
39
environment = var. env
40
40
project_budget = var. project_budget
41
41
project_prefix = local. project_prefix
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ module "restricted_shared_vpc_project" {
19
19
20
20
org_id = local. org_id
21
21
billing_account = local. billing_account
22
- folder_id = local . env_folder_name
22
+ folder_id = google_folder . env_business_unit . name
23
23
environment = var. env
24
24
vpc_type = " restricted"
25
25
shared_vpc_host_project_id = local. restricted_host_project_id
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ module "env_secrets_project" {
19
19
20
20
org_id = local. org_id
21
21
billing_account = local. billing_account
22
- folder_id = local . env_folder_name
22
+ folder_id = google_folder . env_business_unit . name
23
23
environment = var. env
24
24
project_budget = var. project_budget
25
25
project_suffix = var. secrets_prj_suffix
Original file line number Diff line number Diff line change @@ -152,3 +152,9 @@ variable "subnet_ip_range" {
152
152
type = string
153
153
default = null
154
154
}
155
+
156
+ variable "folder_prefix" {
157
+ description = " Name prefix to use for folders created. Should be the same in all steps."
158
+ type = string
159
+ default = " fldr"
160
+ }
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ module "project" {
51
51
random_project_id = true
52
52
random_project_id_length = 4
53
53
activate_apis = distinct (concat (var. activate_apis , [" billingbudgets.googleapis.com" ]))
54
- name = " ${ var . project_prefix } -${ var . business_code } -${ local . env_code } - ${ var . project_suffix } "
54
+ name = " ${ var . project_prefix } -${ local . env_code } -${ var . business_code } ${ var . project_suffix } "
55
55
org_id = var. org_id
56
56
billing_account = var. billing_account
57
57
folder_id = var. folder_id
You can’t perform that action at this time.
0 commit comments