Add roles support to VPC-SC (#3000)
This commit is contained in:
@@ -305,13 +305,13 @@ Some references that might be useful in setting up this stage:
|
||||
| [organization](variables-fast.tf#L35) | Organization details. | <code title="object({ domain = string id = number customer_id = string })">object({…})</code> | ✓ | | <code>0-bootstrap</code> |
|
||||
| [access_levels](variables.tf#L17) | Access level definitions. | <code title="map(object({ combining_function = optional(string) conditions = optional(list(object({ device_policy = optional(object({ allowed_device_management_levels = optional(list(string)) allowed_encryption_statuses = optional(list(string)) require_admin_approval = bool require_corp_owned = bool require_screen_lock = optional(bool) os_constraints = optional(list(object({ os_type = string minimum_version = optional(string) require_verified_chrome_os = optional(bool) }))) })) ip_subnetworks = optional(list(string), []) members = optional(list(string), []) negate = optional(bool) regions = optional(list(string), []) required_access_levels = optional(list(string), []) vpc_subnets = optional(map(list(string)), {}) })), []) description = optional(string) }))">map(object({…}))</code> | | <code>{}</code> | |
|
||||
| [access_policy](variables.tf#L67) | Access policy id (used for tenant-level VPC-SC configurations). | <code>number</code> | | <code>null</code> | |
|
||||
| [egress_policies](variables.tf#L73) | Egress policy definitions that can be referenced in perimeters. | <code title="map(object({ title = optional(string) from = object({ access_levels = optional(list(string), []) identity_type = optional(string) identities = optional(list(string)) resources = optional(list(string), []) }) to = object({ external_resources = optional(list(string)) operations = optional(list(object({ method_selectors = optional(list(string)) permission_selectors = optional(list(string)) service_name = string })), []) resources = optional(list(string)) }) }))">map(object({…}))</code> | | <code>{}</code> | |
|
||||
| [factories_config](variables.tf#L115) | Paths to folders that enable factory functionality. | <code title="object({ access_levels = optional(string, "data/access-levels") egress_policies = optional(string, "data/egress-policies") ingress_policies = optional(string, "data/ingress-policies") })">object({…})</code> | | <code>{}</code> | |
|
||||
| [ingress_policies](variables.tf#L126) | Ingress policy definitions that can be referenced in perimeters. | <code title="map(object({ title = optional(string) from = object({ access_levels = optional(list(string), []) identity_type = optional(string) identities = optional(list(string)) resources = optional(list(string), []) }) to = object({ operations = optional(list(object({ method_selectors = optional(list(string)) permission_selectors = optional(list(string)) service_name = string })), []) resources = optional(list(string)) }) }))">map(object({…}))</code> | | <code>{}</code> | |
|
||||
| [egress_policies](variables.tf#L73) | Egress policy definitions that can be referenced in perimeters. | <code title="map(object({ title = optional(string) from = object({ access_levels = optional(list(string), []) identity_type = optional(string) identities = optional(list(string)) resources = optional(list(string), []) }) to = object({ external_resources = optional(list(string)) operations = optional(list(object({ method_selectors = optional(list(string)) permission_selectors = optional(list(string)) service_name = string })), []) resources = optional(list(string)) roles = optional(list(string)) }) }))">map(object({…}))</code> | | <code>{}</code> | |
|
||||
| [factories_config](variables.tf#L116) | Paths to folders that enable factory functionality. | <code title="object({ access_levels = optional(string, "data/access-levels") egress_policies = optional(string, "data/egress-policies") ingress_policies = optional(string, "data/ingress-policies") })">object({…})</code> | | <code>{}</code> | |
|
||||
| [ingress_policies](variables.tf#L127) | Ingress policy definitions that can be referenced in perimeters. | <code title="map(object({ title = optional(string) from = object({ access_levels = optional(list(string), []) identity_type = optional(string) identities = optional(list(string)) resources = optional(list(string), []) }) to = object({ operations = optional(list(object({ method_selectors = optional(list(string)) permission_selectors = optional(list(string)) service_name = string })), []) resources = optional(list(string)) roles = optional(list(string)) }) }))">map(object({…}))</code> | | <code>{}</code> | |
|
||||
| [logging](variables-fast.tf#L25) | Log writer identities for organization / folders. | <code title="object({ project_number = string writer_identities = map(string) })">object({…})</code> | | <code>null</code> | <code>0-bootstrap</code> |
|
||||
| [outputs_location](variables.tf#L167) | Path where providers, tfvars files, and lists for the following stages are written. Leave empty to disable. | <code>string</code> | | <code>null</code> | |
|
||||
| [perimeters](variables.tf#L173) | Perimeter definitions. | <code title="map(object({ access_levels = optional(list(string), []) dry_run = optional(bool, true) egress_policies = optional(list(string), []) ingress_policies = optional(list(string), []) resources = optional(list(string), []) restricted_services = optional(list(string)) vpc_accessible_services = optional(object({ allowed_services = list(string) enable_restriction = optional(bool, true) })) }))">map(object({…}))</code> | | <code title="{ default = { access_levels = ["geo"] ingress_policies = ["fast-org-log-sinks"] } }">{…}</code> | |
|
||||
| [resource_discovery](variables.tf#L196) | Automatic discovery of perimeter projects. | <code title="object({ enabled = optional(bool, true) ignore_folders = optional(list(string), []) ignore_projects = optional(list(string), []) include_projects = optional(list(string), []) })">object({…})</code> | | <code>{}</code> | |
|
||||
| [outputs_location](variables.tf#L169) | Path where providers, tfvars files, and lists for the following stages are written. Leave empty to disable. | <code>string</code> | | <code>null</code> | |
|
||||
| [perimeters](variables.tf#L175) | Perimeter definitions. | <code title="map(object({ access_levels = optional(list(string), []) dry_run = optional(bool, true) egress_policies = optional(list(string), []) ingress_policies = optional(list(string), []) resources = optional(list(string), []) restricted_services = optional(list(string)) vpc_accessible_services = optional(object({ allowed_services = list(string) enable_restriction = optional(bool, true) })) }))">map(object({…}))</code> | | <code title="{ default = { access_levels = ["geo"] ingress_policies = ["fast-org-log-sinks"] } }">{…}</code> | |
|
||||
| [resource_discovery](variables.tf#L198) | Automatic discovery of perimeter projects. | <code title="object({ enabled = optional(bool, true) ignore_folders = optional(list(string), []) ignore_projects = optional(list(string), []) include_projects = optional(list(string), []) })">object({…})</code> | | <code>{}</code> | |
|
||||
| [root_node](variables-fast.tf#L45) | Root node for the hierarchy, if running in tenant mode. | <code>string</code> | | <code>null</code> | <code>0-bootstrap</code> |
|
||||
|
||||
## Outputs
|
||||
|
||||
@@ -88,6 +88,7 @@ variable "egress_policies" {
|
||||
service_name = string
|
||||
})), [])
|
||||
resources = optional(list(string))
|
||||
roles = optional(list(string))
|
||||
})
|
||||
}))
|
||||
default = {}
|
||||
@@ -140,6 +141,7 @@ variable "ingress_policies" {
|
||||
service_name = string
|
||||
})), [])
|
||||
resources = optional(list(string))
|
||||
roles = optional(list(string))
|
||||
})
|
||||
}))
|
||||
default = {}
|
||||
|
||||
@@ -193,6 +193,19 @@ module "test" {
|
||||
resources = ["*"]
|
||||
}
|
||||
}
|
||||
sa-roles = {
|
||||
from = {
|
||||
identities = [
|
||||
"serviceAccount:test-tf-2@myproject.iam.gserviceaccount.com",
|
||||
]
|
||||
access_levels = ["*"]
|
||||
}
|
||||
to = {
|
||||
operations = [{ service_name = "*" }]
|
||||
resources = ["*"]
|
||||
roles = ["roles/storage.objectViewer"]
|
||||
}
|
||||
}
|
||||
}
|
||||
service_perimeters_regular = {
|
||||
r1 = {
|
||||
@@ -201,7 +214,7 @@ module "test" {
|
||||
resources = ["projects/11111", "projects/111111"]
|
||||
restricted_services = ["storage.googleapis.com"]
|
||||
egress_policies = ["gcs-sa-foo"]
|
||||
ingress_policies = ["sa-tf-test"]
|
||||
ingress_policies = ["sa-tf-test", "sa-roles"]
|
||||
vpc_accessible_services = {
|
||||
allowed_services = ["storage.googleapis.com"]
|
||||
enable_restriction = true
|
||||
@@ -342,14 +355,14 @@ to:
|
||||
| [access_policy](variables.tf#L67) | Access Policy name, set to null if creating one. | <code>string</code> | ✓ | |
|
||||
| [access_levels](variables.tf#L17) | Access level definitions. | <code title="map(object({ combining_function = optional(string) conditions = optional(list(object({ device_policy = optional(object({ allowed_device_management_levels = optional(list(string)) allowed_encryption_statuses = optional(list(string)) require_admin_approval = bool require_corp_owned = bool require_screen_lock = optional(bool) os_constraints = optional(list(object({ os_type = string minimum_version = optional(string) require_verified_chrome_os = optional(bool) }))) })) ip_subnetworks = optional(list(string), []) members = optional(list(string), []) negate = optional(bool) regions = optional(list(string), []) required_access_levels = optional(list(string), []) vpc_subnets = optional(map(list(string)), {}) })), []) description = optional(string) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [access_policy_create](variables.tf#L72) | Access Policy configuration, fill in to create. Parent is in 'organizations/123456' format, scopes are in 'folders/456789' or 'projects/project_id' format. | <code title="object({ parent = string title = string scopes = optional(list(string), null) })">object({…})</code> | | <code>null</code> |
|
||||
| [egress_policies](variables.tf#L82) | Egress policy definitions that can be referenced in perimeters. | <code title="map(object({ title = optional(string) from = object({ access_levels = optional(list(string), []) identity_type = optional(string) identities = optional(list(string)) resources = optional(list(string), []) }) to = object({ external_resources = optional(list(string)) operations = optional(list(object({ method_selectors = optional(list(string)) permission_selectors = optional(list(string)) service_name = string })), []) resources = optional(list(string)) }) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [factories_config](variables.tf#L124) | Paths to folders that enable factory functionality. | <code title="object({ access_levels = optional(string) egress_policies = optional(string) ingress_policies = optional(string) restricted_services = optional(string, "data/restricted-services.yaml") })">object({…})</code> | | <code>{}</code> |
|
||||
| [iam](variables.tf#L136) | IAM bindings in {ROLE => [MEMBERS]} format. | <code>map(list(string))</code> | | <code>{}</code> |
|
||||
| [iam_bindings](variables.tf#L142) | Authoritative IAM bindings in {KEY => {role = ROLE, members = [], condition = {}}}. Keys are arbitrary. | <code title="map(object({ members = list(string) role = string condition = optional(object({ expression = string title = string description = optional(string) })) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [iam_bindings_additive](variables.tf#L157) | Individual additive IAM bindings. Keys are arbitrary. | <code title="map(object({ member = string role = string condition = optional(object({ expression = string title = string description = optional(string) })) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [ingress_policies](variables.tf#L172) | Ingress policy definitions that can be referenced in perimeters. | <code title="map(object({ title = optional(string) from = object({ access_levels = optional(list(string), []) identity_type = optional(string) identities = optional(list(string)) resources = optional(list(string), []) }) to = object({ operations = optional(list(object({ method_selectors = optional(list(string)) permission_selectors = optional(list(string)) service_name = string })), []) resources = optional(list(string)) }) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [service_perimeters_bridge](variables.tf#L213) | Bridge service perimeters. | <code title="map(object({ spec_resources = optional(list(string)) status_resources = optional(list(string)) use_explicit_dry_run_spec = optional(bool, false) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [service_perimeters_regular](variables.tf#L223) | Regular service perimeters. | <code title="map(object({ description = optional(string) spec = optional(object({ access_levels = optional(list(string)) resources = optional(list(string)) restricted_services = optional(list(string)) egress_policies = optional(list(string)) ingress_policies = optional(list(string)) vpc_accessible_services = optional(object({ allowed_services = list(string) enable_restriction = optional(bool, true) })) })) status = optional(object({ access_levels = optional(list(string)) resources = optional(list(string)) restricted_services = optional(list(string)) egress_policies = optional(list(string)) ingress_policies = optional(list(string)) vpc_accessible_services = optional(object({ allowed_services = list(string) enable_restriction = bool })) })) use_explicit_dry_run_spec = optional(bool, false) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [egress_policies](variables.tf#L82) | Egress policy definitions that can be referenced in perimeters. | <code title="map(object({ title = optional(string) from = object({ access_levels = optional(list(string), []) identity_type = optional(string) identities = optional(list(string)) resources = optional(list(string), []) }) to = object({ external_resources = optional(list(string)) operations = optional(list(object({ method_selectors = optional(list(string)) permission_selectors = optional(list(string)) service_name = string })), []) resources = optional(list(string)) roles = optional(list(string)) }) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [factories_config](variables.tf#L125) | Paths to folders that enable factory functionality. | <code title="object({ access_levels = optional(string) egress_policies = optional(string) ingress_policies = optional(string) restricted_services = optional(string, "data/restricted-services.yaml") })">object({…})</code> | | <code>{}</code> |
|
||||
| [iam](variables.tf#L137) | IAM bindings in {ROLE => [MEMBERS]} format. | <code>map(list(string))</code> | | <code>{}</code> |
|
||||
| [iam_bindings](variables.tf#L143) | Authoritative IAM bindings in {KEY => {role = ROLE, members = [], condition = {}}}. Keys are arbitrary. | <code title="map(object({ members = list(string) role = string condition = optional(object({ expression = string title = string description = optional(string) })) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [iam_bindings_additive](variables.tf#L158) | Individual additive IAM bindings. Keys are arbitrary. | <code title="map(object({ member = string role = string condition = optional(object({ expression = string title = string description = optional(string) })) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [ingress_policies](variables.tf#L173) | Ingress policy definitions that can be referenced in perimeters. | <code title="map(object({ title = optional(string) from = object({ access_levels = optional(list(string), []) identity_type = optional(string) identities = optional(list(string)) resources = optional(list(string), []) }) to = object({ operations = optional(list(object({ method_selectors = optional(list(string)) permission_selectors = optional(list(string)) service_name = string })), []) resources = optional(list(string)) roles = optional(list(string)) }) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [service_perimeters_bridge](variables.tf#L215) | Bridge service perimeters. | <code title="map(object({ spec_resources = optional(list(string)) status_resources = optional(list(string)) use_explicit_dry_run_spec = optional(bool, false) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [service_perimeters_regular](variables.tf#L225) | Regular service perimeters. | <code title="map(object({ description = optional(string) spec = optional(object({ access_levels = optional(list(string)) resources = optional(list(string)) restricted_services = optional(list(string)) egress_policies = optional(list(string)) ingress_policies = optional(list(string)) vpc_accessible_services = optional(object({ allowed_services = list(string) enable_restriction = optional(bool, true) })) })) status = optional(object({ access_levels = optional(list(string)) resources = optional(list(string)) restricted_services = optional(list(string)) egress_policies = optional(list(string)) ingress_policies = optional(list(string)) vpc_accessible_services = optional(object({ allowed_services = list(string) enable_restriction = bool })) })) use_explicit_dry_run_spec = optional(bool, false) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
|
||||
## Outputs
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@ locals {
|
||||
}, o)
|
||||
]
|
||||
resources = try(v.to.resources, [])
|
||||
roles = try(v.to.roles, [])
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,6 +87,7 @@ locals {
|
||||
}, o)
|
||||
]
|
||||
resources = try(v.to.resources, [])
|
||||
roles = try(v.to.roles, [])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,6 +87,12 @@
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"roles": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,6 +80,12 @@
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"roles": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,6 +88,7 @@ resource "google_access_context_manager_service_perimeter" "regular" {
|
||||
content {
|
||||
external_resources = policy.value.to.external_resources
|
||||
resources = policy.value.to.resources
|
||||
roles = policy.value.to.roles
|
||||
dynamic "operations" {
|
||||
for_each = toset(policy.value.to.operations)
|
||||
iterator = o
|
||||
@@ -146,6 +147,7 @@ resource "google_access_context_manager_service_perimeter" "regular" {
|
||||
for_each = policy.value.to == null ? [] : [""]
|
||||
content {
|
||||
resources = policy.value.to.resources
|
||||
roles = policy.value.to.roles
|
||||
dynamic "operations" {
|
||||
for_each = toset(policy.value.to.operations)
|
||||
iterator = o
|
||||
@@ -235,6 +237,7 @@ resource "google_access_context_manager_service_perimeter" "regular" {
|
||||
content {
|
||||
external_resources = policy.value.to.external_resources
|
||||
resources = policy.value.to.resources
|
||||
roles = policy.value.to.roles
|
||||
dynamic "operations" {
|
||||
for_each = toset(policy.value.to.operations)
|
||||
iterator = o
|
||||
@@ -294,6 +297,7 @@ resource "google_access_context_manager_service_perimeter" "regular" {
|
||||
for_each = policy.value.to == null ? [] : [""]
|
||||
content {
|
||||
resources = policy.value.to.resources
|
||||
roles = policy.value.to.roles
|
||||
dynamic "operations" {
|
||||
for_each = toset(policy.value.to.operations)
|
||||
iterator = o
|
||||
|
||||
@@ -97,6 +97,7 @@ variable "egress_policies" {
|
||||
service_name = string
|
||||
})), [])
|
||||
resources = optional(list(string))
|
||||
roles = optional(list(string))
|
||||
})
|
||||
}))
|
||||
default = {}
|
||||
@@ -186,6 +187,7 @@ variable "ingress_policies" {
|
||||
service_name = string
|
||||
})), [])
|
||||
resources = optional(list(string))
|
||||
roles = optional(list(string))
|
||||
})
|
||||
}))
|
||||
default = {}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2023 Google LLC
|
||||
# Copyright 2025 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -24,9 +24,12 @@ values:
|
||||
negate: null
|
||||
regions: []
|
||||
required_access_levels: []
|
||||
vpc_network_sources: []
|
||||
custom: []
|
||||
description: null
|
||||
name: accessPolicies/12345678/accessLevels/a1
|
||||
parent: accessPolicies/12345678
|
||||
timeouts: null
|
||||
title: a1
|
||||
module.test.google_access_context_manager_access_level.basic["a2"]:
|
||||
basic:
|
||||
@@ -39,11 +42,15 @@ values:
|
||||
negate: null
|
||||
regions: []
|
||||
required_access_levels: []
|
||||
vpc_network_sources: []
|
||||
custom: []
|
||||
description: null
|
||||
name: accessPolicies/12345678/accessLevels/a2
|
||||
parent: accessPolicies/12345678
|
||||
timeouts: null
|
||||
title: a2
|
||||
module.test.google_access_context_manager_service_perimeter.regular["r1"]:
|
||||
description: null
|
||||
name: accessPolicies/12345678/servicePerimeters/r1
|
||||
parent: accessPolicies/12345678
|
||||
perimeter_type: PERIMETER_TYPE_REGULAR
|
||||
@@ -54,6 +61,8 @@ values:
|
||||
- identities:
|
||||
- serviceAccount:foo@myproject.iam.gserviceaccount.com
|
||||
identity_type: null
|
||||
source_restriction: SOURCE_RESTRICTION_DISABLED
|
||||
sources: []
|
||||
egress_to:
|
||||
- external_resources: null
|
||||
operations:
|
||||
@@ -63,20 +72,41 @@ values:
|
||||
service_name: storage.googleapis.com
|
||||
resources:
|
||||
- projects/123456789
|
||||
roles: null
|
||||
title: gcs-sa-foo
|
||||
ingress_policies:
|
||||
- ingress_from:
|
||||
- identities:
|
||||
- serviceAccount:test-tf-0@myproject.iam.gserviceaccount.com
|
||||
- serviceAccount:test-tf-1@myproject.iam.gserviceaccount.com
|
||||
- serviceAccount:test-tf-2@myproject.iam.gserviceaccount.com
|
||||
identity_type: null
|
||||
sources:
|
||||
- resource: null
|
||||
- access_level: '*'
|
||||
resource: null
|
||||
ingress_to:
|
||||
- operations:
|
||||
- method_selectors: []
|
||||
service_name: '*'
|
||||
resources:
|
||||
- '*'
|
||||
roles:
|
||||
- roles/storage.objectViewer
|
||||
title: sa-roles
|
||||
- ingress_from:
|
||||
- identities:
|
||||
- serviceAccount:test-tf-0@myproject.iam.gserviceaccount.com
|
||||
- serviceAccount:test-tf-1@myproject.iam.gserviceaccount.com
|
||||
identity_type: null
|
||||
sources:
|
||||
- access_level: '*'
|
||||
resource: null
|
||||
ingress_to:
|
||||
- operations:
|
||||
- method_selectors: []
|
||||
service_name: '*'
|
||||
resources:
|
||||
- '*'
|
||||
roles: null
|
||||
title: sa-tf-test
|
||||
resources:
|
||||
- projects/11111
|
||||
- projects/111111
|
||||
@@ -86,6 +116,7 @@ values:
|
||||
- allowed_services:
|
||||
- storage.googleapis.com
|
||||
enable_restriction: true
|
||||
timeouts: null
|
||||
title: r1
|
||||
use_explicit_dry_run_spec: false
|
||||
|
||||
|
||||
Reference in New Issue
Block a user