Use context syntax for VPC-SC access levels and policies (#3678)
* access levels as context * ingress/egress context in module * ingress/egress context in module * update FAST * tfdoc * context test
This commit is contained in:
committed by
GitHub
parent
75bc003960
commit
8490df96bf
@@ -157,7 +157,7 @@ module "test" {
|
||||
"serviceAccount:test-tf-0@myproject.iam.gserviceaccount.com",
|
||||
"serviceAccount:test-tf-1@myproject.iam.gserviceaccount.com"
|
||||
]
|
||||
access_levels = ["*"]
|
||||
access_levels = ["$access_levels:a1"]
|
||||
}
|
||||
to = {
|
||||
operations = [{ service_name = "*" }]
|
||||
@@ -181,11 +181,14 @@ module "test" {
|
||||
perimeters = {
|
||||
r1 = {
|
||||
status = {
|
||||
access_levels = ["a1", "a2"]
|
||||
access_levels = ["$access_levels:a1", "$access_levels:a2"]
|
||||
resources = ["projects/1111", "projects/2222"]
|
||||
restricted_services = ["storage.googleapis.com"]
|
||||
egress_policies = ["gcs-sa-foo"]
|
||||
ingress_policies = ["sa-tf-test", "sa-roles"]
|
||||
egress_policies = ["$egress_policies:gcs-sa-foo"]
|
||||
ingress_policies = [
|
||||
"$ingress_policies:sa-tf-test",
|
||||
"$ingress_policies:sa-roles"
|
||||
]
|
||||
vpc_accessible_services = {
|
||||
allowed_services = ["storage.googleapis.com"]
|
||||
enable_restriction = true
|
||||
@@ -228,7 +231,7 @@ module "vpc-sc" {
|
||||
perimeters = {
|
||||
p = {
|
||||
spec = {
|
||||
ingress_policies = ["i1"]
|
||||
ingress_policies = ["$ingress_policies:i1"]
|
||||
resources = ["projects/my-destionation-project"]
|
||||
}
|
||||
use_explicit_dry_run_spec = true
|
||||
@@ -269,21 +272,21 @@ module "test" {
|
||||
description: Main perimeter
|
||||
status:
|
||||
access_levels:
|
||||
- "geo-it"
|
||||
- "identity-user1"
|
||||
- $access_levels:geo-it
|
||||
- $access_levels:identity-user1
|
||||
resources:
|
||||
- "projects/1111"
|
||||
- "projects/2222"
|
||||
- projects/1111
|
||||
- projects/2222
|
||||
restricted_services:
|
||||
- "storage.googleapis.com"
|
||||
- storage.googleapis.com
|
||||
egress_policies:
|
||||
- "gcs-sa-foo"
|
||||
- $egress_policies:gcs-sa-foo
|
||||
ingress_policies:
|
||||
- "sa-tf-test-geo"
|
||||
- "sa-tf-test"
|
||||
- $ingress_policies:sa-tf-test-geo
|
||||
- $ingress_policies:sa-tf-test
|
||||
vpc_accessible_services:
|
||||
allowed_services:
|
||||
- "storage.googleapis.com"
|
||||
- storage.googleapis.com
|
||||
enable_restriction: yes
|
||||
|
||||
# tftest-file id=p1 path=data/perimeters/perimeter-north.yaml schema=perimeter.schema.json
|
||||
@@ -293,18 +296,18 @@ status:
|
||||
description: "Main perimeter"
|
||||
status:
|
||||
access_levels:
|
||||
- geo-it
|
||||
- identity-user1
|
||||
- $access_levels:geo-it
|
||||
- $access_levels:identity-user1
|
||||
resources:
|
||||
- projects/1111
|
||||
- projects/2222
|
||||
restricted_services:
|
||||
- storage.googleapis.com
|
||||
egress_policies:
|
||||
- gcs-sa-foo
|
||||
- $egress_policies:gcs-sa-foo
|
||||
ingress_policies:
|
||||
- sa-tf-test-geo
|
||||
- sa-tf-test
|
||||
- $ingress_policies:sa-tf-test-geo
|
||||
- $ingress_policies:sa-tf-test
|
||||
vpc_accessible_services:
|
||||
allowed_services:
|
||||
- storage.googleapis.com
|
||||
@@ -363,7 +366,7 @@ to:
|
||||
```yaml
|
||||
from:
|
||||
access_levels:
|
||||
- geo-it
|
||||
- $access_levels:geo-it
|
||||
identities:
|
||||
- serviceAccount:test-tf@myproject.iam.gserviceaccount.com
|
||||
to:
|
||||
@@ -402,15 +405,15 @@ to:
|
||||
| [access_policy](variables.tf#L68) | 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) title = optional(string) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [access_policy_create](variables.tf#L73) | 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> |
|
||||
| [context](variables.tf#L83) | External context used in replacements. | <code title="object({ condition_vars = optional(map(map(string)), {}) iam_principals = optional(map(string), {}) identity_sets = optional(map(list(string)), {}) project_numbers = optional(map(number), {}) resource_sets = optional(map(list(string)), {}) service_sets = optional(map(list(string)), {}) })">object({…})</code> | | <code>{}</code> |
|
||||
| [egress_policies](variables.tf#L97) | 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#L140) | Paths to folders that enable factory functionality. | <code title="object({ access_levels = optional(string) egress_policies = optional(string) ingress_policies = optional(string) perimeters = optional(string) })">object({…})</code> | | <code>{}</code> |
|
||||
| [iam](variables.tf#L152) | IAM bindings in {ROLE => [MEMBERS]} format. | <code>map(list(string))</code> | | <code>{}</code> |
|
||||
| [iam_bindings](variables.tf#L158) | 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#L173) | 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#L188) | 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> |
|
||||
| [perimeters](variables.tf#L230) | Regular service perimeters. | <code title="map(object({ description = optional(string) ignore_resource_changes = optional(bool, false) title = optional(string) use_explicit_dry_run_spec = optional(bool, false) spec = optional(object({ access_levels = optional(list(string), []) egress_policies = optional(list(string), []) ingress_policies = optional(list(string), []) restricted_services = optional(list(string), []) resources = 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), []) 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>{}</code> |
|
||||
| [project_id_search_scope](variables.tf#L264) | Set this to an organization or folder ID to use Cloud Asset Inventory to automatically translate project ids to numbers. | <code>string</code> | | <code>null</code> |
|
||||
| [context](variables.tf#L83) | External context used in replacements. | <code title="object({ access_levels = optional(map(string), {}) condition_vars = optional(map(map(string)), {}) iam_principals = optional(map(string), {}) identity_sets = optional(map(list(string)), {}) project_numbers = optional(map(number), {}) resource_sets = optional(map(list(string)), {}) service_sets = optional(map(list(string)), {}) })">object({…})</code> | | <code>{}</code> |
|
||||
| [egress_policies](variables.tf#L98) | 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#L141) | Paths to folders that enable factory functionality. | <code title="object({ access_levels = optional(string) egress_policies = optional(string) ingress_policies = optional(string) perimeters = optional(string) })">object({…})</code> | | <code>{}</code> |
|
||||
| [iam](variables.tf#L153) | IAM bindings in {ROLE => [MEMBERS]} format. | <code>map(list(string))</code> | | <code>{}</code> |
|
||||
| [iam_bindings](variables.tf#L159) | 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#L174) | 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#L189) | 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> |
|
||||
| [perimeters](variables.tf#L231) | Regular service perimeters. | <code title="map(object({ description = optional(string) ignore_resource_changes = optional(bool, false) title = optional(string) use_explicit_dry_run_spec = optional(bool, false) spec = optional(object({ access_levels = optional(list(string), []) egress_policies = optional(list(string), []) ingress_policies = optional(list(string), []) restricted_services = optional(list(string), []) resources = 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), []) 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>{}</code> |
|
||||
| [project_id_search_scope](variables.tf#L265) | Set this to an organization or folder ID to use Cloud Asset Inventory to automatically translate project ids to numbers. | <code>string</code> | | <code>null</code> |
|
||||
|
||||
## Outputs
|
||||
|
||||
@@ -451,10 +454,13 @@ module "test" {
|
||||
perimeters = {
|
||||
default = {
|
||||
status = {
|
||||
access_levels = ["geo-it"]
|
||||
resources = ["projects/1111"]
|
||||
egress_policies = ["factory-egress-policy"]
|
||||
ingress_policies = ["variable-policy", "factory-ingress-policy"]
|
||||
access_levels = ["geo-it"]
|
||||
resources = ["projects/1111"]
|
||||
egress_policies = ["$egress_policies:factory-egress-policy"]
|
||||
ingress_policies = [
|
||||
"$ingress_policies:variable-policy",
|
||||
"$ingress_policies:factory-ingress-policy"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user