Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Miren Esnaola 2023-10-01 14:05:05 +02:00
commit f989df9032
4 changed files with 55 additions and 3 deletions

View File

@ -19,6 +19,7 @@ All notable changes to this project will be documented in this file.
### FAST
- [[#1715](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/pull/1715)] Fix indentation in FAST hierarchical firewall rules ([juliocc](https://github.com/juliocc)) <!-- 2023-09-29 13:37:41+00:00 -->
- [[#1711](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/pull/1711)] [FAST] Fix tenant folder tag ([lcaggio](https://github.com/lcaggio)) <!-- 2023-09-28 21:48:15+00:00 -->
- [[#1707](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/pull/1707)] Only apply org policies when bootstrap user is not set ([ludoo](https://github.com/ludoo)) <!-- 2023-09-27 21:24:41+00:00 -->
- [[#1705](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/pull/1705)] Fix typo in bootstrap stage README ([giterinhub](https://github.com/giterinhub)) <!-- 2023-09-27 12:21:09+00:00 -->
@ -28,6 +29,7 @@ All notable changes to this project will be documented in this file.
### MODULES
- [[#1716](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/pull/1716)] Add retry policy for subscriptions ([devuonocar](https://github.com/devuonocar)) <!-- 2023-09-29 14:46:26+00:00 -->
- [[#1709](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/pull/1709)] Add bug fix in bucket local variable ([luigi-bitonti](https://github.com/luigi-bitonti)) <!-- 2023-09-28 10:17:53+00:00 -->
- [[#1704](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/pull/1704)] Add cloud function secrets tests ([wiktorn](https://github.com/wiktorn)) <!-- 2023-09-26 09:22:36+00:00 -->
- [[#1703](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/pull/1703)] Add bug fix to allow to use Secret Manager secrets to mount files in … ([luigi-bitonti](https://github.com/luigi-bitonti)) <!-- 2023-09-25 13:27:03+00:00 -->

View File

@ -14,11 +14,11 @@ Use the following diagram as a simple high level reference for the following sec
<img src="diagram.svg" alt="Organization-level diagram">
</p>
## Table of contents
<!-- BEGIN TOC -->
- [Design overview and choices](#design-overview-and-choices)
- [User groups](#user-groups)
- [Organization-level IAM](#organization-level-iam)
- [Organization policies and tag-based conditions](#organization-policies-and-tag-based-conditions)
- [Automation project and resources](#automation-project-and-resources)
- [Billing account](#billing-account)
- [Organization-level logging](#organization-level-logging)
@ -26,6 +26,10 @@ Use the following diagram as a simple high level reference for the following sec
- [Workload Identity Federation and CI/CD](#workload-identity-federation-and-cicd)
- [How to run this stage](#how-to-run-this-stage)
- [Prerequisites](#prerequisites)
- [Standalone billing account](#standalone-billing-account)
- [Preventing creation of billing-related IAM bindings](#preventing-creation-of-billing-related-iam-bindings)
- [Groups](#groups)
- [Configure variables](#configure-variables)
- [Output files and cross-stage variables](#output-files-and-cross-stage-variables)
- [Running the stage](#running-the-stage)
- [Customizations](#customizations)
@ -35,6 +39,10 @@ Use the following diagram as a simple high level reference for the following sec
- [Names and naming convention](#names-and-naming-convention)
- [Workload Identity Federation](#workload-identity-federation)
- [CI/CD repositories](#cicd-repositories)
- [Files](#files)
- [Variables](#variables)
- [Outputs](#outputs)
<!-- END TOC -->
## Design overview and choices
@ -76,6 +84,38 @@ Management of the rest of the tag hierarchy is delegated to the resource managem
The organization policy tag key and values managed by this stage have been added to the `0-bootstrap.auto.tfvars` stage, so that IAM can be delegated to the resource management or successive stages via their ids.
The following example shows an example on how to define an additional tag value, and use it in a boolean constraint rule.
This snippet defines a new tag value under the `org-policies` tag key via the `org_policies_config` variable, and assigns the permission to bind it to a group.
```hcl
# stage 0 custom tfvars
org_policies_config = {
tag_values = {
compute-require-oslogin-false = {
description = "Bind this tag to set oslogin to false."
iam = {
"roles/resourcemanager.tagUser" = [
"group:foo@example.com"
]
}
}
}
}
# tftest skip
```
The above tag can be used to define a constraint condition via the `data/org-policies/compute.yaml` or similar factory file. The id in the condition is the organization id, followed by the name of the organization policy tag key (defaults to `org-policies`).
```yaml
compute.requireOsLogin:
rules:
- enforce: true
- enforce: false
condition:
expression: resource.matchTag('12345678/org-policies-config', 'compute-require-oslogin-false')
```
### Automation project and resources
One other design choice worth mentioning here is using a single automation project for all foundational stages. We trade off some complexity on the API side (single source for usage quota, multiple service activation) for increased flexibility and simpler operations, while still effectively providing the same degree of separation via resource-level IAM.

View File

@ -191,7 +191,9 @@ module "organization" {
description = "Organization policy conditions."
iam = {}
values = merge(
{ allowed-policy-member-domains-all = {} },
{
allowed-policy-member-domains-all = {}
},
var.org_policies_config.tag_values
)
}

View File

@ -77,6 +77,14 @@ resource "google_pubsub_subscription" "default" {
}
}
dynamic "retry_policy" {
for_each = each.value.retry_policy == null ? [] : [""]
content {
maximum_backoff = each.value.retry_policy.maximum_backoff
minimum_backoff = each.value.retry_policy.minimum_backoff
}
}
dynamic "push_config" {
for_each = each.value.push == null ? [] : [""]
content {