From 77e5c92f5261410fc65db9dabbbb9fefbcb19641 Mon Sep 17 00:00:00 2001 From: Daniel Dubnikov Date: Tue, 9 Sep 2025 11:52:09 +0300 Subject: [PATCH 1/3] Support the new `Broker` type of mirroring endpoint group. --- .../MirroringEndpointGroup.yaml | 35 ++++++++++++++++++- ...roring_endpoint_group_broker_basic.tf.tmpl | 24 +++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 mmv1/templates/terraform/examples/network_security_mirroring_endpoint_group_broker_basic.tf.tmpl diff --git a/mmv1/products/networksecurity/MirroringEndpointGroup.yaml b/mmv1/products/networksecurity/MirroringEndpointGroup.yaml index 00a6cba3e30b..288086672839 100644 --- a/mmv1/products/networksecurity/MirroringEndpointGroup.yaml +++ b/mmv1/products/networksecurity/MirroringEndpointGroup.yaml @@ -52,6 +52,14 @@ examples: network_name: 'example-network' deployment_group_id: 'example-dg' endpoint_group_id: 'example-eg' + - name: 'network_security_mirroring_endpoint_group_broker_basic' + config_path: 'templates/terraform/examples/network_security_mirroring_endpoint_group_broker_basic.tf.tmpl' + primary_resource_id: 'default' + min_version: 'beta' + vars: + network_name: 'example-network' + deployment_group_id: 'example-dg' + endpoint_group_id: 'example-eg' parameters: - name: 'location' type: String @@ -99,8 +107,22 @@ properties: The deployment group that this DIRECT endpoint group is connected to, for example: `projects/123456789/locations/global/mirroringDeploymentGroups/my-dg`. See https://google.aip.dev/124. - required: true immutable: true + conflicts: + - 'mirroringDeploymentGroups' + - name: 'mirroringDeploymentGroups' + type: Array + description: |- + A list of the deployment groups that this BROKER endpoint group is + connected to, for example: + `projects/123456789/locations/global/mirroringDeploymentGroups/my-dg`. + See https://google.aip.dev/124. + min_version: 'beta' + immutable: true + item_type: + type: String + conflicts: + - 'mirroringDeploymentGroup' - name: 'state' type: String description: |- @@ -123,6 +145,17 @@ properties: operation (e.g. adding a new association to the group). See https://google.aip.dev/128. output: true + - name: 'type' + type: String + description: |- + The type of the endpoint group. + If left unspecified, defaults to DIRECT. + Possible values: + DIRECT + BROKER + min_version: 'beta' + default_value: 'DIRECT' + immutable: true - name: description type: String description: |- diff --git a/mmv1/templates/terraform/examples/network_security_mirroring_endpoint_group_broker_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_security_mirroring_endpoint_group_broker_basic.tf.tmpl new file mode 100644 index 000000000000..7c27fbde11b6 --- /dev/null +++ b/mmv1/templates/terraform/examples/network_security_mirroring_endpoint_group_broker_basic.tf.tmpl @@ -0,0 +1,24 @@ +resource "google_compute_network" "network" { + provider = google-beta + name = "{{index $.Vars "network_name"}}" + auto_create_subnetworks = false +} + +resource "google_network_security_mirroring_deployment_group" "deployment_group" { + provider = google-beta + mirroring_deployment_group_id = "{{index $.Vars "deployment_group_id"}}" + location = "global" + network = google_compute_network.network.id +} + +resource "google_network_security_mirroring_endpoint_group" "{{$.PrimaryResourceId}}" { + provider = google-beta + mirroring_endpoint_group_id = "{{index $.Vars "endpoint_group_id"}}" + location = "global" + type = "BROKER" + mirroring_deployment_groups = [google_network_security_mirroring_deployment_group.deployment_group.id] + description = "some description" + labels = { + foo = "bar" + } +} From e77dc9a6797e4db1273d03c0a7012627271ab1d6 Mon Sep 17 00:00:00 2001 From: Daniel Dubnikov Date: Thu, 25 Sep 2025 10:44:41 +0300 Subject: [PATCH 2/3] Fix the format of the conflicts field names. --- mmv1/products/networksecurity/MirroringEndpointGroup.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mmv1/products/networksecurity/MirroringEndpointGroup.yaml b/mmv1/products/networksecurity/MirroringEndpointGroup.yaml index 288086672839..52d6881bd417 100644 --- a/mmv1/products/networksecurity/MirroringEndpointGroup.yaml +++ b/mmv1/products/networksecurity/MirroringEndpointGroup.yaml @@ -109,7 +109,7 @@ properties: See https://google.aip.dev/124. immutable: true conflicts: - - 'mirroringDeploymentGroups' + - 'mirroring_deployment_groups' - name: 'mirroringDeploymentGroups' type: Array description: |- @@ -122,7 +122,7 @@ properties: item_type: type: String conflicts: - - 'mirroringDeploymentGroup' + - 'mirroring_deployment_group' - name: 'state' type: String description: |- From db5873e80bed48441bfab0a1c8fc93a8a4d101cc Mon Sep 17 00:00:00 2001 From: Daniel Dubnikov Date: Thu, 25 Sep 2025 11:04:14 +0300 Subject: [PATCH 3/3] Replace conflicts with exactly_one_of for mirroring deployment group/s fields. --- .../networksecurity/MirroringEndpointGroup.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mmv1/products/networksecurity/MirroringEndpointGroup.yaml b/mmv1/products/networksecurity/MirroringEndpointGroup.yaml index 52d6881bd417..d1605ae98441 100644 --- a/mmv1/products/networksecurity/MirroringEndpointGroup.yaml +++ b/mmv1/products/networksecurity/MirroringEndpointGroup.yaml @@ -108,8 +108,9 @@ properties: `projects/123456789/locations/global/mirroringDeploymentGroups/my-dg`. See https://google.aip.dev/124. immutable: true - conflicts: - - 'mirroring_deployment_groups' + exactly_one_of: + - mirroring_deployment_group + - mirroring_deployment_groups - name: 'mirroringDeploymentGroups' type: Array description: |- @@ -121,8 +122,9 @@ properties: immutable: true item_type: type: String - conflicts: - - 'mirroring_deployment_group' + exactly_one_of: + - mirroring_deployment_group + - mirroring_deployment_groups - name: 'state' type: String description: |-