forked from GoogleCloudPlatform/magic-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate Network Firewall Policy Association (global and region) resou…
…rce from DCL to MMv1 (GoogleCloudPlatform#11366) Co-authored-by: Cameron Thornton <[email protected]>
- Loading branch information
Showing
14 changed files
with
241 additions
and
198 deletions.
There are no files selected for viewing
87 changes: 87 additions & 0 deletions
87
mmv1/products/compute/NetworkFirewallPolicyAssociation.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# Copyright 2024 Google Inc. | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
--- | ||
name: 'NetworkFirewallPolicyAssociation' | ||
kind: 'compute#firewallPolicyAssociation' | ||
description: | | ||
The Compute NetworkFirewallPolicyAssociation resource | ||
references: | ||
guides: | ||
api: 'https://cloud.google.com/compute/docs/reference/rest/v1/networkFirewallPolicies/addAssociation' | ||
docs: | ||
id_format: 'projects/{{project}}/global/firewallPolicies/{{firewall_policy}}/associations/{{name}}' | ||
base_url: 'projects/{{project}}/global/firewallPolicies/{{firewall_policy}}' | ||
self_link: 'projects/{{project}}/global/firewallPolicies/{{firewall_policy}}/getAssociation?name={{name}}' | ||
create_url: 'projects/{{project}}/global/firewallPolicies/{{firewall_policy}}/addAssociation' | ||
delete_url: 'projects/{{project}}/global/firewallPolicies/{{firewall_policy}}/removeAssociation?name={{name}}' | ||
delete_verb: 'POST' | ||
immutable: true | ||
legacy_long_form_project: true | ||
import_format: | ||
- 'projects/{{project}}/global/firewallPolicies/{{firewall_policy}}/associations/{{name}}' | ||
- '{{project}}/{{firewall_policy}}/{{name}}' | ||
timeouts: | ||
insert_minutes: 20 | ||
update_minutes: 20 | ||
delete_minutes: 20 | ||
async: | ||
actions: ['create', 'delete', 'update'] | ||
type: 'OpAsync' | ||
operation: | ||
base_url: '{{op_id}}' | ||
kind: 'compute#operation' | ||
path: 'name' | ||
wait_ms: 1000 | ||
result: | ||
path: 'targetLink' | ||
resource_inside_response: false | ||
error: | ||
path: 'error/errors' | ||
message: 'message' | ||
examples: | ||
- name: 'network_firewall_policy_association' | ||
primary_resource_id: 'default' | ||
vars: | ||
policy_name: 'my-policy' | ||
association_name: 'my-association' | ||
network_name: 'my-network' | ||
test_env_vars: | ||
project_name: 'PROJECT_NAME' | ||
parameters: | ||
- name: 'firewallPolicy' | ||
type: ResourceRef | ||
description: | | ||
The firewall policy of the resource. | ||
url_param_only: true | ||
required: true | ||
diff_suppress_func: 'tpgresource.CompareSelfLinkOrResourceName' | ||
resource: 'NetworkFirewallPolicy' | ||
imports: 'name' | ||
properties: | ||
- name: 'name' | ||
type: String | ||
description: | | ||
The name for an association. | ||
required: true | ||
- name: 'attachmentTarget' | ||
type: String | ||
description: | | ||
The target that the firewall policy is attached to. | ||
required: true | ||
diff_suppress_func: 'tpgresource.CompareSelfLinkOrResourceName' | ||
- name: 'shortName' | ||
type: String | ||
description: | | ||
The short name of the firewall policy of the association. | ||
output: true |
93 changes: 93 additions & 0 deletions
93
mmv1/products/compute/RegionNetworkFirewallPolicyAssociation.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# Copyright 2024 Google Inc. | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
--- | ||
name: 'RegionNetworkFirewallPolicyAssociation' | ||
kind: 'compute#firewallPolicyAssociation' | ||
description: | | ||
The Compute NetworkFirewallPolicyAssociation resource | ||
references: | ||
guides: | ||
api: 'https://cloud.google.com/compute/docs/reference/rest/v1/regionNetworkFirewallPolicies/addAssociation' | ||
docs: | ||
id_format: 'projects/{{project}}/regions/{{region}}/firewallPolicies/{{firewall_policy}}/associations/{{name}}' | ||
base_url: 'projects/{{project}}/regions/{{region}}/firewallPolicies/{{firewall_policy}}' | ||
self_link: 'projects/{{project}}/regions/{{region}}/firewallPolicies/{{firewall_policy}}/getAssociation?name={{name}}' | ||
create_url: 'projects/{{project}}/regions/{{region}}/firewallPolicies/{{firewall_policy}}/addAssociation' | ||
delete_url: 'projects/{{project}}/regions/{{region}}/firewallPolicies/{{firewall_policy}}/removeAssociation?name={{name}}' | ||
delete_verb: 'POST' | ||
immutable: true | ||
legacy_long_form_project: true | ||
import_format: | ||
- 'projects/{{project}}/regions/{{region}}/firewallPolicies/{{firewall_policy}}/associations/{{name}}' | ||
- '{{project}}/{{firewall_policy}}/{{name}}' | ||
timeouts: | ||
insert_minutes: 20 | ||
update_minutes: 20 | ||
delete_minutes: 20 | ||
async: | ||
actions: ['create', 'delete', 'update'] | ||
type: 'OpAsync' | ||
operation: | ||
base_url: '{{op_id}}' | ||
kind: 'compute#operation' | ||
path: 'name' | ||
wait_ms: 1000 | ||
result: | ||
path: 'targetLink' | ||
resource_inside_response: false | ||
error: | ||
path: 'error/errors' | ||
message: 'message' | ||
examples: | ||
- name: 'region_network_firewall_policy_association' | ||
primary_resource_id: 'default' | ||
vars: | ||
policy_name: 'my-policy' | ||
association_name: 'my-association' | ||
network_name: 'my-network' | ||
test_env_vars: | ||
region: 'REGION' | ||
project_name: 'PROJECT_NAME' | ||
parameters: | ||
- name: 'firewallPolicy' | ||
type: ResourceRef | ||
description: | | ||
The firewall policy of the resource. | ||
url_param_only: true | ||
required: true | ||
diff_suppress_func: 'tpgresource.CompareSelfLinkOrResourceName' | ||
resource: 'RegionNetworkFirewallPolicy' | ||
imports: 'name' | ||
- name: 'region' | ||
type: String | ||
description: 'The location of this resource.' | ||
url_param_only: true | ||
default_from_api: true | ||
properties: | ||
- name: 'name' | ||
type: String | ||
description: | | ||
The name for an association. | ||
required: true | ||
- name: 'attachmentTarget' | ||
type: String | ||
description: | | ||
The target that the firewall policy is attached to. | ||
required: true | ||
diff_suppress_func: 'tpgresource.CompareSelfLinkOrResourceName' | ||
- name: 'shortName' | ||
type: String | ||
description: | | ||
The short name of the firewall policy of the association. | ||
output: true |
17 changes: 17 additions & 0 deletions
17
mmv1/templates/terraform/examples/network_firewall_policy_association.tf.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
resource "google_compute_network_firewall_policy" "policy" { | ||
name = "{{index $.Vars "policy_name"}}" | ||
project = "{{index $.TestEnvVars "project_name"}}" | ||
description = "Sample global network firewall policy" | ||
} | ||
|
||
resource "google_compute_network" "network" { | ||
name = "{{index $.Vars "network_name"}}" | ||
auto_create_subnetworks = false | ||
} | ||
|
||
resource "google_compute_network_firewall_policy_association" "{{$.PrimaryResourceId}}" { | ||
name = "{{index $.Vars "association_name"}}" | ||
project = "{{index $.TestEnvVars "project_name"}}" | ||
attachment_target = google_compute_network.network.id | ||
firewall_policy = google_compute_network_firewall_policy.policy.id | ||
} |
19 changes: 19 additions & 0 deletions
19
mmv1/templates/terraform/examples/region_network_firewall_policy_association.tf.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
resource "google_compute_region_network_firewall_policy" "policy" { | ||
name = "{{index $.Vars "policy_name"}}" | ||
project = "{{index $.TestEnvVars "project_name"}}" | ||
description = "Sample global network firewall policy" | ||
region = "{{index $.TestEnvVars "region"}}" | ||
} | ||
|
||
resource "google_compute_network" "network" { | ||
name = "{{index $.Vars "network_name"}}" | ||
auto_create_subnetworks = false | ||
} | ||
|
||
resource "google_compute_region_network_firewall_policy_association" "{{$.PrimaryResourceId}}" { | ||
name = "{{index $.Vars "association_name"}}" | ||
project = "{{index $.TestEnvVars "project_name"}}" | ||
attachment_target = google_compute_network.network.id | ||
firewall_policy = google_compute_region_network_firewall_policy.policy.id | ||
region = "{{index $.TestEnvVars "region"}}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 0 additions & 38 deletions
38
tpgtools/overrides/compute/beta/network_firewall_policy_association.yaml
This file was deleted.
Oops, something went wrong.
38 changes: 0 additions & 38 deletions
38
tpgtools/overrides/compute/network_firewall_policy_association.yaml
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
tpgtools/overrides/compute/samples/networkfirewallpolicyassociation/global.tf.tmpl
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
tpgtools/overrides/compute/samples/networkfirewallpolicyassociation/global.yaml
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.