Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for network_firewall_policy_association and region_network_firewall_policy_association #6796

Merged
merged 8 commits into from
Nov 11, 2022
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
- type: CUSTOM_RESOURCE_NAME
details:
title: region_network_firewall_policy_association
location: region
- type: EXCLUDE
field: location
location: global
- type: EXCLUDE
field: region
- type: CUSTOM_NAME
details:
name: region
field: location
- type: CUSTOM_ID
details:
id: "projects/{{project}}/regions/{{region}}/firewallPolicies/{{firewall_policy}}/associations/{{name}}"
location: region
- type: CUSTOM_ID
details:
id: "projects/{{project}}/global/firewallPolicies/{{firewall_policy}}/associations/{{name}}"
location: global
- type: IMPORT_FORMAT
details:
formats:
- "projects/{{project}}/regions/{{region}}/firewallPolicies/{{firewall_policy}}/associations/{{name}}"
- "{{project}}/{{region}}/{{firewall_policy}}/{{name}}"
location: region
- type: IMPORT_FORMAT
details:
formats:
- "projects/{{project}}/global/firewallPolicies/{{firewall_policy}}/associations/{{name}}"
- "{{project}}/{{firewall_policy}}/{{name}}"
location: global
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
- type: CUSTOM_RESOURCE_NAME
details:
title: region_network_firewall_policy_association
location: region
- type: EXCLUDE
field: location
location: global
- type: EXCLUDE
field: region
- type: CUSTOM_NAME
details:
name: region
field: location
- type: CUSTOM_ID
details:
id: "projects/{{project}}/regions/{{region}}/firewallPolicies/{{firewall_policy}}/associations/{{name}}"
location: region
- type: CUSTOM_ID
details:
id: "projects/{{project}}/global/firewallPolicies/{{firewall_policy}}/associations/{{name}}"
location: global
- type: IMPORT_FORMAT
details:
formats:
- "projects/{{project}}/regions/{{region}}/firewallPolicies/{{firewall_policy}}/associations/{{name}}"
- "{{project}}/{{region}}/{{firewall_policy}}/{{name}}"
location: region
- type: IMPORT_FORMAT
details:
formats:
- "projects/{{project}}/global/firewallPolicies/{{firewall_policy}}/associations/{{name}}"
- "{{project}}/{{firewall_policy}}/{{name}}"
location: global
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
resource "google_compute_network_firewall_policy" "network_firewall_policy" {
name = "{{policy}}"
project = "{{project}}"
description = "Sample global network firewall policy"
}

resource "google_compute_network" "network" {
name = "{{network}}"
}
ghabian marked this conversation as resolved.
Show resolved Hide resolved

resource "google_compute_network_firewall_policy_association" "primary" {
name = "{{association}}"
attachment_target = google_compute_network.network.id
firewall_policy = google_compute_network_firewall_policy.network_firewall_policy.name
project = "{{project}}"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
updates:
- resource: ./global_update.tf.tmpl
variables:
- name: association
type: resource_name
- name: policy
type: resource_name
- name: network
type: resource_name
- name: project
type: project
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
resource "google_compute_network_firewall_policy" "network_firewall_policy" {
name = "{{policy}}"
project = "{{project}}"
description = "Sample global network firewall policy"
}

resource "google_compute_network" "network" {
name = "{{network}}"
}
ghabian marked this conversation as resolved.
Show resolved Hide resolved

resource "google_compute_network" "network2" {
name = "update-{{network}}"
}
ghabian marked this conversation as resolved.
Show resolved Hide resolved

resource "google_compute_network_firewall_policy_association" "primary" {
name = "{{association}}"
attachment_target = google_compute_network.network2.id
firewall_policy = google_compute_network_firewall_policy.network_firewall_policy.name
project = "{{project}}"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# meta.yaml
# this is a shared config file that all the tests merge with
#
doc_hide:
- global_network_firewall_policy_association.yaml
- basic_regional_network_firewall_policy_association.yaml

doc_hide_conditional:
- location: global
file_name: regional.tf.tmpl
- location: region
file_name: global.tf.tmpl

test_hide:
- global_network_firewall_policy_association.yaml
- basic_regional_network_firewall_policy_association.yaml

test_hide_conditional:
- location: global
file_name: regional.tf.tmpl
- location: region
file_name: global.tf.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
resource "google_compute_region_network_firewall_policy" "basic_regional_network_firewall_policy" {
name = "{{policy}}"
project = "{{project}}"
description = "Sample global network firewall policy"
region = "{{region}}"
}

resource "google_compute_network" "basic_network" {
name = "{{network}}"
}
ghabian marked this conversation as resolved.
Show resolved Hide resolved

resource "google_compute_region_network_firewall_policy_association" "primary" {
name = "{{association}}"
attachment_target = google_compute_network.basic_network.id
firewall_policy = google_compute_region_network_firewall_policy.basic_regional_network_firewall_policy.name
project = "{{project}}"
region = "{{region}}"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
updates:
- resource: ./regional_update.tf.tmpl
variables:
- name: association
type: resource_name
- name: policy
type: resource_name
- name: network
type: resource_name
- name: project
type: project
- name: region
type: region
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
resource "google_compute_region_network_firewall_policy" "basic_regional_network_firewall_policy" {
name = "{{policy}}"
project = "{{project}}"
description = "Sample global network firewall policy"
region = "{{region}}"
}

resource "google_compute_network" "basic_network" {
name = "{{network}}"
}
ghabian marked this conversation as resolved.
Show resolved Hide resolved

resource "google_compute_network" "basic_network2" {
name = "update-{{network}}"
}
ghabian marked this conversation as resolved.
Show resolved Hide resolved

resource "google_compute_region_network_firewall_policy_association" "primary" {
name = "{{association}}"
attachment_target = google_compute_network.basic_network2.id
firewall_policy = google_compute_region_network_firewall_policy.basic_regional_network_firewall_policy.name
project = "{{project}}"
region = "{{region}}"
}