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 Mirroring resources to Network Security. #20489

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/12420.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-resource
`google_network_security_mirroring_deployment`, `google_network_security_mirroring_deployment_group`, `google_network_security_mirroring_endpoint_group_association`, `google_network_security_mirroring_endpoint_group`
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package networksecurity_test
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package networksecurity_test
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package networksecurity_test
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package networksecurity_test
221 changes: 221 additions & 0 deletions website/docs/r/network_security_mirroring_deployment.html.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
---
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in
# .github/CONTRIBUTING.md.
#
# ----------------------------------------------------------------------------
subcategory: "Network security"
description: |-
MirroringDeployment represents the collectors within a Zone and is associated with a deployment group.
---

# google_network_security_mirroring_deployment

MirroringDeployment represents the collectors within a Zone and is associated with a deployment group.

~> **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider.
See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources.

To get more information about MirroringDeployment, see:

* [API documentation](https://cloud.google.com/network-security-integration/docs/reference/rest/v1beta1/projects.locations.mirroringDeployments)
* How-to Guides
* [Mirroring deployment overview](https://cloud.google.com/network-security-integration/docs/out-of-band/deployments-overview)

<div class = "oics-button" style="float: right; margin: 0 0 -15px">
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md&cloudshell_working_dir=network_security_mirroring_deployment_basic&open_in_editor=main.tf" target="_blank">
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
</a>
</div>
## Example Usage - Network Security Mirroring Deployment Basic


```hcl
resource "google_compute_network" "network" {
provider = google-beta
name = "example-network"
auto_create_subnetworks = false
}

resource "google_compute_subnetwork" "subnetwork" {
provider = google-beta
name = "example-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 = "example-hc"
region = "us-central1"
http_health_check {
port = 80
}
}

resource "google_compute_region_backend_service" "backend_service" {
provider = google-beta
name = "example-bs"
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 = "example-fwr"
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 = "example-dg"
location = "global"
network = google_compute_network.network.id
}

resource "google_network_security_mirroring_deployment" "default" {
provider = google-beta
mirroring_deployment_id = "example-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
labels = {
foo = "bar"
}
}
```

## Argument Reference

The following arguments are supported:


* `forwarding_rule` -
(Required)
Required. Immutable. The regional load balancer which the mirrored traffic should be forwarded
to. Format is:
projects/{project}/regions/{region}/forwardingRules/{forwardingRule}

* `mirroring_deployment_group` -
(Required)
Required. Immutable. The Mirroring Deployment Group that this resource is part of. Format is:
`projects/{project}/locations/global/mirroringDeploymentGroups/{mirroringDeploymentGroup}`

* `location` -
(Required)
Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. See documentation for resource type `networksecurity.googleapis.com/MirroringDeployment`.

* `mirroring_deployment_id` -
(Required)
Required. Id of the requesting object
If auto-generating Id server-side, remove this field and
mirroring_deployment_id from the method_signature of Create RPC


- - -


* `labels` -
(Optional)
Optional. Labels as key value pairs
**Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
Please refer to the field `effective_labels` for all of the labels present on the resource.

* `project` - (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.


## Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

* `id` - an identifier for the resource with format `projects/{{project}}/locations/{{location}}/mirroringDeployments/{{mirroring_deployment_id}}`

* `name` -
Immutable. Identifier. The name of the MirroringDeployment.

* `create_time` -
Output only. [Output only] Create time stamp

* `update_time` -
Output only. [Output only] Update time stamp

* `state` -
Output only. Current state of the deployment.
Possible values:
STATE_UNSPECIFIED
ACTIVE
CREATING
DELETING
OUT_OF_SYNC
DELETE_FAILED

* `reconciling` -
Output only. Whether reconciling is in progress, recommended per
https://google.aip.dev/128.

* `terraform_labels` -
The combination of labels configured directly on the resource
and default labels configured on the provider.

* `effective_labels` -
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services.


## Timeouts

This resource provides the following
[Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options:

- `create` - Default is 20 minutes.
- `update` - Default is 20 minutes.
- `delete` - Default is 20 minutes.

## Import


MirroringDeployment can be imported using any of these accepted formats:

* `projects/{{project}}/locations/{{location}}/mirroringDeployments/{{mirroring_deployment_id}}`
* `{{project}}/{{location}}/{{mirroring_deployment_id}}`
* `{{location}}/{{mirroring_deployment_id}}`


In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import MirroringDeployment using one of the formats above. For example:

```tf
import {
id = "projects/{{project}}/locations/{{location}}/mirroringDeployments/{{mirroring_deployment_id}}"
to = google_network_security_mirroring_deployment.default
}
```

When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), MirroringDeployment can be imported using one of the formats above. For example:

```
$ terraform import google_network_security_mirroring_deployment.default projects/{{project}}/locations/{{location}}/mirroringDeployments/{{mirroring_deployment_id}}
$ terraform import google_network_security_mirroring_deployment.default {{project}}/{{location}}/{{mirroring_deployment_id}}
$ terraform import google_network_security_mirroring_deployment.default {{location}}/{{mirroring_deployment_id}}
```

## User Project Overrides

This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override).
Loading