Google Compute Engine Packet Mirroring

This page shows how to write Terraform for Compute Engine Packet Mirroring and write them securely.

google_compute_packet_mirroring (Terraform)

The Packet Mirroring in Compute Engine can be configured in Terraform with the resource name google_compute_packet_mirroring. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L58
resource "google_compute_packet_mirroring" "foobar" {
  name = "my-mirroring"
  description = "bar"
  network {
    url = google_compute_network.default.id
  }
main.tf#L78
resource "google_compute_packet_mirroring" "default" {
  project     = google_compute_instance.mirror.project # Replace this with a reference to your project ID
  region      = "us-central1"
  name        = "my-mirroring"
  description = "My packet mirror"
  network {
main.tf#L78
resource "google_compute_packet_mirroring" "default" {
  project     = google_compute_instance.mirror.project # Replace this with a reference to your project ID
  region      = "us-central1"
  name        = "my-mirroring"
  description = "My packet mirror"
  network {
main.tf#L67
resource "google_compute_packet_mirroring" "default" {
  project     = google_compute_instance.mirror.project # Replace this with a reference to your project ID
  region      = "us-central1"
  name        = "my-mirroring"
  description = "My packet mirror"
  network {
main.tf#L78
resource "google_compute_packet_mirroring" "default" {
  project     = google_compute_instance.mirror.project # Replace this with a reference to your project ID
  region      = "us-central1"
  name        = "my-mirroring"
  description = "My packet mirror"
  network {

Parameters

  • description optional - string
    • A human-readable description of the rule.

  • id optionalcomputed - string
  • name required - string
    • The name of the packet mirroring rule

  • priority optionalcomputed - number
    • Since only one rule can be active at a time, priority is used to break ties in the case of two rules that apply to the same instances.

  • project optionalcomputed - string
  • region optionalcomputed - string
    • The Region in which the created address should reside. If it is not provided, the provider region is used.

Explanation in Terraform Registry

Packet Mirroring mirrors traffic to and from particular VM instances. You can use the collected traffic to help you detect security threats and monitor application performance. To get more information about PacketMirroring, see:

Frequently asked questions

What is Google Compute Engine Packet Mirroring?

Google Compute Engine Packet Mirroring is a resource for Compute Engine of Google Cloud Platform. Settings can be wrote in Terraform.

Where can I find the example code for the Google Compute Engine Packet Mirroring?

For Terraform, the terraform-google-modules/terraform-docs-samples, freight-hub/terraform-modules-demo and rituraj-tiwari/terraform-google-network source code examples are useful. See the Terraform Example section for further details.

security-icon

Scan your IaC problem in 3 minutes for free

You can keep your IaC security for free. No credit card required.