-
Notifications
You must be signed in to change notification settings - Fork 286
feat(networksecurity): Add examples for creating consumer and producer mirroring #798
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
ee1e663
feat(networksecurity): Add examples for creating consumer and produce…
duvni 6df313b
Enable networksecurity API
duvni a349bab
Add codeowners for network security's mirroring samples
duvni eaa4e13
Use default as Terraform resource names where possible
duvni 1436dc5
Rename association resource to default
duvni db2ce55
Fix tab discrepancy in CODEOWNERS file
duvni ca108bb
Merge branch 'main' into bug-389579525
glasnt 35409c5
Merge branch 'terraform-google-modules:main' into bug-389579525
duvni cae77ed
Merge branch 'main' into bug-389579525
glasnt 57969ba
Merge branch 'main' into bug-389579525
iennae 2394376
Merge branch 'terraform-google-modules:main' into bug-389579525
duvni c035837
Merge branch 'main' into bug-389579525
glasnt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -1,25 +1,26 @@ | ||
| # Overall sample owners | ||
|
|
||
| * @terraform-google-modules/terraform-samples-git-admins @terraform-google-modules/terraform-samples-reviewers | ||
| /* @terraform-google-modules/terraform-samples-git-admins @terraform-google-modules/terraform-samples-reviewers @terraform-google-modules/cloud-samples-infra | ||
| /.github/ @terraform-google-modules/terraform-samples-git-admins @terraform-google-modules/cloud-samples-infra | ||
| /test/ @terraform-google-modules/terraform-samples-git-admins @terraform-google-modules/cft-admins @terraform-google-modules/cloud-samples-infra | ||
| /build/ @terraform-google-modules/terraform-samples-git-admins @terraform-google-modules/cft-admins @terraform-google-modules/cloud-samples-infra | ||
| * @terraform-google-modules/terraform-samples-git-admins @terraform-google-modules/terraform-samples-reviewers | ||
| /* @terraform-google-modules/terraform-samples-git-admins @terraform-google-modules/terraform-samples-reviewers @terraform-google-modules/cloud-samples-infra | ||
| /.github/ @terraform-google-modules/terraform-samples-git-admins @terraform-google-modules/cloud-samples-infra | ||
| /test/ @terraform-google-modules/terraform-samples-git-admins @terraform-google-modules/cft-admins @terraform-google-modules/cloud-samples-infra | ||
| /build/ @terraform-google-modules/terraform-samples-git-admins @terraform-google-modules/cft-admins @terraform-google-modules/cloud-samples-infra | ||
|
|
||
| /bigquery/ @terraform-google-modules/bigquery-terraform-swe @terraform-google-modules/terraform-samples-reviewers | ||
| /cloud_sql/ @terraform-google-modules/terraform-samples-reviewers | ||
| /cloudvpn/ @terraform-google-modules/dee-infra @terraform-google-modules/terraform-samples-reviewers | ||
| /composer/ @terraform-google-modules/cloud-dpes-composer @terraform-google-modules/terraform-samples-reviewers | ||
| /compute/ @terraform-google-modules/dee-infra @terraform-google-modules/terraform-samples-reviewers | ||
| /dns/ @terraform-google-modules/dee-infra @terraform-google-modules/terraform-samples-reviewers | ||
| /gke/ @terraform-google-modules/eks-team @terraform-google-modules/terraform-samples-reviewers | ||
| /lb/ @terraform-google-modules/dee-infra @terraform-google-modules/terraform-samples-reviewers | ||
| /looker/ @terraform-google-modules/cloud-looker-docs @terraform-google-modules/terraform-samples-reviewers | ||
| /media_cdn/ @terraform-google-modules/dee-infra @terraform-google-modules/terraform-samples-reviewers | ||
| /network_connectivity/ @terraform-google-modules/dee-infra @terraform-google-modules/terraform-samples-reviewers | ||
| /privateca/ @terraform-google-modules/dee-infra @terraform-google-modules/terraform-samples-reviewers | ||
| /storage/ @terraform-google-modules/cloud-storage-dpe @terraform-google-modules/terraform-samples-reviewers | ||
| /traffic_director/ @terraform-google-modules/dee-infra @terraform-google-modules/terraform-samples-reviewers | ||
| /vpc/ @terraform-google-modules/dee-infra @terraform-google-modules/terraform-samples-reviewers | ||
| /managedkafka/ @terraform-google-modules/managedkafka-dev-team @terraform-google-modules/terraform-samples-reviewers | ||
| /backupdr/ @terraform-google-modules/gcbdr-samples-team @terraform-google-modules/terraform-samples-reviewers | ||
| /bigquery/ @terraform-google-modules/bigquery-terraform-swe @terraform-google-modules/terraform-samples-reviewers | ||
| /cloud_sql/ @terraform-google-modules/terraform-samples-reviewers | ||
| /cloudvpn/ @terraform-google-modules/dee-infra @terraform-google-modules/terraform-samples-reviewers | ||
| /composer/ @terraform-google-modules/cloud-dpes-composer @terraform-google-modules/terraform-samples-reviewers | ||
| /compute/ @terraform-google-modules/dee-infra @terraform-google-modules/terraform-samples-reviewers | ||
| /dns/ @terraform-google-modules/dee-infra @terraform-google-modules/terraform-samples-reviewers | ||
| /gke/ @terraform-google-modules/eks-team @terraform-google-modules/terraform-samples-reviewers | ||
| /lb/ @terraform-google-modules/dee-infra @terraform-google-modules/terraform-samples-reviewers | ||
| /looker/ @terraform-google-modules/cloud-looker-docs @terraform-google-modules/terraform-samples-reviewers | ||
| /media_cdn/ @terraform-google-modules/dee-infra @terraform-google-modules/terraform-samples-reviewers | ||
| /network_connectivity/ @terraform-google-modules/dee-infra @terraform-google-modules/terraform-samples-reviewers | ||
| /network_security/mirroring/ @terraform-google-modules/pm2-team @terraform-google-modules/terraform-samples-reviewers | ||
| /privateca/ @terraform-google-modules/dee-infra @terraform-google-modules/terraform-samples-reviewers | ||
| /storage/ @terraform-google-modules/cloud-storage-dpe @terraform-google-modules/terraform-samples-reviewers | ||
| /traffic_director/ @terraform-google-modules/dee-infra @terraform-google-modules/terraform-samples-reviewers | ||
| /vpc/ @terraform-google-modules/dee-infra @terraform-google-modules/terraform-samples-reviewers | ||
| /managedkafka/ @terraform-google-modules/managedkafka-dev-team @terraform-google-modules/terraform-samples-reviewers | ||
| /backupdr/ @terraform-google-modules/gcbdr-samples-team @terraform-google-modules/terraform-samples-reviewers | ||
This file contains hidden or 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,51 @@ | ||
| /** | ||
| * Copyright 2025 Google LLC | ||
| * | ||
| * 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. | ||
| */ | ||
|
|
||
| # [START networksecurity_mirroring_basic_consumer] | ||
| resource "google_compute_network" "producer_network" { | ||
| provider = google-beta | ||
| name = "producer-network" | ||
| auto_create_subnetworks = false | ||
| } | ||
|
|
||
| resource "google_compute_network" "consumer_network" { | ||
| provider = google-beta | ||
| name = "consumer-network" | ||
| auto_create_subnetworks = false | ||
| } | ||
|
|
||
| resource "google_network_security_mirroring_deployment_group" "deployment_group" { | ||
| provider = google-beta | ||
| mirroring_deployment_group_id = "mirroring-deployment-group" | ||
| location = "global" | ||
| network = google_compute_network.producer_network.id | ||
| } | ||
|
|
||
| resource "google_network_security_mirroring_endpoint_group" "endpoint_group" { | ||
| provider = google-beta | ||
| mirroring_endpoint_group_id = "mirroring-endpoint-group" | ||
| location = "global" | ||
| mirroring_deployment_group = google_network_security_mirroring_deployment_group.deployment_group.id | ||
| } | ||
|
|
||
| resource "google_network_security_mirroring_endpoint_group_association" "endpoint_group_association" { | ||
| provider = google-beta | ||
| mirroring_endpoint_group_association_id = "mirroring-endpoint-group-association" | ||
| location = "global" | ||
| network = google_compute_network.consumer_network.id | ||
| mirroring_endpoint_group = google_network_security_mirroring_endpoint_group.endpoint_group.id | ||
| } | ||
| # [END networksecurity_mirroring_basic_consumer] |
This file contains hidden or 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,77 @@ | ||
| /** | ||
| * Copyright 2025 Google LLC | ||
| * | ||
| * 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. | ||
| */ | ||
|
|
||
| # [START networksecurity_mirroring_basic_producer] | ||
| resource "google_compute_network" "network" { | ||
| provider = google-beta | ||
| name = "producer-network" | ||
| auto_create_subnetworks = false | ||
| } | ||
|
|
||
| resource "google_compute_subnetwork" "subnetwork" { | ||
| provider = google-beta | ||
| name = "producer-subnet" | ||
| region = "us-central1" | ||
| ip_cidr_range = "10.1.0.0/16" | ||
| network = google_compute_network.network.name | ||
| } | ||
|
|
||
| resource "google_compute_region_health_check" "health_check" { | ||
| provider = google-beta | ||
| name = "deploymnet-hc" | ||
| region = "us-central1" | ||
| http_health_check { | ||
| port = 80 | ||
| } | ||
| } | ||
|
|
||
| resource "google_compute_region_backend_service" "backend_service" { | ||
| provider = google-beta | ||
| name = "deployment-svc" | ||
| region = "us-central1" | ||
| health_checks = [google_compute_region_health_check.health_check.id] | ||
| protocol = "UDP" | ||
| load_balancing_scheme = "INTERNAL" | ||
| } | ||
|
|
||
| resource "google_compute_forwarding_rule" "forwarding_rule" { | ||
| provider = google-beta | ||
| name = "deployment-fr" | ||
| region = "us-central1" | ||
| network = google_compute_network.network.name | ||
| subnetwork = google_compute_subnetwork.subnetwork.name | ||
| backend_service = google_compute_region_backend_service.backend_service.id | ||
| load_balancing_scheme = "INTERNAL" | ||
| ports = [6081] | ||
| ip_protocol = "UDP" | ||
| is_mirroring_collector = true | ||
| } | ||
|
|
||
| resource "google_network_security_mirroring_deployment_group" "deployment_group" { | ||
| provider = google-beta | ||
| mirroring_deployment_group_id = "mirroring-deployment-group" | ||
| location = "global" | ||
| network = google_compute_network.network.id | ||
| } | ||
|
|
||
| resource "google_network_security_mirroring_deployment" "deployment" { | ||
| provider = google-beta | ||
| mirroring_deployment_id = "mirroring-deployment" | ||
| location = "us-central1-a" | ||
| forwarding_rule = google_compute_forwarding_rule.forwarding_rule.id | ||
| mirroring_deployment_group = google_network_security_mirroring_deployment_group.deployment_group.id | ||
| } | ||
| # [END networksecurity_mirroring_basic_producer] |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.