1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. compute
  5. PacketMirroring
Google Cloud Classic v7.19.0 published on Thursday, Apr 18, 2024 by Pulumi

gcp.compute.PacketMirroring

Explore with Pulumi AI

gcp logo
Google Cloud Classic v7.19.0 published on Thursday, Apr 18, 2024 by Pulumi

    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:

    Example Usage

    Compute Packet Mirroring Full

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const _default = new gcp.compute.Network("default", {name: "my-network"});
    const mirror = new gcp.compute.Instance("mirror", {
        networkInterfaces: [{
            accessConfigs: [{}],
            network: _default.id,
        }],
        name: "my-instance",
        machineType: "e2-medium",
        bootDisk: {
            initializeParams: {
                image: "debian-cloud/debian-11",
            },
        },
    });
    const defaultSubnetwork = new gcp.compute.Subnetwork("default", {
        name: "my-subnetwork",
        network: _default.id,
        ipCidrRange: "10.2.0.0/16",
    });
    const defaultHealthCheck = new gcp.compute.HealthCheck("default", {
        name: "my-healthcheck",
        checkIntervalSec: 1,
        timeoutSec: 1,
        tcpHealthCheck: {
            port: 80,
        },
    });
    const defaultRegionBackendService = new gcp.compute.RegionBackendService("default", {
        name: "my-service",
        healthChecks: defaultHealthCheck.id,
    });
    const defaultForwardingRule = new gcp.compute.ForwardingRule("default", {
        name: "my-ilb",
        isMirroringCollector: true,
        ipProtocol: "TCP",
        loadBalancingScheme: "INTERNAL",
        backendService: defaultRegionBackendService.id,
        allPorts: true,
        network: _default.id,
        subnetwork: defaultSubnetwork.id,
        networkTier: "PREMIUM",
    });
    const foobar = new gcp.compute.PacketMirroring("foobar", {
        name: "my-mirroring",
        description: "bar",
        network: {
            url: _default.id,
        },
        collectorIlb: {
            url: defaultForwardingRule.id,
        },
        mirroredResources: {
            tags: ["foo"],
            instances: [{
                url: mirror.id,
            }],
        },
        filter: {
            ipProtocols: ["tcp"],
            cidrRanges: ["0.0.0.0/0"],
            direction: "BOTH",
        },
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    default = gcp.compute.Network("default", name="my-network")
    mirror = gcp.compute.Instance("mirror",
        network_interfaces=[gcp.compute.InstanceNetworkInterfaceArgs(
            access_configs=[gcp.compute.InstanceNetworkInterfaceAccessConfigArgs()],
            network=default.id,
        )],
        name="my-instance",
        machine_type="e2-medium",
        boot_disk=gcp.compute.InstanceBootDiskArgs(
            initialize_params=gcp.compute.InstanceBootDiskInitializeParamsArgs(
                image="debian-cloud/debian-11",
            ),
        ))
    default_subnetwork = gcp.compute.Subnetwork("default",
        name="my-subnetwork",
        network=default.id,
        ip_cidr_range="10.2.0.0/16")
    default_health_check = gcp.compute.HealthCheck("default",
        name="my-healthcheck",
        check_interval_sec=1,
        timeout_sec=1,
        tcp_health_check=gcp.compute.HealthCheckTcpHealthCheckArgs(
            port=80,
        ))
    default_region_backend_service = gcp.compute.RegionBackendService("default",
        name="my-service",
        health_checks=default_health_check.id)
    default_forwarding_rule = gcp.compute.ForwardingRule("default",
        name="my-ilb",
        is_mirroring_collector=True,
        ip_protocol="TCP",
        load_balancing_scheme="INTERNAL",
        backend_service=default_region_backend_service.id,
        all_ports=True,
        network=default.id,
        subnetwork=default_subnetwork.id,
        network_tier="PREMIUM")
    foobar = gcp.compute.PacketMirroring("foobar",
        name="my-mirroring",
        description="bar",
        network=gcp.compute.PacketMirroringNetworkArgs(
            url=default.id,
        ),
        collector_ilb=gcp.compute.PacketMirroringCollectorIlbArgs(
            url=default_forwarding_rule.id,
        ),
        mirrored_resources=gcp.compute.PacketMirroringMirroredResourcesArgs(
            tags=["foo"],
            instances=[gcp.compute.PacketMirroringMirroredResourcesInstanceArgs(
                url=mirror.id,
            )],
        ),
        filter=gcp.compute.PacketMirroringFilterArgs(
            ip_protocols=["tcp"],
            cidr_ranges=["0.0.0.0/0"],
            direction="BOTH",
        ))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := compute.NewNetwork(ctx, "default", &compute.NetworkArgs{
    			Name: pulumi.String("my-network"),
    		})
    		if err != nil {
    			return err
    		}
    		mirror, err := compute.NewInstance(ctx, "mirror", &compute.InstanceArgs{
    			NetworkInterfaces: compute.InstanceNetworkInterfaceArray{
    				&compute.InstanceNetworkInterfaceArgs{
    					AccessConfigs: compute.InstanceNetworkInterfaceAccessConfigArray{
    						nil,
    					},
    					Network: _default.ID(),
    				},
    			},
    			Name:        pulumi.String("my-instance"),
    			MachineType: pulumi.String("e2-medium"),
    			BootDisk: &compute.InstanceBootDiskArgs{
    				InitializeParams: &compute.InstanceBootDiskInitializeParamsArgs{
    					Image: pulumi.String("debian-cloud/debian-11"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		defaultSubnetwork, err := compute.NewSubnetwork(ctx, "default", &compute.SubnetworkArgs{
    			Name:        pulumi.String("my-subnetwork"),
    			Network:     _default.ID(),
    			IpCidrRange: pulumi.String("10.2.0.0/16"),
    		})
    		if err != nil {
    			return err
    		}
    		defaultHealthCheck, err := compute.NewHealthCheck(ctx, "default", &compute.HealthCheckArgs{
    			Name:             pulumi.String("my-healthcheck"),
    			CheckIntervalSec: pulumi.Int(1),
    			TimeoutSec:       pulumi.Int(1),
    			TcpHealthCheck: &compute.HealthCheckTcpHealthCheckArgs{
    				Port: pulumi.Int(80),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		defaultRegionBackendService, err := compute.NewRegionBackendService(ctx, "default", &compute.RegionBackendServiceArgs{
    			Name:         pulumi.String("my-service"),
    			HealthChecks: defaultHealthCheck.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		defaultForwardingRule, err := compute.NewForwardingRule(ctx, "default", &compute.ForwardingRuleArgs{
    			Name:                 pulumi.String("my-ilb"),
    			IsMirroringCollector: pulumi.Bool(true),
    			IpProtocol:           pulumi.String("TCP"),
    			LoadBalancingScheme:  pulumi.String("INTERNAL"),
    			BackendService:       defaultRegionBackendService.ID(),
    			AllPorts:             pulumi.Bool(true),
    			Network:              _default.ID(),
    			Subnetwork:           defaultSubnetwork.ID(),
    			NetworkTier:          pulumi.String("PREMIUM"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = compute.NewPacketMirroring(ctx, "foobar", &compute.PacketMirroringArgs{
    			Name:        pulumi.String("my-mirroring"),
    			Description: pulumi.String("bar"),
    			Network: &compute.PacketMirroringNetworkArgs{
    				Url: _default.ID(),
    			},
    			CollectorIlb: &compute.PacketMirroringCollectorIlbArgs{
    				Url: defaultForwardingRule.ID(),
    			},
    			MirroredResources: &compute.PacketMirroringMirroredResourcesArgs{
    				Tags: pulumi.StringArray{
    					pulumi.String("foo"),
    				},
    				Instances: compute.PacketMirroringMirroredResourcesInstanceArray{
    					&compute.PacketMirroringMirroredResourcesInstanceArgs{
    						Url: mirror.ID(),
    					},
    				},
    			},
    			Filter: &compute.PacketMirroringFilterArgs{
    				IpProtocols: pulumi.StringArray{
    					pulumi.String("tcp"),
    				},
    				CidrRanges: pulumi.StringArray{
    					pulumi.String("0.0.0.0/0"),
    				},
    				Direction: pulumi.String("BOTH"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var @default = new Gcp.Compute.Network("default", new()
        {
            Name = "my-network",
        });
    
        var mirror = new Gcp.Compute.Instance("mirror", new()
        {
            NetworkInterfaces = new[]
            {
                new Gcp.Compute.Inputs.InstanceNetworkInterfaceArgs
                {
                    AccessConfigs = new[]
                    {
                        null,
                    },
                    Network = @default.Id,
                },
            },
            Name = "my-instance",
            MachineType = "e2-medium",
            BootDisk = new Gcp.Compute.Inputs.InstanceBootDiskArgs
            {
                InitializeParams = new Gcp.Compute.Inputs.InstanceBootDiskInitializeParamsArgs
                {
                    Image = "debian-cloud/debian-11",
                },
            },
        });
    
        var defaultSubnetwork = new Gcp.Compute.Subnetwork("default", new()
        {
            Name = "my-subnetwork",
            Network = @default.Id,
            IpCidrRange = "10.2.0.0/16",
        });
    
        var defaultHealthCheck = new Gcp.Compute.HealthCheck("default", new()
        {
            Name = "my-healthcheck",
            CheckIntervalSec = 1,
            TimeoutSec = 1,
            TcpHealthCheck = new Gcp.Compute.Inputs.HealthCheckTcpHealthCheckArgs
            {
                Port = 80,
            },
        });
    
        var defaultRegionBackendService = new Gcp.Compute.RegionBackendService("default", new()
        {
            Name = "my-service",
            HealthChecks = defaultHealthCheck.Id,
        });
    
        var defaultForwardingRule = new Gcp.Compute.ForwardingRule("default", new()
        {
            Name = "my-ilb",
            IsMirroringCollector = true,
            IpProtocol = "TCP",
            LoadBalancingScheme = "INTERNAL",
            BackendService = defaultRegionBackendService.Id,
            AllPorts = true,
            Network = @default.Id,
            Subnetwork = defaultSubnetwork.Id,
            NetworkTier = "PREMIUM",
        });
    
        var foobar = new Gcp.Compute.PacketMirroring("foobar", new()
        {
            Name = "my-mirroring",
            Description = "bar",
            Network = new Gcp.Compute.Inputs.PacketMirroringNetworkArgs
            {
                Url = @default.Id,
            },
            CollectorIlb = new Gcp.Compute.Inputs.PacketMirroringCollectorIlbArgs
            {
                Url = defaultForwardingRule.Id,
            },
            MirroredResources = new Gcp.Compute.Inputs.PacketMirroringMirroredResourcesArgs
            {
                Tags = new[]
                {
                    "foo",
                },
                Instances = new[]
                {
                    new Gcp.Compute.Inputs.PacketMirroringMirroredResourcesInstanceArgs
                    {
                        Url = mirror.Id,
                    },
                },
            },
            Filter = new Gcp.Compute.Inputs.PacketMirroringFilterArgs
            {
                IpProtocols = new[]
                {
                    "tcp",
                },
                CidrRanges = new[]
                {
                    "0.0.0.0/0",
                },
                Direction = "BOTH",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.compute.Network;
    import com.pulumi.gcp.compute.NetworkArgs;
    import com.pulumi.gcp.compute.Instance;
    import com.pulumi.gcp.compute.InstanceArgs;
    import com.pulumi.gcp.compute.inputs.InstanceNetworkInterfaceArgs;
    import com.pulumi.gcp.compute.inputs.InstanceBootDiskArgs;
    import com.pulumi.gcp.compute.inputs.InstanceBootDiskInitializeParamsArgs;
    import com.pulumi.gcp.compute.Subnetwork;
    import com.pulumi.gcp.compute.SubnetworkArgs;
    import com.pulumi.gcp.compute.HealthCheck;
    import com.pulumi.gcp.compute.HealthCheckArgs;
    import com.pulumi.gcp.compute.inputs.HealthCheckTcpHealthCheckArgs;
    import com.pulumi.gcp.compute.RegionBackendService;
    import com.pulumi.gcp.compute.RegionBackendServiceArgs;
    import com.pulumi.gcp.compute.ForwardingRule;
    import com.pulumi.gcp.compute.ForwardingRuleArgs;
    import com.pulumi.gcp.compute.PacketMirroring;
    import com.pulumi.gcp.compute.PacketMirroringArgs;
    import com.pulumi.gcp.compute.inputs.PacketMirroringNetworkArgs;
    import com.pulumi.gcp.compute.inputs.PacketMirroringCollectorIlbArgs;
    import com.pulumi.gcp.compute.inputs.PacketMirroringMirroredResourcesArgs;
    import com.pulumi.gcp.compute.inputs.PacketMirroringFilterArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var default_ = new Network("default", NetworkArgs.builder()        
                .name("my-network")
                .build());
    
            var mirror = new Instance("mirror", InstanceArgs.builder()        
                .networkInterfaces(InstanceNetworkInterfaceArgs.builder()
                    .accessConfigs()
                    .network(default_.id())
                    .build())
                .name("my-instance")
                .machineType("e2-medium")
                .bootDisk(InstanceBootDiskArgs.builder()
                    .initializeParams(InstanceBootDiskInitializeParamsArgs.builder()
                        .image("debian-cloud/debian-11")
                        .build())
                    .build())
                .build());
    
            var defaultSubnetwork = new Subnetwork("defaultSubnetwork", SubnetworkArgs.builder()        
                .name("my-subnetwork")
                .network(default_.id())
                .ipCidrRange("10.2.0.0/16")
                .build());
    
            var defaultHealthCheck = new HealthCheck("defaultHealthCheck", HealthCheckArgs.builder()        
                .name("my-healthcheck")
                .checkIntervalSec(1)
                .timeoutSec(1)
                .tcpHealthCheck(HealthCheckTcpHealthCheckArgs.builder()
                    .port("80")
                    .build())
                .build());
    
            var defaultRegionBackendService = new RegionBackendService("defaultRegionBackendService", RegionBackendServiceArgs.builder()        
                .name("my-service")
                .healthChecks(defaultHealthCheck.id())
                .build());
    
            var defaultForwardingRule = new ForwardingRule("defaultForwardingRule", ForwardingRuleArgs.builder()        
                .name("my-ilb")
                .isMirroringCollector(true)
                .ipProtocol("TCP")
                .loadBalancingScheme("INTERNAL")
                .backendService(defaultRegionBackendService.id())
                .allPorts(true)
                .network(default_.id())
                .subnetwork(defaultSubnetwork.id())
                .networkTier("PREMIUM")
                .build());
    
            var foobar = new PacketMirroring("foobar", PacketMirroringArgs.builder()        
                .name("my-mirroring")
                .description("bar")
                .network(PacketMirroringNetworkArgs.builder()
                    .url(default_.id())
                    .build())
                .collectorIlb(PacketMirroringCollectorIlbArgs.builder()
                    .url(defaultForwardingRule.id())
                    .build())
                .mirroredResources(PacketMirroringMirroredResourcesArgs.builder()
                    .tags("foo")
                    .instances(PacketMirroringMirroredResourcesInstanceArgs.builder()
                        .url(mirror.id())
                        .build())
                    .build())
                .filter(PacketMirroringFilterArgs.builder()
                    .ipProtocols("tcp")
                    .cidrRanges("0.0.0.0/0")
                    .direction("BOTH")
                    .build())
                .build());
    
        }
    }
    
    resources:
      mirror:
        type: gcp:compute:Instance
        properties:
          networkInterfaces:
            - accessConfigs:
                - {}
              network: ${default.id}
          name: my-instance
          machineType: e2-medium
          bootDisk:
            initializeParams:
              image: debian-cloud/debian-11
      default:
        type: gcp:compute:Network
        properties:
          name: my-network
      defaultSubnetwork:
        type: gcp:compute:Subnetwork
        name: default
        properties:
          name: my-subnetwork
          network: ${default.id}
          ipCidrRange: 10.2.0.0/16
      defaultRegionBackendService:
        type: gcp:compute:RegionBackendService
        name: default
        properties:
          name: my-service
          healthChecks: ${defaultHealthCheck.id}
      defaultHealthCheck:
        type: gcp:compute:HealthCheck
        name: default
        properties:
          name: my-healthcheck
          checkIntervalSec: 1
          timeoutSec: 1
          tcpHealthCheck:
            port: '80'
      defaultForwardingRule:
        type: gcp:compute:ForwardingRule
        name: default
        properties:
          name: my-ilb
          isMirroringCollector: true
          ipProtocol: TCP
          loadBalancingScheme: INTERNAL
          backendService: ${defaultRegionBackendService.id}
          allPorts: true
          network: ${default.id}
          subnetwork: ${defaultSubnetwork.id}
          networkTier: PREMIUM
      foobar:
        type: gcp:compute:PacketMirroring
        properties:
          name: my-mirroring
          description: bar
          network:
            url: ${default.id}
          collectorIlb:
            url: ${defaultForwardingRule.id}
          mirroredResources:
            tags:
              - foo
            instances:
              - url: ${mirror.id}
          filter:
            ipProtocols:
              - tcp
            cidrRanges:
              - 0.0.0.0/0
            direction: BOTH
    

    Create PacketMirroring Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new PacketMirroring(name: string, args: PacketMirroringArgs, opts?: CustomResourceOptions);
    @overload
    def PacketMirroring(resource_name: str,
                        args: PacketMirroringArgs,
                        opts: Optional[ResourceOptions] = None)
    
    @overload
    def PacketMirroring(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        collector_ilb: Optional[PacketMirroringCollectorIlbArgs] = None,
                        mirrored_resources: Optional[PacketMirroringMirroredResourcesArgs] = None,
                        network: Optional[PacketMirroringNetworkArgs] = None,
                        description: Optional[str] = None,
                        filter: Optional[PacketMirroringFilterArgs] = None,
                        name: Optional[str] = None,
                        priority: Optional[int] = None,
                        project: Optional[str] = None,
                        region: Optional[str] = None)
    func NewPacketMirroring(ctx *Context, name string, args PacketMirroringArgs, opts ...ResourceOption) (*PacketMirroring, error)
    public PacketMirroring(string name, PacketMirroringArgs args, CustomResourceOptions? opts = null)
    public PacketMirroring(String name, PacketMirroringArgs args)
    public PacketMirroring(String name, PacketMirroringArgs args, CustomResourceOptions options)
    
    type: gcp:compute:PacketMirroring
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args PacketMirroringArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args PacketMirroringArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args PacketMirroringArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args PacketMirroringArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args PacketMirroringArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var packetMirroringResource = new Gcp.Compute.PacketMirroring("packetMirroringResource", new()
    {
        CollectorIlb = new Gcp.Compute.Inputs.PacketMirroringCollectorIlbArgs
        {
            Url = "string",
        },
        MirroredResources = new Gcp.Compute.Inputs.PacketMirroringMirroredResourcesArgs
        {
            Instances = new[]
            {
                new Gcp.Compute.Inputs.PacketMirroringMirroredResourcesInstanceArgs
                {
                    Url = "string",
                },
            },
            Subnetworks = new[]
            {
                new Gcp.Compute.Inputs.PacketMirroringMirroredResourcesSubnetworkArgs
                {
                    Url = "string",
                },
            },
            Tags = new[]
            {
                "string",
            },
        },
        Network = new Gcp.Compute.Inputs.PacketMirroringNetworkArgs
        {
            Url = "string",
        },
        Description = "string",
        Filter = new Gcp.Compute.Inputs.PacketMirroringFilterArgs
        {
            CidrRanges = new[]
            {
                "string",
            },
            Direction = "string",
            IpProtocols = new[]
            {
                "string",
            },
        },
        Name = "string",
        Priority = 0,
        Project = "string",
        Region = "string",
    });
    
    example, err := compute.NewPacketMirroring(ctx, "packetMirroringResource", &compute.PacketMirroringArgs{
    	CollectorIlb: &compute.PacketMirroringCollectorIlbArgs{
    		Url: pulumi.String("string"),
    	},
    	MirroredResources: &compute.PacketMirroringMirroredResourcesArgs{
    		Instances: compute.PacketMirroringMirroredResourcesInstanceArray{
    			&compute.PacketMirroringMirroredResourcesInstanceArgs{
    				Url: pulumi.String("string"),
    			},
    		},
    		Subnetworks: compute.PacketMirroringMirroredResourcesSubnetworkArray{
    			&compute.PacketMirroringMirroredResourcesSubnetworkArgs{
    				Url: pulumi.String("string"),
    			},
    		},
    		Tags: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    	},
    	Network: &compute.PacketMirroringNetworkArgs{
    		Url: pulumi.String("string"),
    	},
    	Description: pulumi.String("string"),
    	Filter: &compute.PacketMirroringFilterArgs{
    		CidrRanges: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    		Direction: pulumi.String("string"),
    		IpProtocols: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    	},
    	Name:     pulumi.String("string"),
    	Priority: pulumi.Int(0),
    	Project:  pulumi.String("string"),
    	Region:   pulumi.String("string"),
    })
    
    var packetMirroringResource = new PacketMirroring("packetMirroringResource", PacketMirroringArgs.builder()        
        .collectorIlb(PacketMirroringCollectorIlbArgs.builder()
            .url("string")
            .build())
        .mirroredResources(PacketMirroringMirroredResourcesArgs.builder()
            .instances(PacketMirroringMirroredResourcesInstanceArgs.builder()
                .url("string")
                .build())
            .subnetworks(PacketMirroringMirroredResourcesSubnetworkArgs.builder()
                .url("string")
                .build())
            .tags("string")
            .build())
        .network(PacketMirroringNetworkArgs.builder()
            .url("string")
            .build())
        .description("string")
        .filter(PacketMirroringFilterArgs.builder()
            .cidrRanges("string")
            .direction("string")
            .ipProtocols("string")
            .build())
        .name("string")
        .priority(0)
        .project("string")
        .region("string")
        .build());
    
    packet_mirroring_resource = gcp.compute.PacketMirroring("packetMirroringResource",
        collector_ilb=gcp.compute.PacketMirroringCollectorIlbArgs(
            url="string",
        ),
        mirrored_resources=gcp.compute.PacketMirroringMirroredResourcesArgs(
            instances=[gcp.compute.PacketMirroringMirroredResourcesInstanceArgs(
                url="string",
            )],
            subnetworks=[gcp.compute.PacketMirroringMirroredResourcesSubnetworkArgs(
                url="string",
            )],
            tags=["string"],
        ),
        network=gcp.compute.PacketMirroringNetworkArgs(
            url="string",
        ),
        description="string",
        filter=gcp.compute.PacketMirroringFilterArgs(
            cidr_ranges=["string"],
            direction="string",
            ip_protocols=["string"],
        ),
        name="string",
        priority=0,
        project="string",
        region="string")
    
    const packetMirroringResource = new gcp.compute.PacketMirroring("packetMirroringResource", {
        collectorIlb: {
            url: "string",
        },
        mirroredResources: {
            instances: [{
                url: "string",
            }],
            subnetworks: [{
                url: "string",
            }],
            tags: ["string"],
        },
        network: {
            url: "string",
        },
        description: "string",
        filter: {
            cidrRanges: ["string"],
            direction: "string",
            ipProtocols: ["string"],
        },
        name: "string",
        priority: 0,
        project: "string",
        region: "string",
    });
    
    type: gcp:compute:PacketMirroring
    properties:
        collectorIlb:
            url: string
        description: string
        filter:
            cidrRanges:
                - string
            direction: string
            ipProtocols:
                - string
        mirroredResources:
            instances:
                - url: string
            subnetworks:
                - url: string
            tags:
                - string
        name: string
        network:
            url: string
        priority: 0
        project: string
        region: string
    

    PacketMirroring Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The PacketMirroring resource accepts the following input properties:

    CollectorIlb PacketMirroringCollectorIlb
    The Forwarding Rule resource (of type load_balancing_scheme=INTERNAL) that will be used as collector for mirrored traffic. The specified forwarding rule must have is_mirroring_collector set to true. Structure is documented below.
    MirroredResources PacketMirroringMirroredResources
    A means of specifying which resources to mirror. Structure is documented below.
    Network PacketMirroringNetwork
    Specifies the mirrored VPC network. Only packets in this network will be mirrored. All mirrored VMs should have a NIC in the given network. All mirrored subnetworks should belong to the given network. Structure is documented below.
    Description string
    A human-readable description of the rule.
    Filter PacketMirroringFilter
    A filter for mirrored traffic. If unset, all traffic is mirrored. Structure is documented below.
    Name string
    The name of the packet mirroring rule
    Priority int
    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 string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Region string
    The Region in which the created address should reside. If it is not provided, the provider region is used.
    CollectorIlb PacketMirroringCollectorIlbArgs
    The Forwarding Rule resource (of type load_balancing_scheme=INTERNAL) that will be used as collector for mirrored traffic. The specified forwarding rule must have is_mirroring_collector set to true. Structure is documented below.
    MirroredResources PacketMirroringMirroredResourcesArgs
    A means of specifying which resources to mirror. Structure is documented below.
    Network PacketMirroringNetworkArgs
    Specifies the mirrored VPC network. Only packets in this network will be mirrored. All mirrored VMs should have a NIC in the given network. All mirrored subnetworks should belong to the given network. Structure is documented below.
    Description string
    A human-readable description of the rule.
    Filter PacketMirroringFilterArgs
    A filter for mirrored traffic. If unset, all traffic is mirrored. Structure is documented below.
    Name string
    The name of the packet mirroring rule
    Priority int
    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 string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Region string
    The Region in which the created address should reside. If it is not provided, the provider region is used.
    collectorIlb PacketMirroringCollectorIlb
    The Forwarding Rule resource (of type load_balancing_scheme=INTERNAL) that will be used as collector for mirrored traffic. The specified forwarding rule must have is_mirroring_collector set to true. Structure is documented below.
    mirroredResources PacketMirroringMirroredResources
    A means of specifying which resources to mirror. Structure is documented below.
    network PacketMirroringNetwork
    Specifies the mirrored VPC network. Only packets in this network will be mirrored. All mirrored VMs should have a NIC in the given network. All mirrored subnetworks should belong to the given network. Structure is documented below.
    description String
    A human-readable description of the rule.
    filter PacketMirroringFilter
    A filter for mirrored traffic. If unset, all traffic is mirrored. Structure is documented below.
    name String
    The name of the packet mirroring rule
    priority Integer
    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 String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    region String
    The Region in which the created address should reside. If it is not provided, the provider region is used.
    collectorIlb PacketMirroringCollectorIlb
    The Forwarding Rule resource (of type load_balancing_scheme=INTERNAL) that will be used as collector for mirrored traffic. The specified forwarding rule must have is_mirroring_collector set to true. Structure is documented below.
    mirroredResources PacketMirroringMirroredResources
    A means of specifying which resources to mirror. Structure is documented below.
    network PacketMirroringNetwork
    Specifies the mirrored VPC network. Only packets in this network will be mirrored. All mirrored VMs should have a NIC in the given network. All mirrored subnetworks should belong to the given network. Structure is documented below.
    description string
    A human-readable description of the rule.
    filter PacketMirroringFilter
    A filter for mirrored traffic. If unset, all traffic is mirrored. Structure is documented below.
    name string
    The name of the packet mirroring rule
    priority 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 string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    region string
    The Region in which the created address should reside. If it is not provided, the provider region is used.
    collector_ilb PacketMirroringCollectorIlbArgs
    The Forwarding Rule resource (of type load_balancing_scheme=INTERNAL) that will be used as collector for mirrored traffic. The specified forwarding rule must have is_mirroring_collector set to true. Structure is documented below.
    mirrored_resources PacketMirroringMirroredResourcesArgs
    A means of specifying which resources to mirror. Structure is documented below.
    network PacketMirroringNetworkArgs
    Specifies the mirrored VPC network. Only packets in this network will be mirrored. All mirrored VMs should have a NIC in the given network. All mirrored subnetworks should belong to the given network. Structure is documented below.
    description str
    A human-readable description of the rule.
    filter PacketMirroringFilterArgs
    A filter for mirrored traffic. If unset, all traffic is mirrored. Structure is documented below.
    name str
    The name of the packet mirroring rule
    priority int
    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 str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    region str
    The Region in which the created address should reside. If it is not provided, the provider region is used.
    collectorIlb Property Map
    The Forwarding Rule resource (of type load_balancing_scheme=INTERNAL) that will be used as collector for mirrored traffic. The specified forwarding rule must have is_mirroring_collector set to true. Structure is documented below.
    mirroredResources Property Map
    A means of specifying which resources to mirror. Structure is documented below.
    network Property Map
    Specifies the mirrored VPC network. Only packets in this network will be mirrored. All mirrored VMs should have a NIC in the given network. All mirrored subnetworks should belong to the given network. Structure is documented below.
    description String
    A human-readable description of the rule.
    filter Property Map
    A filter for mirrored traffic. If unset, all traffic is mirrored. Structure is documented below.
    name String
    The name of the packet mirroring rule
    priority 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 String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    region String
    The Region in which the created address should reside. If it is not provided, the provider region is used.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the PacketMirroring resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing PacketMirroring Resource

    Get an existing PacketMirroring resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: PacketMirroringState, opts?: CustomResourceOptions): PacketMirroring
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            collector_ilb: Optional[PacketMirroringCollectorIlbArgs] = None,
            description: Optional[str] = None,
            filter: Optional[PacketMirroringFilterArgs] = None,
            mirrored_resources: Optional[PacketMirroringMirroredResourcesArgs] = None,
            name: Optional[str] = None,
            network: Optional[PacketMirroringNetworkArgs] = None,
            priority: Optional[int] = None,
            project: Optional[str] = None,
            region: Optional[str] = None) -> PacketMirroring
    func GetPacketMirroring(ctx *Context, name string, id IDInput, state *PacketMirroringState, opts ...ResourceOption) (*PacketMirroring, error)
    public static PacketMirroring Get(string name, Input<string> id, PacketMirroringState? state, CustomResourceOptions? opts = null)
    public static PacketMirroring get(String name, Output<String> id, PacketMirroringState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    CollectorIlb PacketMirroringCollectorIlb
    The Forwarding Rule resource (of type load_balancing_scheme=INTERNAL) that will be used as collector for mirrored traffic. The specified forwarding rule must have is_mirroring_collector set to true. Structure is documented below.
    Description string
    A human-readable description of the rule.
    Filter PacketMirroringFilter
    A filter for mirrored traffic. If unset, all traffic is mirrored. Structure is documented below.
    MirroredResources PacketMirroringMirroredResources
    A means of specifying which resources to mirror. Structure is documented below.
    Name string
    The name of the packet mirroring rule
    Network PacketMirroringNetwork
    Specifies the mirrored VPC network. Only packets in this network will be mirrored. All mirrored VMs should have a NIC in the given network. All mirrored subnetworks should belong to the given network. Structure is documented below.
    Priority int
    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 string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Region string
    The Region in which the created address should reside. If it is not provided, the provider region is used.
    CollectorIlb PacketMirroringCollectorIlbArgs
    The Forwarding Rule resource (of type load_balancing_scheme=INTERNAL) that will be used as collector for mirrored traffic. The specified forwarding rule must have is_mirroring_collector set to true. Structure is documented below.
    Description string
    A human-readable description of the rule.
    Filter PacketMirroringFilterArgs
    A filter for mirrored traffic. If unset, all traffic is mirrored. Structure is documented below.
    MirroredResources PacketMirroringMirroredResourcesArgs
    A means of specifying which resources to mirror. Structure is documented below.
    Name string
    The name of the packet mirroring rule
    Network PacketMirroringNetworkArgs
    Specifies the mirrored VPC network. Only packets in this network will be mirrored. All mirrored VMs should have a NIC in the given network. All mirrored subnetworks should belong to the given network. Structure is documented below.
    Priority int
    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 string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Region string
    The Region in which the created address should reside. If it is not provided, the provider region is used.
    collectorIlb PacketMirroringCollectorIlb
    The Forwarding Rule resource (of type load_balancing_scheme=INTERNAL) that will be used as collector for mirrored traffic. The specified forwarding rule must have is_mirroring_collector set to true. Structure is documented below.
    description String
    A human-readable description of the rule.
    filter PacketMirroringFilter
    A filter for mirrored traffic. If unset, all traffic is mirrored. Structure is documented below.
    mirroredResources PacketMirroringMirroredResources
    A means of specifying which resources to mirror. Structure is documented below.
    name String
    The name of the packet mirroring rule
    network PacketMirroringNetwork
    Specifies the mirrored VPC network. Only packets in this network will be mirrored. All mirrored VMs should have a NIC in the given network. All mirrored subnetworks should belong to the given network. Structure is documented below.
    priority Integer
    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 String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    region String
    The Region in which the created address should reside. If it is not provided, the provider region is used.
    collectorIlb PacketMirroringCollectorIlb
    The Forwarding Rule resource (of type load_balancing_scheme=INTERNAL) that will be used as collector for mirrored traffic. The specified forwarding rule must have is_mirroring_collector set to true. Structure is documented below.
    description string
    A human-readable description of the rule.
    filter PacketMirroringFilter
    A filter for mirrored traffic. If unset, all traffic is mirrored. Structure is documented below.
    mirroredResources PacketMirroringMirroredResources
    A means of specifying which resources to mirror. Structure is documented below.
    name string
    The name of the packet mirroring rule
    network PacketMirroringNetwork
    Specifies the mirrored VPC network. Only packets in this network will be mirrored. All mirrored VMs should have a NIC in the given network. All mirrored subnetworks should belong to the given network. Structure is documented below.
    priority 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 string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    region string
    The Region in which the created address should reside. If it is not provided, the provider region is used.
    collector_ilb PacketMirroringCollectorIlbArgs
    The Forwarding Rule resource (of type load_balancing_scheme=INTERNAL) that will be used as collector for mirrored traffic. The specified forwarding rule must have is_mirroring_collector set to true. Structure is documented below.
    description str
    A human-readable description of the rule.
    filter PacketMirroringFilterArgs
    A filter for mirrored traffic. If unset, all traffic is mirrored. Structure is documented below.
    mirrored_resources PacketMirroringMirroredResourcesArgs
    A means of specifying which resources to mirror. Structure is documented below.
    name str
    The name of the packet mirroring rule
    network PacketMirroringNetworkArgs
    Specifies the mirrored VPC network. Only packets in this network will be mirrored. All mirrored VMs should have a NIC in the given network. All mirrored subnetworks should belong to the given network. Structure is documented below.
    priority int
    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 str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    region str
    The Region in which the created address should reside. If it is not provided, the provider region is used.
    collectorIlb Property Map
    The Forwarding Rule resource (of type load_balancing_scheme=INTERNAL) that will be used as collector for mirrored traffic. The specified forwarding rule must have is_mirroring_collector set to true. Structure is documented below.
    description String
    A human-readable description of the rule.
    filter Property Map
    A filter for mirrored traffic. If unset, all traffic is mirrored. Structure is documented below.
    mirroredResources Property Map
    A means of specifying which resources to mirror. Structure is documented below.
    name String
    The name of the packet mirroring rule
    network Property Map
    Specifies the mirrored VPC network. Only packets in this network will be mirrored. All mirrored VMs should have a NIC in the given network. All mirrored subnetworks should belong to the given network. Structure is documented below.
    priority 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 String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    region String
    The Region in which the created address should reside. If it is not provided, the provider region is used.

    Supporting Types

    PacketMirroringCollectorIlb, PacketMirroringCollectorIlbArgs

    Url string
    The URL of the forwarding rule.
    Url string
    The URL of the forwarding rule.
    url String
    The URL of the forwarding rule.
    url string
    The URL of the forwarding rule.
    url str
    The URL of the forwarding rule.
    url String
    The URL of the forwarding rule.

    PacketMirroringFilter, PacketMirroringFilterArgs

    CidrRanges List<string>
    IP CIDR ranges that apply as a filter on the source (ingress) or destination (egress) IP in the IP header. Only IPv4 is supported.
    Direction string
    Direction of traffic to mirror. Default value is BOTH. Possible values are: INGRESS, EGRESS, BOTH.
    IpProtocols List<string>
    Possible IP protocols including tcp, udp, icmp and esp
    CidrRanges []string
    IP CIDR ranges that apply as a filter on the source (ingress) or destination (egress) IP in the IP header. Only IPv4 is supported.
    Direction string
    Direction of traffic to mirror. Default value is BOTH. Possible values are: INGRESS, EGRESS, BOTH.
    IpProtocols []string
    Possible IP protocols including tcp, udp, icmp and esp
    cidrRanges List<String>
    IP CIDR ranges that apply as a filter on the source (ingress) or destination (egress) IP in the IP header. Only IPv4 is supported.
    direction String
    Direction of traffic to mirror. Default value is BOTH. Possible values are: INGRESS, EGRESS, BOTH.
    ipProtocols List<String>
    Possible IP protocols including tcp, udp, icmp and esp
    cidrRanges string[]
    IP CIDR ranges that apply as a filter on the source (ingress) or destination (egress) IP in the IP header. Only IPv4 is supported.
    direction string
    Direction of traffic to mirror. Default value is BOTH. Possible values are: INGRESS, EGRESS, BOTH.
    ipProtocols string[]
    Possible IP protocols including tcp, udp, icmp and esp
    cidr_ranges Sequence[str]
    IP CIDR ranges that apply as a filter on the source (ingress) or destination (egress) IP in the IP header. Only IPv4 is supported.
    direction str
    Direction of traffic to mirror. Default value is BOTH. Possible values are: INGRESS, EGRESS, BOTH.
    ip_protocols Sequence[str]
    Possible IP protocols including tcp, udp, icmp and esp
    cidrRanges List<String>
    IP CIDR ranges that apply as a filter on the source (ingress) or destination (egress) IP in the IP header. Only IPv4 is supported.
    direction String
    Direction of traffic to mirror. Default value is BOTH. Possible values are: INGRESS, EGRESS, BOTH.
    ipProtocols List<String>
    Possible IP protocols including tcp, udp, icmp and esp

    PacketMirroringMirroredResources, PacketMirroringMirroredResourcesArgs

    Instances List<PacketMirroringMirroredResourcesInstance>
    All the listed instances will be mirrored. Specify at most 50. Structure is documented below.
    Subnetworks List<PacketMirroringMirroredResourcesSubnetwork>
    All instances in one of these subnetworks will be mirrored. Structure is documented below.
    Tags List<string>
    All instances with these tags will be mirrored.
    Instances []PacketMirroringMirroredResourcesInstance
    All the listed instances will be mirrored. Specify at most 50. Structure is documented below.
    Subnetworks []PacketMirroringMirroredResourcesSubnetwork
    All instances in one of these subnetworks will be mirrored. Structure is documented below.
    Tags []string
    All instances with these tags will be mirrored.
    instances List<PacketMirroringMirroredResourcesInstance>
    All the listed instances will be mirrored. Specify at most 50. Structure is documented below.
    subnetworks List<PacketMirroringMirroredResourcesSubnetwork>
    All instances in one of these subnetworks will be mirrored. Structure is documented below.
    tags List<String>
    All instances with these tags will be mirrored.
    instances PacketMirroringMirroredResourcesInstance[]
    All the listed instances will be mirrored. Specify at most 50. Structure is documented below.
    subnetworks PacketMirroringMirroredResourcesSubnetwork[]
    All instances in one of these subnetworks will be mirrored. Structure is documented below.
    tags string[]
    All instances with these tags will be mirrored.
    instances Sequence[PacketMirroringMirroredResourcesInstance]
    All the listed instances will be mirrored. Specify at most 50. Structure is documented below.
    subnetworks Sequence[PacketMirroringMirroredResourcesSubnetwork]
    All instances in one of these subnetworks will be mirrored. Structure is documented below.
    tags Sequence[str]
    All instances with these tags will be mirrored.
    instances List<Property Map>
    All the listed instances will be mirrored. Specify at most 50. Structure is documented below.
    subnetworks List<Property Map>
    All instances in one of these subnetworks will be mirrored. Structure is documented below.
    tags List<String>
    All instances with these tags will be mirrored.

    PacketMirroringMirroredResourcesInstance, PacketMirroringMirroredResourcesInstanceArgs

    Url string
    The URL of the instances where this rule should be active.


    Url string
    The URL of the instances where this rule should be active.


    url String
    The URL of the instances where this rule should be active.


    url string
    The URL of the instances where this rule should be active.


    url str
    The URL of the instances where this rule should be active.


    url String
    The URL of the instances where this rule should be active.


    PacketMirroringMirroredResourcesSubnetwork, PacketMirroringMirroredResourcesSubnetworkArgs

    Url string
    The URL of the subnetwork where this rule should be active.
    Url string
    The URL of the subnetwork where this rule should be active.
    url String
    The URL of the subnetwork where this rule should be active.
    url string
    The URL of the subnetwork where this rule should be active.
    url str
    The URL of the subnetwork where this rule should be active.
    url String
    The URL of the subnetwork where this rule should be active.

    PacketMirroringNetwork, PacketMirroringNetworkArgs

    Url string
    The full self_link URL of the network where this rule is active.
    Url string
    The full self_link URL of the network where this rule is active.
    url String
    The full self_link URL of the network where this rule is active.
    url string
    The full self_link URL of the network where this rule is active.
    url str
    The full self_link URL of the network where this rule is active.
    url String
    The full self_link URL of the network where this rule is active.

    Import

    PacketMirroring can be imported using any of these accepted formats:

    • projects/{{project}}/regions/{{region}}/packetMirrorings/{{name}}

    • {{project}}/{{region}}/{{name}}

    • {{region}}/{{name}}

    • {{name}}

    When using the pulumi import command, PacketMirroring can be imported using one of the formats above. For example:

    $ pulumi import gcp:compute/packetMirroring:PacketMirroring default projects/{{project}}/regions/{{region}}/packetMirrorings/{{name}}
    
    $ pulumi import gcp:compute/packetMirroring:PacketMirroring default {{project}}/{{region}}/{{name}}
    
    $ pulumi import gcp:compute/packetMirroring:PacketMirroring default {{region}}/{{name}}
    
    $ pulumi import gcp:compute/packetMirroring:PacketMirroring default {{name}}
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v7.19.0 published on Thursday, Apr 18, 2024 by Pulumi