Add VPC-SC support for Regions, device policy and access policy dependency (#210)
* Add VPC-SC support for Regions, device policy and access policy dependency. * fix compute mig module test * Fixes * Fix example Co-authored-by: Ludovico Magnocavallo <ludomagno@google.com>
This commit is contained in:
@@ -20,8 +20,11 @@ module "vpc-sc" {
|
|||||||
combining_function = "AND"
|
combining_function = "AND"
|
||||||
conditions = [{
|
conditions = [{
|
||||||
ip_subnetworks = ["85.85.85.52/32"]
|
ip_subnetworks = ["85.85.85.52/32"]
|
||||||
|
required_access_levels = null
|
||||||
members = []
|
members = []
|
||||||
negate = false
|
negate = false
|
||||||
|
device_policy = null
|
||||||
|
regions = null
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -60,8 +63,11 @@ module "vpc-sc" {
|
|||||||
combining_function = "AND"
|
combining_function = "AND"
|
||||||
conditions = [{
|
conditions = [{
|
||||||
ip_subnetworks = ["85.85.85.52/32"]
|
ip_subnetworks = ["85.85.85.52/32"]
|
||||||
|
required_access_levels = null
|
||||||
members = []
|
members = []
|
||||||
negate = false
|
negate = false
|
||||||
|
device_policy = null
|
||||||
|
regions = null
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -101,7 +107,7 @@ module "vpc-sc" {
|
|||||||
| access_policy_title | Access Policy title to be created. | <code title="">string</code> | ✓ | |
|
| access_policy_title | Access Policy title to be created. | <code title="">string</code> | ✓ | |
|
||||||
| organization_id | Organization id in organizations/nnnnnn format. | <code title="">string</code> | ✓ | |
|
| organization_id | Organization id in organizations/nnnnnn format. | <code title="">string</code> | ✓ | |
|
||||||
| *access_level_perimeters* | Enforced mode -> Access Level -> Perimeters mapping. Enforced mode can be 'enforced' or 'dry_run' | <code title="map(map(list(string)))">map(map(list(string)))</code> | | <code title="">{}</code> |
|
| *access_level_perimeters* | Enforced mode -> Access Level -> Perimeters mapping. Enforced mode can be 'enforced' or 'dry_run' | <code title="map(map(list(string)))">map(map(list(string)))</code> | | <code title="">{}</code> |
|
||||||
| *access_levels* | Access Levels. | <code title="map(object({ combining_function = string conditions = list(object({ ip_subnetworks = list(string) members = list(string) negate = string })) }))">map(object({...}))</code> | | <code title="">{}</code> |
|
| *access_levels* | Map of Access Levels to be created. For each Access Level you can specify 'ip_subnetworks, required_access_levels, members, negate, device_policy or regions'. | <code title="map(object({ combining_function = string conditions = list(object({ ip_subnetworks = list(string) required_access_levels = list(string) members = list(string) negate = string device_policy = object({ require_screen_lock = bool allowed_encryption_statuses = string allowed_device_management_levels = string require_admin_approval = bool require_corp_owned = bool }) regions = list(string) })) }))">map(object({...}))</code> | | <code title="">{}</code> |
|
||||||
| *perimeter_projects* | Perimeter -> Enforced Mode -> Projects Number mapping. Enforced mode can be 'enforced' or 'dry_run'. | <code title="map(map(list(number)))">map(map(list(number)))</code> | | <code title="">{}</code> |
|
| *perimeter_projects* | Perimeter -> Enforced Mode -> Projects Number mapping. Enforced mode can be 'enforced' or 'dry_run'. | <code title="map(map(list(number)))">map(map(list(number)))</code> | | <code title="">{}</code> |
|
||||||
| *perimeters* | Set of Perimeters. | <code title="map(object({ type = string dry_run_config = object({ restricted_services = list(string) vpc_accessible_services = list(string) }) enforced_config = object({ restricted_services = list(string) vpc_accessible_services = list(string) }) }))">map(object({...}))</code> | | <code title="">{}</code> |
|
| *perimeters* | Set of Perimeters. | <code title="map(object({ type = string dry_run_config = object({ restricted_services = list(string) vpc_accessible_services = list(string) }) enforced_config = object({ restricted_services = list(string) vpc_accessible_services = list(string) }) }))">map(object({...}))</code> | | <code title="">{}</code> |
|
||||||
|
|
||||||
|
|||||||
@@ -44,13 +44,23 @@ resource "google_access_context_manager_access_level" "default" {
|
|||||||
|
|
||||||
dynamic "basic" {
|
dynamic "basic" {
|
||||||
for_each = try(toset(each.value.conditions), [])
|
for_each = try(toset(each.value.conditions), [])
|
||||||
|
iterator = condition
|
||||||
|
|
||||||
content {
|
content {
|
||||||
combining_function = try(each.value.combining_function, null)
|
combining_function = try(each.value.combining_function, null)
|
||||||
conditions {
|
conditions {
|
||||||
ip_subnetworks = try(basic.value.ip_subnetworks, null)
|
ip_subnetworks = try(condition.value.ip_subnetworks, null)
|
||||||
members = try(basic.value.members, null)
|
required_access_levels = try(condition.value.required_access_levels, null)
|
||||||
negate = try(basic.value.negate, null)
|
members = try(condition.value.members, null)
|
||||||
|
negate = try(condition.value.negate, null)
|
||||||
|
device_policy {
|
||||||
|
require_screen_lock = try(condition.value.device_policy.require_screen_lock, null)
|
||||||
|
allowed_encryption_statuses = try(condition.value.device_policy.allowed_encryption_statuses, null)
|
||||||
|
allowed_device_management_levels = try(condition.value.device_policy.allowed_device_management_levels, null)
|
||||||
|
require_admin_approval = try(condition.value.device_policy.require_admin_approval, null)
|
||||||
|
require_corp_owned = try(condition.value.device_policy.require_corp_owned, null)
|
||||||
|
}
|
||||||
|
regions = try(condition.value.regions, null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,13 +15,22 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
variable "access_levels" {
|
variable "access_levels" {
|
||||||
description = "Access Levels."
|
description = "Map of Access Levels to be created. For each Access Level you can specify 'ip_subnetworks, required_access_levels, members, negate, device_policy or regions'."
|
||||||
type = map(object({
|
type = map(object({
|
||||||
combining_function = string
|
combining_function = string
|
||||||
conditions = list(object({
|
conditions = list(object({
|
||||||
ip_subnetworks = list(string)
|
ip_subnetworks = list(string)
|
||||||
members = list(string)
|
required_access_levels = list(string)
|
||||||
negate = string
|
members = list(string)
|
||||||
|
negate = string
|
||||||
|
device_policy = object({
|
||||||
|
require_screen_lock = bool
|
||||||
|
allowed_encryption_statuses = string
|
||||||
|
allowed_device_management_levels = string
|
||||||
|
require_admin_approval = bool
|
||||||
|
require_corp_owned = bool
|
||||||
|
})
|
||||||
|
regions = list(string)
|
||||||
}))
|
}))
|
||||||
}))
|
}))
|
||||||
default = {}
|
default = {}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ def test_autoscaler(plan_runner):
|
|||||||
assert autoscaler['type'] == 'google_compute_autoscaler'
|
assert autoscaler['type'] == 'google_compute_autoscaler'
|
||||||
assert autoscaler['values']['autoscaling_policy'] == [{
|
assert autoscaler['values']['autoscaling_policy'] == [{
|
||||||
'cooldown_period': 60,
|
'cooldown_period': 60,
|
||||||
'cpu_utilization': [{'target': 65}],
|
'cpu_utilization': [{'predictive_method': 'NONE', 'target': 65}],
|
||||||
'load_balancing_utilization': [],
|
'load_balancing_utilization': [],
|
||||||
'max_replicas': 3,
|
'max_replicas': 3,
|
||||||
'metric': [],
|
'metric': [],
|
||||||
|
|||||||
Reference in New Issue
Block a user