Policy Packs
GCP CIS v2.0.0 - Section 3 - Networking

Policy Setting: GCP > Network > Network > Approved > Custom

Policies

This policy setting is dependent on the following policy types:

Source

resource "turbot_policy_setting" "gcp_network_approved_custom" {
resource = turbot_policy_pack.main.id
type = "tmod:@turbot/gcp-network#/policy/types/networkApprovedCustom"
note = "GCP CIS v2.0.0 - Control: 3.1 and 3.2"
template_input = <<-EOT
{
network {
name: get(path: "name")
autoCreateSubnetworks: get(path: "autoCreateSubnetworks")
}
}
EOT
template = <<-EOT
{%- set results = [] -%}
{%- if $.network.name == "default" -%}
{%- set data = {
"title": "Default Network",
"result": "Not approved",
"message": "This is a default network"
} -%}
{%- elif $.network.name != "default" -%}
{%- set data = {
"title": "Default Network",
"result": "Approved",
"message": "This is not a default network"
} -%}
{%- else -%}
{%- set data = {
"title": "Default Network",
"result": "Skip",
"message": "No data for network yet"
} -%}
{%- endif -%}
{%- set results = results.concat(data) -%}
{%- if $.network.autoCreateSubnetworks == null -%}
{%- set data = {
"title": "Legacy Network",
"result": "Not approved",
"message": "This is a legacy network"
} -%}
{%- elif $.network.autoCreateSubnetworks != null -%}
{%- set data = {
"title": "Legacy Network",
"result": "Approved",
"message": "This is not a legacy network"
} -%}
{%- else -%}
{%- set data = {
"title": "Legacy Network",
"result": "Skip",
"message": "No data for legacy network yet"
} -%}
{% endif -%}
{% set results = results.concat(data) -%}
{{ results | json }}
EOT
}