Policy Packs
Enforce Default VPC Network Is Not Used in GCP Projects

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_network_approved_custom" {
resource = turbot_policy_pack.main.id
type = "tmod:@turbot/gcp-network#/policy/types/networkApprovedCustom"
template_input = <<-EOT
{
network {
name: get(path: "name")
}
}
EOT
template = <<-EOT
{%- if $.network.name != "default" -%}
{%- set data = {
"title": "Default Network",
"result": "Approved",
"message": "Project does not use a default network"
} -%}
{%- elif $.network.name == "default" -%}
{%- set data = {
"title": "Default Network",
"result": "Not approved",
"message": "Project uses a default network"
} -%}
{%- else -%}
{%- set data = {
"title": "Default Network",
"result": "Skip",
"message": "No data for default network yet"
} -%}
{%- endif -%}
{{ data | json }}
EOT
}