disable device policy support in vpc-sc module

This commit is contained in:
Ludovico Magnocavallo
2022-01-04 16:22:15 +01:00
parent c17b23b665
commit 79b7a6f40f
3 changed files with 51 additions and 52 deletions

View File

@@ -46,21 +46,18 @@ module "test" {
a1 = {
combining_function = null
conditions = [{
members = ["user:user1@example.com"],
device_policy = null, ip_subnetworks = null, negate = null,
regions = null, required_access_levels = null
members = ["user:user1@example.com"], ip_subnetworks = null,
negate = null, regions = null, required_access_levels = null
}]
}
a2 = {
combining_function = "OR"
conditions = [{
regions = ["IT", "FR"],
device_policy = null, ip_subnetworks = null, members = null,
negate = null, required_access_levels = null
regions = ["IT", "FR"], ip_subnetworks = null,
members = null, negate = null, required_access_levels = null
},{
ip_subnetworks = ["101.101.101.0/24"],
device_policy = null, members = null, negate = null,
regions = null, required_access_levels = null
ip_subnetworks = ["101.101.101.0/24"], members = null,
negate = null, regions = null, required_access_levels = null
}]
}
}
@@ -112,17 +109,15 @@ module "test" {
a1 = {
combining_function = null
conditions = [{
members = ["user:user1@example.com"],
device_policy = null, ip_subnetworks = null, negate = null,
regions = null, required_access_levels = null
members = ["user:user1@example.com"], ip_subnetworks = null,
negate = null, regions = null, required_access_levels = null
}]
}
a2 = {
combining_function = null
conditions = [{
members = ["user:user2@example.com"],
device_policy = null, ip_subnetworks = null, negate = null,
regions = null, required_access_levels = null
members = ["user:user2@example.com"], ip_subnetworks = null,
negate = null, regions = null, required_access_levels = null
}]
}
}
@@ -151,6 +146,7 @@ module "test" {
- [ ] implement support for the `google_access_context_manager_gcp_user_access_binding` resource
<!-- BEGIN TFDOC -->
## Variables
@@ -158,7 +154,7 @@ module "test" {
| name | description | type | required | default |
|---|---|:---:|:---:|:---:|
| access_policy | Access Policy name, leave null to use auto-created one. | <code>string</code> | ✓ | |
| access_levels | Map of access levels in name => [conditions] format. | <code title="map&#40;object&#40;&#123;&#10; combining_function &#61; string&#10; conditions &#61; list&#40;object&#40;&#123;&#10; device_policy &#61; object&#40;&#123;&#10; require_screen_lock &#61; bool&#10; allowed_encryption_statuses &#61; list&#40;string&#41;&#10; allowed_device_management_levels &#61; list&#40;string&#41;&#10; os_constraints &#61; list&#40;object&#40;&#123;&#10; minimum_version &#61; string&#10; os_type &#61; string&#10; require_verified_chrome_os &#61; bool&#10; &#125;&#41;&#41;&#10; require_admin_approval &#61; bool&#10; require_corp_owned &#61; bool&#10; &#125;&#41;&#10; ip_subnetworks &#61; list&#40;string&#41;&#10; members &#61; list&#40;string&#41;&#10; negate &#61; bool&#10; regions &#61; list&#40;string&#41;&#10; required_access_levels &#61; list&#40;string&#41;&#10; &#125;&#41;&#41;&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#123;&#125;</code> |
| access_levels | Map of access levels in name => [conditions] format. | <code title="map&#40;object&#40;&#123;&#10; combining_function &#61; string&#10; conditions &#61; list&#40;object&#40;&#123;&#10; ip_subnetworks &#61; list&#40;string&#41;&#10; members &#61; list&#40;string&#41;&#10; negate &#61; bool&#10; regions &#61; list&#40;string&#41;&#10; required_access_levels &#61; list&#40;string&#41;&#10; &#125;&#41;&#41;&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#123;&#125;</code> |
| access_policy_create | Access Policy configuration, fill in to create. Parent is in 'organizations/123456' format. | <code title="object&#40;&#123;&#10; parent &#61; string&#10; title &#61; string&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code>null</code> |
| service_perimeters_bridge | Bridge service perimeters. | <code title="map&#40;object&#40;&#123;&#10; spec_resources &#61; list&#40;string&#41;&#10; status_resources &#61; list&#40;string&#41;&#10; use_explicit_dry_run_spec &#61; bool&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#123;&#125;</code> |
| service_perimeters_regular | Regular service perimeters. | <code title="map&#40;object&#40;&#123;&#10; spec &#61; object&#40;&#123;&#10; access_levels &#61; list&#40;string&#41;&#10; resources &#61; list&#40;string&#41;&#10; restricted_services &#61; list&#40;string&#41;&#10; egress_policies &#61; list&#40;object&#40;&#123;&#10; egress_from &#61; object&#40;&#123;&#10; identity_type &#61; string&#10; identities &#61; list&#40;string&#41;&#10; &#125;&#41;&#10; egress_to &#61; object&#40;&#123;&#10; operations &#61; list&#40;object&#40;&#123;&#10; method_selectors &#61; list&#40;string&#41;&#10; service_name &#61; string&#10; &#125;&#41;&#41;&#10; resources &#61; list&#40;string&#41;&#10; &#125;&#41;&#10; &#125;&#41;&#41;&#10; ingress_policies &#61; list&#40;object&#40;&#123;&#10; ingress_from &#61; object&#40;&#123;&#10; identity_type &#61; string&#10; identities &#61; list&#40;string&#41;&#10; source_access_levels &#61; list&#40;string&#41;&#10; source_resources &#61; list&#40;string&#41;&#10; &#125;&#41;&#10; ingress_to &#61; object&#40;&#123;&#10; operations &#61; list&#40;object&#40;&#123;&#10; method_selectors &#61; list&#40;string&#41;&#10; service_name &#61; string&#10; &#125;&#41;&#41;&#10; resources &#61; list&#40;string&#41;&#10; &#125;&#41;&#10; &#125;&#41;&#41;&#10; vpc_accessible_services &#61; object&#40;&#123;&#10; allowed_services &#61; list&#40;string&#41;&#10; enable_restriction &#61; bool&#10; &#125;&#41;&#10; &#125;&#41;&#10; status &#61; object&#40;&#123;&#10; access_levels &#61; list&#40;string&#41;&#10; resources &#61; list&#40;string&#41;&#10; restricted_services &#61; list&#40;string&#41;&#10; egress_policies &#61; list&#40;object&#40;&#123;&#10; egress_from &#61; object&#40;&#123;&#10; identity_type &#61; string&#10; identities &#61; list&#40;string&#41;&#10; &#125;&#41;&#10; egress_to &#61; object&#40;&#123;&#10; operations &#61; list&#40;object&#40;&#123;&#10; method_selectors &#61; list&#40;string&#41;&#10; service_name &#61; string&#10; &#125;&#41;&#41;&#10; resources &#61; list&#40;string&#41;&#10; &#125;&#41;&#10; &#125;&#41;&#41;&#10; ingress_policies &#61; list&#40;object&#40;&#123;&#10; ingress_from &#61; object&#40;&#123;&#10; identity_type &#61; string&#10; identities &#61; list&#40;string&#41;&#10; source_access_levels &#61; list&#40;string&#41;&#10; source_resources &#61; list&#40;string&#41;&#10; &#125;&#41;&#10; ingress_to &#61; object&#40;&#123;&#10; operations &#61; list&#40;object&#40;&#123;&#10; method_selectors &#61; list&#40;string&#41;&#10; service_name &#61; string&#10; &#125;&#41;&#41;&#10; resources &#61; list&#40;string&#41;&#10; &#125;&#41;&#10; &#125;&#41;&#41;&#10; vpc_accessible_services &#61; object&#40;&#123;&#10; allowed_services &#61; list&#40;string&#41;&#10; enable_restriction &#61; bool&#10; &#125;&#41;&#10; &#125;&#41;&#10; use_explicit_dry_run_spec &#61; bool&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#123;&#125;</code> |
@@ -178,3 +174,4 @@ module "test" {

View File

@@ -33,30 +33,31 @@ resource "google_access_context_manager_access_level" "basic" {
)
iterator = condition
content {
dynamic "device_policy" {
for_each = toset(
condition.key.device_policy == null ? [] : [condition.key.device_policy]
)
iterator = device_policy
content {
dynamic "os_constraints" {
for_each = toset(
device_policy.key.os_constraints == null ? [] : device_policy.key.os_constraints
)
iterator = os_constraint
content {
minimum_version = os_constraint.key.minimum_version
os_type = os_constraint.key.os_type
require_verified_chrome_os = os_constraint.key.require_verified_chrome_os
}
}
allowed_encryption_statuses = device_policy.key.allowed_encryption_statuses
allowed_device_management_levels = device_policy.key.allowed_device_management_levels
require_admin_approval = device_policy.key.require_admin_approval
require_corp_owned = device_policy.key.require_corp_owned
require_screen_lock = device_policy.key.require_screen_lock
}
}
# uncomment here and in the variable type to enable
# dynamic "device_policy" {
# for_each = toset(
# condition.key.device_policy == null ? [] : [condition.key.device_policy]
# )
# iterator = device_policy
# content {
# dynamic "os_constraints" {
# for_each = toset(
# device_policy.key.os_constraints == null ? [] : device_policy.key.os_constraints
# )
# iterator = os_constraint
# content {
# minimum_version = os_constraint.key.minimum_version
# os_type = os_constraint.key.os_type
# require_verified_chrome_os = os_constraint.key.require_verified_chrome_os
# }
# }
# allowed_encryption_statuses = device_policy.key.allowed_encryption_statuses
# allowed_device_management_levels = device_policy.key.allowed_device_management_levels
# require_admin_approval = device_policy.key.require_admin_approval
# require_corp_owned = device_policy.key.require_corp_owned
# require_screen_lock = device_policy.key.require_screen_lock
# }
# }
ip_subnetworks = (
condition.key.ip_subnetworks == null ? [] : condition.key.ip_subnetworks
)

View File

@@ -19,18 +19,19 @@ variable "access_levels" {
type = map(object({
combining_function = string
conditions = list(object({
device_policy = object({
require_screen_lock = bool
allowed_encryption_statuses = list(string)
allowed_device_management_levels = list(string)
os_constraints = list(object({
minimum_version = string
os_type = string
require_verified_chrome_os = bool
}))
require_admin_approval = bool
require_corp_owned = bool
})
# disabled to reduce var surface, uncomment here and in resource to enable
# device_policy = object({
# require_screen_lock = bool
# allowed_encryption_statuses = list(string)
# allowed_device_management_levels = list(string)
# os_constraints = list(object({
# minimum_version = string
# os_type = string
# require_verified_chrome_os = bool
# }))
# require_admin_approval = bool
# require_corp_owned = bool
# })
ip_subnetworks = list(string)
members = list(string)
negate = bool