Merge remote-tracking branch 'origin/master' into fast-dev

This commit is contained in:
Ludovico Magnocavallo
2026-03-04 10:09:18 +00:00
34 changed files with 741 additions and 215 deletions

View File

@@ -2953,6 +2953,10 @@ counts:
google_logging_organization_sink: 3
google_logging_project_bucket_config: 3
google_logging_project_settings: 2
<<<<<<< HEAD
=======
google_monitoring_notification_channel: 1
>>>>>>> origin/master
google_org_policy_custom_constraint: 1
google_org_policy_policy: 37
google_organization_iam_audit_config: 1
@@ -2979,7 +2983,11 @@ counts:
google_tags_tag_value_iam_binding: 4
local_file: 9
modules: 50
<<<<<<< HEAD
resources: 325
=======
resources: 327
>>>>>>> origin/master
terraform_data: 4
outputs:

View File

@@ -16,7 +16,6 @@ clusters = {
master_global_access = true
}
access_config = {
dns_access = true
ip_access = {
disable_public_endpoint = true
}

View File

@@ -16,6 +16,9 @@ context = {
folder_ids = {
default = "organizations/1234567890"
}
kms_keys = {
test = "projects/test-kms-0/locations/europe-west8/keyRings/test/cryptoKeys/test"
}
iam_principals = {
mygroup = "group:test-group@example.com"
mysa = "serviceAccount:test@test-project.iam.gserviceaccount.com"
@@ -95,6 +98,9 @@ logging_data_access = {
DATA_READ = {}
}
}
logging_settings = {
kms_key_name = "$kms_keys:test"
}
logging_sinks = {
test-pubsub = {
destination = "$pubsub_topics:test"

View File

@@ -96,6 +96,9 @@ values:
condition: []
member: user:test-user@example.com
role: organizations/366118655033/roles/myRoleTwo
google_logging_folder_settings.default[0]:
kms_key_name: projects/test-kms-0/locations/europe-west8/keyRings/test/cryptoKeys/test
timeouts: null
google_logging_folder_sink.sink["test-pubsub"]:
description: test-pubsub (Terraform-managed).
destination: pubsub.googleapis.com/projects/test-prod-audit-logs-0/topics/audit-logs
@@ -153,9 +156,10 @@ counts:
google_folder_iam_audit_config: 1
google_folder_iam_binding: 7
google_folder_iam_member: 1
google_logging_folder_settings: 1
google_logging_folder_sink: 1
google_privileged_access_manager_entitlement: 1
google_pubsub_topic_iam_member: 1
google_tags_tag_binding: 1
modules: 0
resources: 16
resources: 17

View File

@@ -1,104 +0,0 @@
/**
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
locals {
ctx = {
custom_roles = {
# mixing in locally managed roles triggers a cycle
for k, v in var.factories_config.context.custom_roles :
"${local.ctx_p}custom_roles:${k}" => v
}
iam_principals = {
for k, v in var.factories_config.context.iam_principals :
"${local.ctx_p}iam_principals:${k}" => v
}
}
ctx_p = "$"
folder_id = (
var.assured_workload_config == null
? (
var.folder_create
? try(google_folder.folder[0].id, null)
: var.id
)
: format("folders/%s", try(google_assured_workloads_workload.folder[0].resources[0].resource_id, ""))
)
aw_parent = (
# Assured Workload only accepls folder as a parent and uses organization as a parent when no value provided.
var.parent == null
? null
: (
try(startswith(var.parent, "folders/"))
? var.parent
: null
)
)
}
resource "google_folder" "folder" {
count = var.folder_create && var.assured_workload_config == null ? 1 : 0
display_name = var.name
parent = var.parent
deletion_protection = var.deletion_protection
}
resource "google_essential_contacts_contact" "contact" {
provider = google-beta
for_each = var.contacts
parent = local.folder_id
email = each.key
language_tag = "en"
notification_category_subscriptions = each.value
depends_on = [
google_folder_iam_binding.authoritative,
google_folder_iam_binding.bindings,
google_folder_iam_member.bindings
]
}
resource "google_compute_firewall_policy_association" "default" {
count = var.firewall_policy == null ? 0 : 1
attachment_target = local.folder_id
name = var.firewall_policy.name
firewall_policy = var.firewall_policy.policy
}
resource "google_assured_workloads_workload" "folder" {
count = (var.assured_workload_config != null && var.folder_create) ? 1 : 0
compliance_regime = var.assured_workload_config.compliance_regime
display_name = var.assured_workload_config.display_name
location = var.assured_workload_config.location
organization = var.assured_workload_config.organization
enable_sovereign_controls = var.assured_workload_config.enable_sovereign_controls
labels = var.assured_workload_config.labels
partner = var.assured_workload_config.partner
dynamic "partner_permissions" {
for_each = try(var.assured_workload_config.partner_permissions, null) == null ? [] : [""]
content {
assured_workloads_monitoring = var.assured_workload_config.partner_permissions.assured_workloads_monitoring
data_logs_viewer = var.assured_workload_config.partner_permissions.data_logs_viewer
service_access_approver = var.assured_workload_config.partner_permissions.service_access_approver
}
}
provisioned_resources_parent = local.aw_parent
resource_settings {
display_name = var.name
resource_type = "CONSUMER_FOLDER"
}
violation_notifications_enabled = var.assured_workload_config.violation_notifications_enabled
}

View File

@@ -2,6 +2,9 @@ context = {
bigquery_datasets = {
test = "projects/test-prod-audit-logs-0/datasets/logs"
}
kms_keys = {
test = "projects/test-kms-0/locations/europe-west8/keyRings/test/cryptoKeys/test"
}
condition_vars = {
organization = {
id = 1234567890
@@ -137,6 +140,7 @@ logging_sinks = {
}
}
logging_settings = {
kms_key_name = "$kms_keys:test"
storage_location = "$locations:default"
}
pam_entitlements = {

View File

@@ -38,6 +38,7 @@ values:
parent: organizations/1234567890
timeouts: null
google_logging_organization_settings.default[0]:
kms_key_name: projects/test-kms-0/locations/europe-west8/keyRings/test/cryptoKeys/test
organization: '1234567890'
storage_location: europe-west8
timeouts: null