This sample creates an organizational layout with a single level, where each folder is usually mapped to one infrastructure environment (test, dev, etc.). It also sets up all prerequisites for automation (GCS state buckets, service accounts, etc.), and the correct roles on those to enforce separation of duties at the environment level.
This layout is well suited for medium-sized infrastructures managed by a small set of teams, where the complexity in application resource ownership and access roles is mostly dealt with at the project level, and/or in the individual services (GKE, Cloud SQL, etc.). Its simplicity also makes it a good starting point for more complex or specialized layouts.
The number of resources in this sample is kept to a minimum so as to make it generally applicable, more resources can be easily added by leveraging other [modules from our bundle](../../../modules/), or from other sources like the [CFT suite](https://github.com/terraform-google-modules).
This sample contains a single, top-level project used to host services shared across environments (eg GCS, GCR, KMS, Cloud Build, etc.). In our experience, that is enough for many customers, especially those using this organizational layout.
For more complex setups where multiple shared services projects are needed to encapsulate a larger number of resources, shared services should be treated as an extra environment so that they can be managed by a dedicated set of Terraform files, using a separate service account and GCS bucket, with a folder to contain shared projects.
If no shared services are needed, the shared service project module can of course be removed from `main.tf`.
| iam_audit_viewers | Audit project viewers, in IAM format. | <code>list(string)</code> | | <code>[]</code> |
| iam_billing_config | Control granting billing user role to service accounts. Target the billing account by default. | <codetitle="object({ grant = bool target_org = bool })">object({…})</code> | | <codetitle="{ grant = true target_org = false }">{…}</code> |
| iam_folder_roles | List of roles granted to each service account on its respective folder (excluding XPN roles). | <code>list(string)</code> | | <codetitle="[ "roles/compute.networkAdmin", "roles/owner", "roles/resourcemanager.folderViewer", "roles/resourcemanager.projectCreator", ]">[…]</code> |
| iam_shared_owners | Shared services project owners, in IAM format. | <code>list(string)</code> | | <code>[]</code> |
| iam_terraform_owners | Terraform project owners, in IAM format. | <code>list(string)</code> | | <code>[]</code> |
| iam_xpn_config | Control granting Shared VPC creation roles to service accounts. Target the root node by default. | <codetitle="object({ grant = bool target_org = bool })">object({…})</code> | | <codetitle="{ grant = true target_org = true }">{…}</code> |
| project_services | Service APIs enabled by default in new projects. | <code>list(string)</code> | | <codetitle="[ "container.googleapis.com", "stackdriver.googleapis.com", ]">[…]</code> |
| service_account_keys | Generate and store service account keys in the state file. | <code>bool</code> | | <code>true</code> |