This module helps create several folders under the same parent, enforcing consistent permissions, and with a common naming convention.
The resources/services/activations/deletions that this module will create/trigger are:
- Create folders with the provided names
- Assign the defined permissions to the provided list of users or groups.
This module is meant for use with Terraform 0.13+ and tested using Terraform 1.0+. If you find incompatibilities using Terraform >=0.13, please open an issue. If you haven't upgraded and need a Terraform 0.12.x-compatible version of this module, the last released version intended for Terraform 0.12.x is 2.0.2.
Basic usage of this module is as follows:
module "basic_folder_structure" {
source = "devoteamgcloud/es-tf-module-folder-structure"
parent_id = "organizations/123456789"
folder_structure = {
"ctl" : {
"automation" : []
"management" : []
"billing" : []
"security" : []
"observability" : []
"networking" : {
"global" : []
"emea" : []
"latam" : []
}
},
"dev" : []
}
}
Functional examples are included in the examples directory.
These sections describe requirements for using this module.
The following dependencies must be available:
- Terraform v1.3+
- Terraform Provider for GCP plugin v6
A service account with the following roles must be used to provision the resources of this module:
- Folder Creator:
roles/resourcemanager.folderCreator
The Project Factory module and the IAM module may be used in combination to provision a service account with the necessary roles applied.
A project with the following APIs enabled must be used to host the resources of this module:
- Cloud Resource Manager API:
cloudresourcemanager.googleapis.com
The Project Factory module can be used to provision a project with the necessary APIs enabled.
Refer to the contribution guidelines for information on contributing to this module.
Name | Version |
---|---|
terraform | >= 0.13 |
>= 4, < 6.0 |
No providers.
Name | Source | Version |
---|---|---|
folders | terraform-google-modules/folders/google | ~> 4.0 |
sub_folders1 | terraform-google-modules/folders/google | ~> 4.0 |
sub_folders2 | terraform-google-modules/folders/google | ~> 4.0 |
sub_folders3 | terraform-google-modules/folders/google | ~> 4.0 |
sub_folders4 | terraform-google-modules/folders/google | ~> 4.0 |
No resources.
Name | Description | Type | Default | Required |
---|---|---|---|---|
deletion_protection | Protection against deletion for level 3 and 4 folders | bool |
false |
no |
folder_structure | Nested folder structure up to 4 levels of depth | map(map(map(map(list(string))))) |
n/a | yes |
parent_id | ID of the parent where the folders will be created (organizations/123456 or folders/123456) | string |
n/a | yes |
Name | Description |
---|---|
folder_ids | IDs of first level folders |
subfolder1_ids | IDs of second level folders |
subfolder2_ids | IDs of third level folders |
subfolder3_ids | IDs of fourth level folders |
subfolder4_ids | IDs of fifth level folders |