1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. networkmanagement
  5. VpcFlowLogsConfig
Google Cloud v8.25.0 published on Thursday, Apr 3, 2025 by Pulumi

gcp.networkmanagement.VpcFlowLogsConfig

Explore with Pulumi AI

VPC Flow Logs Config is a resource that lets you configure Flow Logs for VPC, Interconnect attachments or VPN Tunnels.

Example Usage

Network Management Vpc Flow Logs Config Interconnect Full

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const project = gcp.organizations.getProject({});
const network = new gcp.compute.Network("network", {name: "full-interconnect-test-network"});
const router = new gcp.compute.Router("router", {
    name: "full-interconnect-test-router",
    network: network.name,
    bgp: {
        asn: 16550,
    },
});
const attachment = new gcp.compute.InterconnectAttachment("attachment", {
    name: "full-interconnect-test-id",
    edgeAvailabilityDomain: "AVAILABILITY_DOMAIN_1",
    type: "PARTNER",
    router: router.id,
    mtu: "1500",
});
const interconnect_test = new gcp.networkmanagement.VpcFlowLogsConfig("interconnect-test", {
    vpcFlowLogsConfigId: "full-interconnect-test-id",
    location: "global",
    interconnectAttachment: pulumi.all([project, attachment.name]).apply(([project, name]) => `projects/${project.number}/regions/us-east4/interconnectAttachments/${name}`),
    state: "ENABLED",
    aggregationInterval: "INTERVAL_5_SEC",
    description: "VPC Flow Logs over a VPN Gateway.",
    flowSampling: 0.5,
    metadata: "INCLUDE_ALL_METADATA",
});
Copy
import pulumi
import pulumi_gcp as gcp

project = gcp.organizations.get_project()
network = gcp.compute.Network("network", name="full-interconnect-test-network")
router = gcp.compute.Router("router",
    name="full-interconnect-test-router",
    network=network.name,
    bgp={
        "asn": 16550,
    })
attachment = gcp.compute.InterconnectAttachment("attachment",
    name="full-interconnect-test-id",
    edge_availability_domain="AVAILABILITY_DOMAIN_1",
    type="PARTNER",
    router=router.id,
    mtu="1500")
interconnect_test = gcp.networkmanagement.VpcFlowLogsConfig("interconnect-test",
    vpc_flow_logs_config_id="full-interconnect-test-id",
    location="global",
    interconnect_attachment=attachment.name.apply(lambda name: f"projects/{project.number}/regions/us-east4/interconnectAttachments/{name}"),
    state="ENABLED",
    aggregation_interval="INTERVAL_5_SEC",
    description="VPC Flow Logs over a VPN Gateway.",
    flow_sampling=0.5,
    metadata="INCLUDE_ALL_METADATA")
Copy
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/compute"
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/networkmanagement"
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/organizations"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		project, err := organizations.LookupProject(ctx, &organizations.LookupProjectArgs{}, nil)
		if err != nil {
			return err
		}
		network, err := compute.NewNetwork(ctx, "network", &compute.NetworkArgs{
			Name: pulumi.String("full-interconnect-test-network"),
		})
		if err != nil {
			return err
		}
		router, err := compute.NewRouter(ctx, "router", &compute.RouterArgs{
			Name:    pulumi.String("full-interconnect-test-router"),
			Network: network.Name,
			Bgp: &compute.RouterBgpArgs{
				Asn: pulumi.Int(16550),
			},
		})
		if err != nil {
			return err
		}
		attachment, err := compute.NewInterconnectAttachment(ctx, "attachment", &compute.InterconnectAttachmentArgs{
			Name:                   pulumi.String("full-interconnect-test-id"),
			EdgeAvailabilityDomain: pulumi.String("AVAILABILITY_DOMAIN_1"),
			Type:                   pulumi.String("PARTNER"),
			Router:                 router.ID(),
			Mtu:                    pulumi.String("1500"),
		})
		if err != nil {
			return err
		}
		_, err = networkmanagement.NewVpcFlowLogsConfig(ctx, "interconnect-test", &networkmanagement.VpcFlowLogsConfigArgs{
			VpcFlowLogsConfigId: pulumi.String("full-interconnect-test-id"),
			Location:            pulumi.String("global"),
			InterconnectAttachment: attachment.Name.ApplyT(func(name string) (string, error) {
				return fmt.Sprintf("projects/%v/regions/us-east4/interconnectAttachments/%v", project.Number, name), nil
			}).(pulumi.StringOutput),
			State:               pulumi.String("ENABLED"),
			AggregationInterval: pulumi.String("INTERVAL_5_SEC"),
			Description:         pulumi.String("VPC Flow Logs over a VPN Gateway."),
			FlowSampling:        pulumi.Float64(0.5),
			Metadata:            pulumi.String("INCLUDE_ALL_METADATA"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var project = Gcp.Organizations.GetProject.Invoke();

    var network = new Gcp.Compute.Network("network", new()
    {
        Name = "full-interconnect-test-network",
    });

    var router = new Gcp.Compute.Router("router", new()
    {
        Name = "full-interconnect-test-router",
        Network = network.Name,
        Bgp = new Gcp.Compute.Inputs.RouterBgpArgs
        {
            Asn = 16550,
        },
    });

    var attachment = new Gcp.Compute.InterconnectAttachment("attachment", new()
    {
        Name = "full-interconnect-test-id",
        EdgeAvailabilityDomain = "AVAILABILITY_DOMAIN_1",
        Type = "PARTNER",
        Router = router.Id,
        Mtu = "1500",
    });

    var interconnect_test = new Gcp.NetworkManagement.VpcFlowLogsConfig("interconnect-test", new()
    {
        VpcFlowLogsConfigId = "full-interconnect-test-id",
        Location = "global",
        InterconnectAttachment = Output.Tuple(project, attachment.Name).Apply(values =>
        {
            var project = values.Item1;
            var name = values.Item2;
            return $"projects/{project.Apply(getProjectResult => getProjectResult.Number)}/regions/us-east4/interconnectAttachments/{name}";
        }),
        State = "ENABLED",
        AggregationInterval = "INTERVAL_5_SEC",
        Description = "VPC Flow Logs over a VPN Gateway.",
        FlowSampling = 0.5,
        Metadata = "INCLUDE_ALL_METADATA",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
import com.pulumi.gcp.compute.Network;
import com.pulumi.gcp.compute.NetworkArgs;
import com.pulumi.gcp.compute.Router;
import com.pulumi.gcp.compute.RouterArgs;
import com.pulumi.gcp.compute.inputs.RouterBgpArgs;
import com.pulumi.gcp.compute.InterconnectAttachment;
import com.pulumi.gcp.compute.InterconnectAttachmentArgs;
import com.pulumi.gcp.networkmanagement.VpcFlowLogsConfig;
import com.pulumi.gcp.networkmanagement.VpcFlowLogsConfigArgs;
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) {
        final var project = OrganizationsFunctions.getProject();

        var network = new Network("network", NetworkArgs.builder()
            .name("full-interconnect-test-network")
            .build());

        var router = new Router("router", RouterArgs.builder()
            .name("full-interconnect-test-router")
            .network(network.name())
            .bgp(RouterBgpArgs.builder()
                .asn(16550)
                .build())
            .build());

        var attachment = new InterconnectAttachment("attachment", InterconnectAttachmentArgs.builder()
            .name("full-interconnect-test-id")
            .edgeAvailabilityDomain("AVAILABILITY_DOMAIN_1")
            .type("PARTNER")
            .router(router.id())
            .mtu(1500)
            .build());

        var interconnect_test = new VpcFlowLogsConfig("interconnect-test", VpcFlowLogsConfigArgs.builder()
            .vpcFlowLogsConfigId("full-interconnect-test-id")
            .location("global")
            .interconnectAttachment(attachment.name().applyValue(name -> String.format("projects/%s/regions/us-east4/interconnectAttachments/%s", project.applyValue(getProjectResult -> getProjectResult.number()),name)))
            .state("ENABLED")
            .aggregationInterval("INTERVAL_5_SEC")
            .description("VPC Flow Logs over a VPN Gateway.")
            .flowSampling(0.5)
            .metadata("INCLUDE_ALL_METADATA")
            .build());

    }
}
Copy
resources:
  interconnect-test:
    type: gcp:networkmanagement:VpcFlowLogsConfig
    properties:
      vpcFlowLogsConfigId: full-interconnect-test-id
      location: global
      interconnectAttachment: projects/${project.number}/regions/us-east4/interconnectAttachments/${attachment.name}
      state: ENABLED
      aggregationInterval: INTERVAL_5_SEC
      description: VPC Flow Logs over a VPN Gateway.
      flowSampling: 0.5
      metadata: INCLUDE_ALL_METADATA
  network:
    type: gcp:compute:Network
    properties:
      name: full-interconnect-test-network
  router:
    type: gcp:compute:Router
    properties:
      name: full-interconnect-test-router
      network: ${network.name}
      bgp:
        asn: 16550
  attachment:
    type: gcp:compute:InterconnectAttachment
    properties:
      name: full-interconnect-test-id
      edgeAvailabilityDomain: AVAILABILITY_DOMAIN_1
      type: PARTNER
      router: ${router.id}
      mtu: 1500
variables:
  project:
    fn::invoke:
      function: gcp:organizations:getProject
      arguments: {}
Copy

Network Management Vpc Flow Logs Config Interconnect Basic

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const project = gcp.organizations.getProject({});
const network = new gcp.compute.Network("network", {name: "basic-interconnect-test-network"});
const router = new gcp.compute.Router("router", {
    name: "basic-interconnect-test-router",
    network: network.name,
    bgp: {
        asn: 16550,
    },
});
const attachment = new gcp.compute.InterconnectAttachment("attachment", {
    name: "basic-interconnect-test-id",
    edgeAvailabilityDomain: "AVAILABILITY_DOMAIN_1",
    type: "PARTNER",
    router: router.id,
    mtu: "1500",
});
const interconnect_test = new gcp.networkmanagement.VpcFlowLogsConfig("interconnect-test", {
    vpcFlowLogsConfigId: "basic-interconnect-test-id",
    location: "global",
    interconnectAttachment: pulumi.all([project, attachment.name]).apply(([project, name]) => `projects/${project.number}/regions/us-east4/interconnectAttachments/${name}`),
});
Copy
import pulumi
import pulumi_gcp as gcp

project = gcp.organizations.get_project()
network = gcp.compute.Network("network", name="basic-interconnect-test-network")
router = gcp.compute.Router("router",
    name="basic-interconnect-test-router",
    network=network.name,
    bgp={
        "asn": 16550,
    })
attachment = gcp.compute.InterconnectAttachment("attachment",
    name="basic-interconnect-test-id",
    edge_availability_domain="AVAILABILITY_DOMAIN_1",
    type="PARTNER",
    router=router.id,
    mtu="1500")
interconnect_test = gcp.networkmanagement.VpcFlowLogsConfig("interconnect-test",
    vpc_flow_logs_config_id="basic-interconnect-test-id",
    location="global",
    interconnect_attachment=attachment.name.apply(lambda name: f"projects/{project.number}/regions/us-east4/interconnectAttachments/{name}"))
Copy
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/compute"
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/networkmanagement"
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/organizations"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		project, err := organizations.LookupProject(ctx, &organizations.LookupProjectArgs{}, nil)
		if err != nil {
			return err
		}
		network, err := compute.NewNetwork(ctx, "network", &compute.NetworkArgs{
			Name: pulumi.String("basic-interconnect-test-network"),
		})
		if err != nil {
			return err
		}
		router, err := compute.NewRouter(ctx, "router", &compute.RouterArgs{
			Name:    pulumi.String("basic-interconnect-test-router"),
			Network: network.Name,
			Bgp: &compute.RouterBgpArgs{
				Asn: pulumi.Int(16550),
			},
		})
		if err != nil {
			return err
		}
		attachment, err := compute.NewInterconnectAttachment(ctx, "attachment", &compute.InterconnectAttachmentArgs{
			Name:                   pulumi.String("basic-interconnect-test-id"),
			EdgeAvailabilityDomain: pulumi.String("AVAILABILITY_DOMAIN_1"),
			Type:                   pulumi.String("PARTNER"),
			Router:                 router.ID(),
			Mtu:                    pulumi.String("1500"),
		})
		if err != nil {
			return err
		}
		_, err = networkmanagement.NewVpcFlowLogsConfig(ctx, "interconnect-test", &networkmanagement.VpcFlowLogsConfigArgs{
			VpcFlowLogsConfigId: pulumi.String("basic-interconnect-test-id"),
			Location:            pulumi.String("global"),
			InterconnectAttachment: attachment.Name.ApplyT(func(name string) (string, error) {
				return fmt.Sprintf("projects/%v/regions/us-east4/interconnectAttachments/%v", project.Number, name), nil
			}).(pulumi.StringOutput),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var project = Gcp.Organizations.GetProject.Invoke();

    var network = new Gcp.Compute.Network("network", new()
    {
        Name = "basic-interconnect-test-network",
    });

    var router = new Gcp.Compute.Router("router", new()
    {
        Name = "basic-interconnect-test-router",
        Network = network.Name,
        Bgp = new Gcp.Compute.Inputs.RouterBgpArgs
        {
            Asn = 16550,
        },
    });

    var attachment = new Gcp.Compute.InterconnectAttachment("attachment", new()
    {
        Name = "basic-interconnect-test-id",
        EdgeAvailabilityDomain = "AVAILABILITY_DOMAIN_1",
        Type = "PARTNER",
        Router = router.Id,
        Mtu = "1500",
    });

    var interconnect_test = new Gcp.NetworkManagement.VpcFlowLogsConfig("interconnect-test", new()
    {
        VpcFlowLogsConfigId = "basic-interconnect-test-id",
        Location = "global",
        InterconnectAttachment = Output.Tuple(project, attachment.Name).Apply(values =>
        {
            var project = values.Item1;
            var name = values.Item2;
            return $"projects/{project.Apply(getProjectResult => getProjectResult.Number)}/regions/us-east4/interconnectAttachments/{name}";
        }),
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
import com.pulumi.gcp.compute.Network;
import com.pulumi.gcp.compute.NetworkArgs;
import com.pulumi.gcp.compute.Router;
import com.pulumi.gcp.compute.RouterArgs;
import com.pulumi.gcp.compute.inputs.RouterBgpArgs;
import com.pulumi.gcp.compute.InterconnectAttachment;
import com.pulumi.gcp.compute.InterconnectAttachmentArgs;
import com.pulumi.gcp.networkmanagement.VpcFlowLogsConfig;
import com.pulumi.gcp.networkmanagement.VpcFlowLogsConfigArgs;
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) {
        final var project = OrganizationsFunctions.getProject();

        var network = new Network("network", NetworkArgs.builder()
            .name("basic-interconnect-test-network")
            .build());

        var router = new Router("router", RouterArgs.builder()
            .name("basic-interconnect-test-router")
            .network(network.name())
            .bgp(RouterBgpArgs.builder()
                .asn(16550)
                .build())
            .build());

        var attachment = new InterconnectAttachment("attachment", InterconnectAttachmentArgs.builder()
            .name("basic-interconnect-test-id")
            .edgeAvailabilityDomain("AVAILABILITY_DOMAIN_1")
            .type("PARTNER")
            .router(router.id())
            .mtu(1500)
            .build());

        var interconnect_test = new VpcFlowLogsConfig("interconnect-test", VpcFlowLogsConfigArgs.builder()
            .vpcFlowLogsConfigId("basic-interconnect-test-id")
            .location("global")
            .interconnectAttachment(attachment.name().applyValue(name -> String.format("projects/%s/regions/us-east4/interconnectAttachments/%s", project.applyValue(getProjectResult -> getProjectResult.number()),name)))
            .build());

    }
}
Copy
resources:
  interconnect-test:
    type: gcp:networkmanagement:VpcFlowLogsConfig
    properties:
      vpcFlowLogsConfigId: basic-interconnect-test-id
      location: global
      interconnectAttachment: projects/${project.number}/regions/us-east4/interconnectAttachments/${attachment.name}
  network:
    type: gcp:compute:Network
    properties:
      name: basic-interconnect-test-network
  router:
    type: gcp:compute:Router
    properties:
      name: basic-interconnect-test-router
      network: ${network.name}
      bgp:
        asn: 16550
  attachment:
    type: gcp:compute:InterconnectAttachment
    properties:
      name: basic-interconnect-test-id
      edgeAvailabilityDomain: AVAILABILITY_DOMAIN_1
      type: PARTNER
      router: ${router.id}
      mtu: 1500
variables:
  project:
    fn::invoke:
      function: gcp:organizations:getProject
      arguments: {}
Copy

Network Management Vpc Flow Logs Config Vpn Basic

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const project = gcp.organizations.getProject({});
const network = new gcp.compute.Network("network", {name: "basic-test-network"});
const targetGateway = new gcp.compute.VPNGateway("target_gateway", {
    name: "basic-test-gateway",
    network: network.id,
});
const vpnStaticIp = new gcp.compute.Address("vpn_static_ip", {name: "basic-test-address"});
const frEsp = new gcp.compute.ForwardingRule("fr_esp", {
    name: "basic-test-fresp",
    ipProtocol: "ESP",
    ipAddress: vpnStaticIp.address,
    target: targetGateway.id,
});
const frUdp500 = new gcp.compute.ForwardingRule("fr_udp500", {
    name: "basic-test-fr500",
    ipProtocol: "UDP",
    portRange: "500",
    ipAddress: vpnStaticIp.address,
    target: targetGateway.id,
});
const frUdp4500 = new gcp.compute.ForwardingRule("fr_udp4500", {
    name: "basic-test-fr4500",
    ipProtocol: "UDP",
    portRange: "4500",
    ipAddress: vpnStaticIp.address,
    target: targetGateway.id,
});
const tunnel = new gcp.compute.VPNTunnel("tunnel", {
    name: "basic-test-tunnel",
    peerIp: "15.0.0.120",
    sharedSecret: "a secret message",
    targetVpnGateway: targetGateway.id,
}, {
    dependsOn: [
        frEsp,
        frUdp500,
        frUdp4500,
    ],
});
const vpn_test = new gcp.networkmanagement.VpcFlowLogsConfig("vpn-test", {
    vpcFlowLogsConfigId: "basic-test-id",
    location: "global",
    vpnTunnel: pulumi.all([project, tunnel.name]).apply(([project, name]) => `projects/${project.number}/regions/us-central1/vpnTunnels/${name}`),
});
const route = new gcp.compute.Route("route", {
    name: "basic-test-route",
    network: network.name,
    destRange: "15.0.0.0/24",
    priority: 1000,
    nextHopVpnTunnel: tunnel.id,
});
Copy
import pulumi
import pulumi_gcp as gcp

project = gcp.organizations.get_project()
network = gcp.compute.Network("network", name="basic-test-network")
target_gateway = gcp.compute.VPNGateway("target_gateway",
    name="basic-test-gateway",
    network=network.id)
vpn_static_ip = gcp.compute.Address("vpn_static_ip", name="basic-test-address")
fr_esp = gcp.compute.ForwardingRule("fr_esp",
    name="basic-test-fresp",
    ip_protocol="ESP",
    ip_address=vpn_static_ip.address,
    target=target_gateway.id)
fr_udp500 = gcp.compute.ForwardingRule("fr_udp500",
    name="basic-test-fr500",
    ip_protocol="UDP",
    port_range="500",
    ip_address=vpn_static_ip.address,
    target=target_gateway.id)
fr_udp4500 = gcp.compute.ForwardingRule("fr_udp4500",
    name="basic-test-fr4500",
    ip_protocol="UDP",
    port_range="4500",
    ip_address=vpn_static_ip.address,
    target=target_gateway.id)
tunnel = gcp.compute.VPNTunnel("tunnel",
    name="basic-test-tunnel",
    peer_ip="15.0.0.120",
    shared_secret="a secret message",
    target_vpn_gateway=target_gateway.id,
    opts = pulumi.ResourceOptions(depends_on=[
            fr_esp,
            fr_udp500,
            fr_udp4500,
        ]))
vpn_test = gcp.networkmanagement.VpcFlowLogsConfig("vpn-test",
    vpc_flow_logs_config_id="basic-test-id",
    location="global",
    vpn_tunnel=tunnel.name.apply(lambda name: f"projects/{project.number}/regions/us-central1/vpnTunnels/{name}"))
route = gcp.compute.Route("route",
    name="basic-test-route",
    network=network.name,
    dest_range="15.0.0.0/24",
    priority=1000,
    next_hop_vpn_tunnel=tunnel.id)
Copy
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/compute"
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/networkmanagement"
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/organizations"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		project, err := organizations.LookupProject(ctx, &organizations.LookupProjectArgs{}, nil)
		if err != nil {
			return err
		}
		network, err := compute.NewNetwork(ctx, "network", &compute.NetworkArgs{
			Name: pulumi.String("basic-test-network"),
		})
		if err != nil {
			return err
		}
		targetGateway, err := compute.NewVPNGateway(ctx, "target_gateway", &compute.VPNGatewayArgs{
			Name:    pulumi.String("basic-test-gateway"),
			Network: network.ID(),
		})
		if err != nil {
			return err
		}
		vpnStaticIp, err := compute.NewAddress(ctx, "vpn_static_ip", &compute.AddressArgs{
			Name: pulumi.String("basic-test-address"),
		})
		if err != nil {
			return err
		}
		frEsp, err := compute.NewForwardingRule(ctx, "fr_esp", &compute.ForwardingRuleArgs{
			Name:       pulumi.String("basic-test-fresp"),
			IpProtocol: pulumi.String("ESP"),
			IpAddress:  vpnStaticIp.Address,
			Target:     targetGateway.ID(),
		})
		if err != nil {
			return err
		}
		frUdp500, err := compute.NewForwardingRule(ctx, "fr_udp500", &compute.ForwardingRuleArgs{
			Name:       pulumi.String("basic-test-fr500"),
			IpProtocol: pulumi.String("UDP"),
			PortRange:  pulumi.String("500"),
			IpAddress:  vpnStaticIp.Address,
			Target:     targetGateway.ID(),
		})
		if err != nil {
			return err
		}
		frUdp4500, err := compute.NewForwardingRule(ctx, "fr_udp4500", &compute.ForwardingRuleArgs{
			Name:       pulumi.String("basic-test-fr4500"),
			IpProtocol: pulumi.String("UDP"),
			PortRange:  pulumi.String("4500"),
			IpAddress:  vpnStaticIp.Address,
			Target:     targetGateway.ID(),
		})
		if err != nil {
			return err
		}
		tunnel, err := compute.NewVPNTunnel(ctx, "tunnel", &compute.VPNTunnelArgs{
			Name:             pulumi.String("basic-test-tunnel"),
			PeerIp:           pulumi.String("15.0.0.120"),
			SharedSecret:     pulumi.String("a secret message"),
			TargetVpnGateway: targetGateway.ID(),
		}, pulumi.DependsOn([]pulumi.Resource{
			frEsp,
			frUdp500,
			frUdp4500,
		}))
		if err != nil {
			return err
		}
		_, err = networkmanagement.NewVpcFlowLogsConfig(ctx, "vpn-test", &networkmanagement.VpcFlowLogsConfigArgs{
			VpcFlowLogsConfigId: pulumi.String("basic-test-id"),
			Location:            pulumi.String("global"),
			VpnTunnel: tunnel.Name.ApplyT(func(name string) (string, error) {
				return fmt.Sprintf("projects/%v/regions/us-central1/vpnTunnels/%v", project.Number, name), nil
			}).(pulumi.StringOutput),
		})
		if err != nil {
			return err
		}
		_, err = compute.NewRoute(ctx, "route", &compute.RouteArgs{
			Name:             pulumi.String("basic-test-route"),
			Network:          network.Name,
			DestRange:        pulumi.String("15.0.0.0/24"),
			Priority:         pulumi.Int(1000),
			NextHopVpnTunnel: tunnel.ID(),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var project = Gcp.Organizations.GetProject.Invoke();

    var network = new Gcp.Compute.Network("network", new()
    {
        Name = "basic-test-network",
    });

    var targetGateway = new Gcp.Compute.VPNGateway("target_gateway", new()
    {
        Name = "basic-test-gateway",
        Network = network.Id,
    });

    var vpnStaticIp = new Gcp.Compute.Address("vpn_static_ip", new()
    {
        Name = "basic-test-address",
    });

    var frEsp = new Gcp.Compute.ForwardingRule("fr_esp", new()
    {
        Name = "basic-test-fresp",
        IpProtocol = "ESP",
        IpAddress = vpnStaticIp.IPAddress,
        Target = targetGateway.Id,
    });

    var frUdp500 = new Gcp.Compute.ForwardingRule("fr_udp500", new()
    {
        Name = "basic-test-fr500",
        IpProtocol = "UDP",
        PortRange = "500",
        IpAddress = vpnStaticIp.IPAddress,
        Target = targetGateway.Id,
    });

    var frUdp4500 = new Gcp.Compute.ForwardingRule("fr_udp4500", new()
    {
        Name = "basic-test-fr4500",
        IpProtocol = "UDP",
        PortRange = "4500",
        IpAddress = vpnStaticIp.IPAddress,
        Target = targetGateway.Id,
    });

    var tunnel = new Gcp.Compute.VPNTunnel("tunnel", new()
    {
        Name = "basic-test-tunnel",
        PeerIp = "15.0.0.120",
        SharedSecret = "a secret message",
        TargetVpnGateway = targetGateway.Id,
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            frEsp,
            frUdp500,
            frUdp4500,
        },
    });

    var vpn_test = new Gcp.NetworkManagement.VpcFlowLogsConfig("vpn-test", new()
    {
        VpcFlowLogsConfigId = "basic-test-id",
        Location = "global",
        VpnTunnel = Output.Tuple(project, tunnel.Name).Apply(values =>
        {
            var project = values.Item1;
            var name = values.Item2;
            return $"projects/{project.Apply(getProjectResult => getProjectResult.Number)}/regions/us-central1/vpnTunnels/{name}";
        }),
    });

    var route = new Gcp.Compute.Route("route", new()
    {
        Name = "basic-test-route",
        Network = network.Name,
        DestRange = "15.0.0.0/24",
        Priority = 1000,
        NextHopVpnTunnel = tunnel.Id,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
import com.pulumi.gcp.compute.Network;
import com.pulumi.gcp.compute.NetworkArgs;
import com.pulumi.gcp.compute.VPNGateway;
import com.pulumi.gcp.compute.VPNGatewayArgs;
import com.pulumi.gcp.compute.Address;
import com.pulumi.gcp.compute.AddressArgs;
import com.pulumi.gcp.compute.ForwardingRule;
import com.pulumi.gcp.compute.ForwardingRuleArgs;
import com.pulumi.gcp.compute.VPNTunnel;
import com.pulumi.gcp.compute.VPNTunnelArgs;
import com.pulumi.gcp.networkmanagement.VpcFlowLogsConfig;
import com.pulumi.gcp.networkmanagement.VpcFlowLogsConfigArgs;
import com.pulumi.gcp.compute.Route;
import com.pulumi.gcp.compute.RouteArgs;
import com.pulumi.resources.CustomResourceOptions;
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) {
        final var project = OrganizationsFunctions.getProject();

        var network = new Network("network", NetworkArgs.builder()
            .name("basic-test-network")
            .build());

        var targetGateway = new VPNGateway("targetGateway", VPNGatewayArgs.builder()
            .name("basic-test-gateway")
            .network(network.id())
            .build());

        var vpnStaticIp = new Address("vpnStaticIp", AddressArgs.builder()
            .name("basic-test-address")
            .build());

        var frEsp = new ForwardingRule("frEsp", ForwardingRuleArgs.builder()
            .name("basic-test-fresp")
            .ipProtocol("ESP")
            .ipAddress(vpnStaticIp.address())
            .target(targetGateway.id())
            .build());

        var frUdp500 = new ForwardingRule("frUdp500", ForwardingRuleArgs.builder()
            .name("basic-test-fr500")
            .ipProtocol("UDP")
            .portRange("500")
            .ipAddress(vpnStaticIp.address())
            .target(targetGateway.id())
            .build());

        var frUdp4500 = new ForwardingRule("frUdp4500", ForwardingRuleArgs.builder()
            .name("basic-test-fr4500")
            .ipProtocol("UDP")
            .portRange("4500")
            .ipAddress(vpnStaticIp.address())
            .target(targetGateway.id())
            .build());

        var tunnel = new VPNTunnel("tunnel", VPNTunnelArgs.builder()
            .name("basic-test-tunnel")
            .peerIp("15.0.0.120")
            .sharedSecret("a secret message")
            .targetVpnGateway(targetGateway.id())
            .build(), CustomResourceOptions.builder()
                .dependsOn(                
                    frEsp,
                    frUdp500,
                    frUdp4500)
                .build());

        var vpn_test = new VpcFlowLogsConfig("vpn-test", VpcFlowLogsConfigArgs.builder()
            .vpcFlowLogsConfigId("basic-test-id")
            .location("global")
            .vpnTunnel(tunnel.name().applyValue(name -> String.format("projects/%s/regions/us-central1/vpnTunnels/%s", project.applyValue(getProjectResult -> getProjectResult.number()),name)))
            .build());

        var route = new Route("route", RouteArgs.builder()
            .name("basic-test-route")
            .network(network.name())
            .destRange("15.0.0.0/24")
            .priority(1000)
            .nextHopVpnTunnel(tunnel.id())
            .build());

    }
}
Copy
resources:
  vpn-test:
    type: gcp:networkmanagement:VpcFlowLogsConfig
    properties:
      vpcFlowLogsConfigId: basic-test-id
      location: global
      vpnTunnel: projects/${project.number}/regions/us-central1/vpnTunnels/${tunnel.name}
  tunnel:
    type: gcp:compute:VPNTunnel
    properties:
      name: basic-test-tunnel
      peerIp: 15.0.0.120
      sharedSecret: a secret message
      targetVpnGateway: ${targetGateway.id}
    options:
      dependsOn:
        - ${frEsp}
        - ${frUdp500}
        - ${frUdp4500}
  targetGateway:
    type: gcp:compute:VPNGateway
    name: target_gateway
    properties:
      name: basic-test-gateway
      network: ${network.id}
  network:
    type: gcp:compute:Network
    properties:
      name: basic-test-network
  vpnStaticIp:
    type: gcp:compute:Address
    name: vpn_static_ip
    properties:
      name: basic-test-address
  frEsp:
    type: gcp:compute:ForwardingRule
    name: fr_esp
    properties:
      name: basic-test-fresp
      ipProtocol: ESP
      ipAddress: ${vpnStaticIp.address}
      target: ${targetGateway.id}
  frUdp500:
    type: gcp:compute:ForwardingRule
    name: fr_udp500
    properties:
      name: basic-test-fr500
      ipProtocol: UDP
      portRange: '500'
      ipAddress: ${vpnStaticIp.address}
      target: ${targetGateway.id}
  frUdp4500:
    type: gcp:compute:ForwardingRule
    name: fr_udp4500
    properties:
      name: basic-test-fr4500
      ipProtocol: UDP
      portRange: '4500'
      ipAddress: ${vpnStaticIp.address}
      target: ${targetGateway.id}
  route:
    type: gcp:compute:Route
    properties:
      name: basic-test-route
      network: ${network.name}
      destRange: 15.0.0.0/24
      priority: 1000
      nextHopVpnTunnel: ${tunnel.id}
variables:
  project:
    fn::invoke:
      function: gcp:organizations:getProject
      arguments: {}
Copy

Network Management Vpc Flow Logs Config Vpn Full

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const project = gcp.organizations.getProject({});
const network = new gcp.compute.Network("network", {name: "full-test-network"});
const targetGateway = new gcp.compute.VPNGateway("target_gateway", {
    name: "full-test-gateway",
    network: network.id,
});
const vpnStaticIp = new gcp.compute.Address("vpn_static_ip", {name: "full-test-address"});
const frEsp = new gcp.compute.ForwardingRule("fr_esp", {
    name: "full-test-fresp",
    ipProtocol: "ESP",
    ipAddress: vpnStaticIp.address,
    target: targetGateway.id,
});
const frUdp500 = new gcp.compute.ForwardingRule("fr_udp500", {
    name: "full-test-fr500",
    ipProtocol: "UDP",
    portRange: "500",
    ipAddress: vpnStaticIp.address,
    target: targetGateway.id,
});
const frUdp4500 = new gcp.compute.ForwardingRule("fr_udp4500", {
    name: "full-test-fr4500",
    ipProtocol: "UDP",
    portRange: "4500",
    ipAddress: vpnStaticIp.address,
    target: targetGateway.id,
});
const tunnel = new gcp.compute.VPNTunnel("tunnel", {
    name: "full-test-tunnel",
    peerIp: "15.0.0.120",
    sharedSecret: "a secret message",
    targetVpnGateway: targetGateway.id,
}, {
    dependsOn: [
        frEsp,
        frUdp500,
        frUdp4500,
    ],
});
const vpn_test = new gcp.networkmanagement.VpcFlowLogsConfig("vpn-test", {
    vpcFlowLogsConfigId: "full-test-id",
    location: "global",
    vpnTunnel: pulumi.all([project, tunnel.name]).apply(([project, name]) => `projects/${project.number}/regions/us-central1/vpnTunnels/${name}`),
    state: "ENABLED",
    aggregationInterval: "INTERVAL_5_SEC",
    description: "VPC Flow Logs over a VPN Gateway.",
    flowSampling: 0.5,
    metadata: "INCLUDE_ALL_METADATA",
});
const route = new gcp.compute.Route("route", {
    name: "full-test-route",
    network: network.name,
    destRange: "15.0.0.0/24",
    priority: 1000,
    nextHopVpnTunnel: tunnel.id,
});
Copy
import pulumi
import pulumi_gcp as gcp

project = gcp.organizations.get_project()
network = gcp.compute.Network("network", name="full-test-network")
target_gateway = gcp.compute.VPNGateway("target_gateway",
    name="full-test-gateway",
    network=network.id)
vpn_static_ip = gcp.compute.Address("vpn_static_ip", name="full-test-address")
fr_esp = gcp.compute.ForwardingRule("fr_esp",
    name="full-test-fresp",
    ip_protocol="ESP",
    ip_address=vpn_static_ip.address,
    target=target_gateway.id)
fr_udp500 = gcp.compute.ForwardingRule("fr_udp500",
    name="full-test-fr500",
    ip_protocol="UDP",
    port_range="500",
    ip_address=vpn_static_ip.address,
    target=target_gateway.id)
fr_udp4500 = gcp.compute.ForwardingRule("fr_udp4500",
    name="full-test-fr4500",
    ip_protocol="UDP",
    port_range="4500",
    ip_address=vpn_static_ip.address,
    target=target_gateway.id)
tunnel = gcp.compute.VPNTunnel("tunnel",
    name="full-test-tunnel",
    peer_ip="15.0.0.120",
    shared_secret="a secret message",
    target_vpn_gateway=target_gateway.id,
    opts = pulumi.ResourceOptions(depends_on=[
            fr_esp,
            fr_udp500,
            fr_udp4500,
        ]))
vpn_test = gcp.networkmanagement.VpcFlowLogsConfig("vpn-test",
    vpc_flow_logs_config_id="full-test-id",
    location="global",
    vpn_tunnel=tunnel.name.apply(lambda name: f"projects/{project.number}/regions/us-central1/vpnTunnels/{name}"),
    state="ENABLED",
    aggregation_interval="INTERVAL_5_SEC",
    description="VPC Flow Logs over a VPN Gateway.",
    flow_sampling=0.5,
    metadata="INCLUDE_ALL_METADATA")
route = gcp.compute.Route("route",
    name="full-test-route",
    network=network.name,
    dest_range="15.0.0.0/24",
    priority=1000,
    next_hop_vpn_tunnel=tunnel.id)
Copy
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/compute"
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/networkmanagement"
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/organizations"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		project, err := organizations.LookupProject(ctx, &organizations.LookupProjectArgs{}, nil)
		if err != nil {
			return err
		}
		network, err := compute.NewNetwork(ctx, "network", &compute.NetworkArgs{
			Name: pulumi.String("full-test-network"),
		})
		if err != nil {
			return err
		}
		targetGateway, err := compute.NewVPNGateway(ctx, "target_gateway", &compute.VPNGatewayArgs{
			Name:    pulumi.String("full-test-gateway"),
			Network: network.ID(),
		})
		if err != nil {
			return err
		}
		vpnStaticIp, err := compute.NewAddress(ctx, "vpn_static_ip", &compute.AddressArgs{
			Name: pulumi.String("full-test-address"),
		})
		if err != nil {
			return err
		}
		frEsp, err := compute.NewForwardingRule(ctx, "fr_esp", &compute.ForwardingRuleArgs{
			Name:       pulumi.String("full-test-fresp"),
			IpProtocol: pulumi.String("ESP"),
			IpAddress:  vpnStaticIp.Address,
			Target:     targetGateway.ID(),
		})
		if err != nil {
			return err
		}
		frUdp500, err := compute.NewForwardingRule(ctx, "fr_udp500", &compute.ForwardingRuleArgs{
			Name:       pulumi.String("full-test-fr500"),
			IpProtocol: pulumi.String("UDP"),
			PortRange:  pulumi.String("500"),
			IpAddress:  vpnStaticIp.Address,
			Target:     targetGateway.ID(),
		})
		if err != nil {
			return err
		}
		frUdp4500, err := compute.NewForwardingRule(ctx, "fr_udp4500", &compute.ForwardingRuleArgs{
			Name:       pulumi.String("full-test-fr4500"),
			IpProtocol: pulumi.String("UDP"),
			PortRange:  pulumi.String("4500"),
			IpAddress:  vpnStaticIp.Address,
			Target:     targetGateway.ID(),
		})
		if err != nil {
			return err
		}
		tunnel, err := compute.NewVPNTunnel(ctx, "tunnel", &compute.VPNTunnelArgs{
			Name:             pulumi.String("full-test-tunnel"),
			PeerIp:           pulumi.String("15.0.0.120"),
			SharedSecret:     pulumi.String("a secret message"),
			TargetVpnGateway: targetGateway.ID(),
		}, pulumi.DependsOn([]pulumi.Resource{
			frEsp,
			frUdp500,
			frUdp4500,
		}))
		if err != nil {
			return err
		}
		_, err = networkmanagement.NewVpcFlowLogsConfig(ctx, "vpn-test", &networkmanagement.VpcFlowLogsConfigArgs{
			VpcFlowLogsConfigId: pulumi.String("full-test-id"),
			Location:            pulumi.String("global"),
			VpnTunnel: tunnel.Name.ApplyT(func(name string) (string, error) {
				return fmt.Sprintf("projects/%v/regions/us-central1/vpnTunnels/%v", project.Number, name), nil
			}).(pulumi.StringOutput),
			State:               pulumi.String("ENABLED"),
			AggregationInterval: pulumi.String("INTERVAL_5_SEC"),
			Description:         pulumi.String("VPC Flow Logs over a VPN Gateway."),
			FlowSampling:        pulumi.Float64(0.5),
			Metadata:            pulumi.String("INCLUDE_ALL_METADATA"),
		})
		if err != nil {
			return err
		}
		_, err = compute.NewRoute(ctx, "route", &compute.RouteArgs{
			Name:             pulumi.String("full-test-route"),
			Network:          network.Name,
			DestRange:        pulumi.String("15.0.0.0/24"),
			Priority:         pulumi.Int(1000),
			NextHopVpnTunnel: tunnel.ID(),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var project = Gcp.Organizations.GetProject.Invoke();

    var network = new Gcp.Compute.Network("network", new()
    {
        Name = "full-test-network",
    });

    var targetGateway = new Gcp.Compute.VPNGateway("target_gateway", new()
    {
        Name = "full-test-gateway",
        Network = network.Id,
    });

    var vpnStaticIp = new Gcp.Compute.Address("vpn_static_ip", new()
    {
        Name = "full-test-address",
    });

    var frEsp = new Gcp.Compute.ForwardingRule("fr_esp", new()
    {
        Name = "full-test-fresp",
        IpProtocol = "ESP",
        IpAddress = vpnStaticIp.IPAddress,
        Target = targetGateway.Id,
    });

    var frUdp500 = new Gcp.Compute.ForwardingRule("fr_udp500", new()
    {
        Name = "full-test-fr500",
        IpProtocol = "UDP",
        PortRange = "500",
        IpAddress = vpnStaticIp.IPAddress,
        Target = targetGateway.Id,
    });

    var frUdp4500 = new Gcp.Compute.ForwardingRule("fr_udp4500", new()
    {
        Name = "full-test-fr4500",
        IpProtocol = "UDP",
        PortRange = "4500",
        IpAddress = vpnStaticIp.IPAddress,
        Target = targetGateway.Id,
    });

    var tunnel = new Gcp.Compute.VPNTunnel("tunnel", new()
    {
        Name = "full-test-tunnel",
        PeerIp = "15.0.0.120",
        SharedSecret = "a secret message",
        TargetVpnGateway = targetGateway.Id,
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            frEsp,
            frUdp500,
            frUdp4500,
        },
    });

    var vpn_test = new Gcp.NetworkManagement.VpcFlowLogsConfig("vpn-test", new()
    {
        VpcFlowLogsConfigId = "full-test-id",
        Location = "global",
        VpnTunnel = Output.Tuple(project, tunnel.Name).Apply(values =>
        {
            var project = values.Item1;
            var name = values.Item2;
            return $"projects/{project.Apply(getProjectResult => getProjectResult.Number)}/regions/us-central1/vpnTunnels/{name}";
        }),
        State = "ENABLED",
        AggregationInterval = "INTERVAL_5_SEC",
        Description = "VPC Flow Logs over a VPN Gateway.",
        FlowSampling = 0.5,
        Metadata = "INCLUDE_ALL_METADATA",
    });

    var route = new Gcp.Compute.Route("route", new()
    {
        Name = "full-test-route",
        Network = network.Name,
        DestRange = "15.0.0.0/24",
        Priority = 1000,
        NextHopVpnTunnel = tunnel.Id,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
import com.pulumi.gcp.compute.Network;
import com.pulumi.gcp.compute.NetworkArgs;
import com.pulumi.gcp.compute.VPNGateway;
import com.pulumi.gcp.compute.VPNGatewayArgs;
import com.pulumi.gcp.compute.Address;
import com.pulumi.gcp.compute.AddressArgs;
import com.pulumi.gcp.compute.ForwardingRule;
import com.pulumi.gcp.compute.ForwardingRuleArgs;
import com.pulumi.gcp.compute.VPNTunnel;
import com.pulumi.gcp.compute.VPNTunnelArgs;
import com.pulumi.gcp.networkmanagement.VpcFlowLogsConfig;
import com.pulumi.gcp.networkmanagement.VpcFlowLogsConfigArgs;
import com.pulumi.gcp.compute.Route;
import com.pulumi.gcp.compute.RouteArgs;
import com.pulumi.resources.CustomResourceOptions;
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) {
        final var project = OrganizationsFunctions.getProject();

        var network = new Network("network", NetworkArgs.builder()
            .name("full-test-network")
            .build());

        var targetGateway = new VPNGateway("targetGateway", VPNGatewayArgs.builder()
            .name("full-test-gateway")
            .network(network.id())
            .build());

        var vpnStaticIp = new Address("vpnStaticIp", AddressArgs.builder()
            .name("full-test-address")
            .build());

        var frEsp = new ForwardingRule("frEsp", ForwardingRuleArgs.builder()
            .name("full-test-fresp")
            .ipProtocol("ESP")
            .ipAddress(vpnStaticIp.address())
            .target(targetGateway.id())
            .build());

        var frUdp500 = new ForwardingRule("frUdp500", ForwardingRuleArgs.builder()
            .name("full-test-fr500")
            .ipProtocol("UDP")
            .portRange("500")
            .ipAddress(vpnStaticIp.address())
            .target(targetGateway.id())
            .build());

        var frUdp4500 = new ForwardingRule("frUdp4500", ForwardingRuleArgs.builder()
            .name("full-test-fr4500")
            .ipProtocol("UDP")
            .portRange("4500")
            .ipAddress(vpnStaticIp.address())
            .target(targetGateway.id())
            .build());

        var tunnel = new VPNTunnel("tunnel", VPNTunnelArgs.builder()
            .name("full-test-tunnel")
            .peerIp("15.0.0.120")
            .sharedSecret("a secret message")
            .targetVpnGateway(targetGateway.id())
            .build(), CustomResourceOptions.builder()
                .dependsOn(                
                    frEsp,
                    frUdp500,
                    frUdp4500)
                .build());

        var vpn_test = new VpcFlowLogsConfig("vpn-test", VpcFlowLogsConfigArgs.builder()
            .vpcFlowLogsConfigId("full-test-id")
            .location("global")
            .vpnTunnel(tunnel.name().applyValue(name -> String.format("projects/%s/regions/us-central1/vpnTunnels/%s", project.applyValue(getProjectResult -> getProjectResult.number()),name)))
            .state("ENABLED")
            .aggregationInterval("INTERVAL_5_SEC")
            .description("VPC Flow Logs over a VPN Gateway.")
            .flowSampling(0.5)
            .metadata("INCLUDE_ALL_METADATA")
            .build());

        var route = new Route("route", RouteArgs.builder()
            .name("full-test-route")
            .network(network.name())
            .destRange("15.0.0.0/24")
            .priority(1000)
            .nextHopVpnTunnel(tunnel.id())
            .build());

    }
}
Copy
resources:
  vpn-test:
    type: gcp:networkmanagement:VpcFlowLogsConfig
    properties:
      vpcFlowLogsConfigId: full-test-id
      location: global
      vpnTunnel: projects/${project.number}/regions/us-central1/vpnTunnels/${tunnel.name}
      state: ENABLED
      aggregationInterval: INTERVAL_5_SEC
      description: VPC Flow Logs over a VPN Gateway.
      flowSampling: 0.5
      metadata: INCLUDE_ALL_METADATA
  tunnel:
    type: gcp:compute:VPNTunnel
    properties:
      name: full-test-tunnel
      peerIp: 15.0.0.120
      sharedSecret: a secret message
      targetVpnGateway: ${targetGateway.id}
    options:
      dependsOn:
        - ${frEsp}
        - ${frUdp500}
        - ${frUdp4500}
  targetGateway:
    type: gcp:compute:VPNGateway
    name: target_gateway
    properties:
      name: full-test-gateway
      network: ${network.id}
  network:
    type: gcp:compute:Network
    properties:
      name: full-test-network
  vpnStaticIp:
    type: gcp:compute:Address
    name: vpn_static_ip
    properties:
      name: full-test-address
  frEsp:
    type: gcp:compute:ForwardingRule
    name: fr_esp
    properties:
      name: full-test-fresp
      ipProtocol: ESP
      ipAddress: ${vpnStaticIp.address}
      target: ${targetGateway.id}
  frUdp500:
    type: gcp:compute:ForwardingRule
    name: fr_udp500
    properties:
      name: full-test-fr500
      ipProtocol: UDP
      portRange: '500'
      ipAddress: ${vpnStaticIp.address}
      target: ${targetGateway.id}
  frUdp4500:
    type: gcp:compute:ForwardingRule
    name: fr_udp4500
    properties:
      name: full-test-fr4500
      ipProtocol: UDP
      portRange: '4500'
      ipAddress: ${vpnStaticIp.address}
      target: ${targetGateway.id}
  route:
    type: gcp:compute:Route
    properties:
      name: full-test-route
      network: ${network.name}
      destRange: 15.0.0.0/24
      priority: 1000
      nextHopVpnTunnel: ${tunnel.id}
variables:
  project:
    fn::invoke:
      function: gcp:organizations:getProject
      arguments: {}
Copy

Create VpcFlowLogsConfig Resource

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

Constructor syntax

new VpcFlowLogsConfig(name: string, args: VpcFlowLogsConfigArgs, opts?: CustomResourceOptions);
@overload
def VpcFlowLogsConfig(resource_name: str,
                      args: VpcFlowLogsConfigArgs,
                      opts: Optional[ResourceOptions] = None)

@overload
def VpcFlowLogsConfig(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      location: Optional[str] = None,
                      vpc_flow_logs_config_id: Optional[str] = None,
                      flow_sampling: Optional[float] = None,
                      aggregation_interval: Optional[str] = None,
                      interconnect_attachment: Optional[str] = None,
                      labels: Optional[Mapping[str, str]] = None,
                      filter_expr: Optional[str] = None,
                      metadata: Optional[str] = None,
                      metadata_fields: Optional[Sequence[str]] = None,
                      project: Optional[str] = None,
                      state: Optional[str] = None,
                      description: Optional[str] = None,
                      vpn_tunnel: Optional[str] = None)
func NewVpcFlowLogsConfig(ctx *Context, name string, args VpcFlowLogsConfigArgs, opts ...ResourceOption) (*VpcFlowLogsConfig, error)
public VpcFlowLogsConfig(string name, VpcFlowLogsConfigArgs args, CustomResourceOptions? opts = null)
public VpcFlowLogsConfig(String name, VpcFlowLogsConfigArgs args)
public VpcFlowLogsConfig(String name, VpcFlowLogsConfigArgs args, CustomResourceOptions options)
type: gcp:networkmanagement:VpcFlowLogsConfig
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

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

Constructor example

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

var vpcFlowLogsConfigResource = new Gcp.NetworkManagement.VpcFlowLogsConfig("vpcFlowLogsConfigResource", new()
{
    Location = "string",
    VpcFlowLogsConfigId = "string",
    FlowSampling = 0,
    AggregationInterval = "string",
    InterconnectAttachment = "string",
    Labels = 
    {
        { "string", "string" },
    },
    FilterExpr = "string",
    Metadata = "string",
    MetadataFields = new[]
    {
        "string",
    },
    Project = "string",
    State = "string",
    Description = "string",
    VpnTunnel = "string",
});
Copy
example, err := networkmanagement.NewVpcFlowLogsConfig(ctx, "vpcFlowLogsConfigResource", &networkmanagement.VpcFlowLogsConfigArgs{
	Location:               pulumi.String("string"),
	VpcFlowLogsConfigId:    pulumi.String("string"),
	FlowSampling:           pulumi.Float64(0),
	AggregationInterval:    pulumi.String("string"),
	InterconnectAttachment: pulumi.String("string"),
	Labels: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	FilterExpr: pulumi.String("string"),
	Metadata:   pulumi.String("string"),
	MetadataFields: pulumi.StringArray{
		pulumi.String("string"),
	},
	Project:     pulumi.String("string"),
	State:       pulumi.String("string"),
	Description: pulumi.String("string"),
	VpnTunnel:   pulumi.String("string"),
})
Copy
var vpcFlowLogsConfigResource = new VpcFlowLogsConfig("vpcFlowLogsConfigResource", VpcFlowLogsConfigArgs.builder()
    .location("string")
    .vpcFlowLogsConfigId("string")
    .flowSampling(0)
    .aggregationInterval("string")
    .interconnectAttachment("string")
    .labels(Map.of("string", "string"))
    .filterExpr("string")
    .metadata("string")
    .metadataFields("string")
    .project("string")
    .state("string")
    .description("string")
    .vpnTunnel("string")
    .build());
Copy
vpc_flow_logs_config_resource = gcp.networkmanagement.VpcFlowLogsConfig("vpcFlowLogsConfigResource",
    location="string",
    vpc_flow_logs_config_id="string",
    flow_sampling=0,
    aggregation_interval="string",
    interconnect_attachment="string",
    labels={
        "string": "string",
    },
    filter_expr="string",
    metadata="string",
    metadata_fields=["string"],
    project="string",
    state="string",
    description="string",
    vpn_tunnel="string")
Copy
const vpcFlowLogsConfigResource = new gcp.networkmanagement.VpcFlowLogsConfig("vpcFlowLogsConfigResource", {
    location: "string",
    vpcFlowLogsConfigId: "string",
    flowSampling: 0,
    aggregationInterval: "string",
    interconnectAttachment: "string",
    labels: {
        string: "string",
    },
    filterExpr: "string",
    metadata: "string",
    metadataFields: ["string"],
    project: "string",
    state: "string",
    description: "string",
    vpnTunnel: "string",
});
Copy
type: gcp:networkmanagement:VpcFlowLogsConfig
properties:
    aggregationInterval: string
    description: string
    filterExpr: string
    flowSampling: 0
    interconnectAttachment: string
    labels:
        string: string
    location: string
    metadata: string
    metadataFields:
        - string
    project: string
    state: string
    vpcFlowLogsConfigId: string
    vpnTunnel: string
Copy

VpcFlowLogsConfig Resource Properties

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

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The VpcFlowLogsConfig resource accepts the following input properties:

Location
This property is required.
Changes to this property will trigger replacement.
string
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 networkmanagement.googleapis.com/VpcFlowLogsConfig.
VpcFlowLogsConfigId
This property is required.
Changes to this property will trigger replacement.
string
Required. ID of the VpcFlowLogsConfig.


AggregationInterval string
Optional. The aggregation interval for the logs. Default value is INTERVAL_5_SEC. Possible values: AGGREGATION_INTERVAL_UNSPECIFIED INTERVAL_5_SEC INTERVAL_30_SEC INTERVAL_1_MIN INTERVAL_5_MIN INTERVAL_10_MIN INTERVAL_15_MIN"
Description string
Optional. The user-supplied description of the VPC Flow Logs configuration. Maximum of 512 characters.
FilterExpr string
Optional. Export filter used to define which VPC Flow Logs should be logged.
FlowSampling double
Optional. The value of the field must be in (0, 1]. The sampling rate of VPC Flow Logs where 1.0 means all collected logs are reported. Setting the sampling rate to 0.0 is not allowed. If you want to disable VPC Flow Logs, use the state field instead. Default value is 1.0.
InterconnectAttachment string
Traffic will be logged from the Interconnect Attachment. Format: projects/{project_id}/regions/{region}/interconnectAttachments/{name}
Labels Dictionary<string, string>

Optional. Resource labels to represent user-provided metadata.

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.

Metadata string
Optional. Configures whether all, none or a subset of metadata fields should be added to the reported VPC flow logs. Default value is INCLUDE_ALL_METADATA. Possible values: METADATA_UNSPECIFIED INCLUDE_ALL_METADATA EXCLUDE_ALL_METADATA CUSTOM_METADATA
MetadataFields List<string>
Optional. Custom metadata fields to include in the reported VPC flow logs. Can only be specified if "metadata" was set to CUSTOM_METADATA.
Project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
State string
Optional. The state of the VPC Flow Log configuration. Default value is ENABLED. When creating a new configuration, it must be enabled. Possible
VpnTunnel string
Traffic will be logged from the VPN Tunnel. Format: projects/{project_id}/regions/{region}/vpnTunnels/{name}
Location
This property is required.
Changes to this property will trigger replacement.
string
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 networkmanagement.googleapis.com/VpcFlowLogsConfig.
VpcFlowLogsConfigId
This property is required.
Changes to this property will trigger replacement.
string
Required. ID of the VpcFlowLogsConfig.


AggregationInterval string
Optional. The aggregation interval for the logs. Default value is INTERVAL_5_SEC. Possible values: AGGREGATION_INTERVAL_UNSPECIFIED INTERVAL_5_SEC INTERVAL_30_SEC INTERVAL_1_MIN INTERVAL_5_MIN INTERVAL_10_MIN INTERVAL_15_MIN"
Description string
Optional. The user-supplied description of the VPC Flow Logs configuration. Maximum of 512 characters.
FilterExpr string
Optional. Export filter used to define which VPC Flow Logs should be logged.
FlowSampling float64
Optional. The value of the field must be in (0, 1]. The sampling rate of VPC Flow Logs where 1.0 means all collected logs are reported. Setting the sampling rate to 0.0 is not allowed. If you want to disable VPC Flow Logs, use the state field instead. Default value is 1.0.
InterconnectAttachment string
Traffic will be logged from the Interconnect Attachment. Format: projects/{project_id}/regions/{region}/interconnectAttachments/{name}
Labels map[string]string

Optional. Resource labels to represent user-provided metadata.

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.

Metadata string
Optional. Configures whether all, none or a subset of metadata fields should be added to the reported VPC flow logs. Default value is INCLUDE_ALL_METADATA. Possible values: METADATA_UNSPECIFIED INCLUDE_ALL_METADATA EXCLUDE_ALL_METADATA CUSTOM_METADATA
MetadataFields []string
Optional. Custom metadata fields to include in the reported VPC flow logs. Can only be specified if "metadata" was set to CUSTOM_METADATA.
Project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
State string
Optional. The state of the VPC Flow Log configuration. Default value is ENABLED. When creating a new configuration, it must be enabled. Possible
VpnTunnel string
Traffic will be logged from the VPN Tunnel. Format: projects/{project_id}/regions/{region}/vpnTunnels/{name}
location
This property is required.
Changes to this property will trigger replacement.
String
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 networkmanagement.googleapis.com/VpcFlowLogsConfig.
vpcFlowLogsConfigId
This property is required.
Changes to this property will trigger replacement.
String
Required. ID of the VpcFlowLogsConfig.


aggregationInterval String
Optional. The aggregation interval for the logs. Default value is INTERVAL_5_SEC. Possible values: AGGREGATION_INTERVAL_UNSPECIFIED INTERVAL_5_SEC INTERVAL_30_SEC INTERVAL_1_MIN INTERVAL_5_MIN INTERVAL_10_MIN INTERVAL_15_MIN"
description String
Optional. The user-supplied description of the VPC Flow Logs configuration. Maximum of 512 characters.
filterExpr String
Optional. Export filter used to define which VPC Flow Logs should be logged.
flowSampling Double
Optional. The value of the field must be in (0, 1]. The sampling rate of VPC Flow Logs where 1.0 means all collected logs are reported. Setting the sampling rate to 0.0 is not allowed. If you want to disable VPC Flow Logs, use the state field instead. Default value is 1.0.
interconnectAttachment String
Traffic will be logged from the Interconnect Attachment. Format: projects/{project_id}/regions/{region}/interconnectAttachments/{name}
labels Map<String,String>

Optional. Resource labels to represent user-provided metadata.

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.

metadata String
Optional. Configures whether all, none or a subset of metadata fields should be added to the reported VPC flow logs. Default value is INCLUDE_ALL_METADATA. Possible values: METADATA_UNSPECIFIED INCLUDE_ALL_METADATA EXCLUDE_ALL_METADATA CUSTOM_METADATA
metadataFields List<String>
Optional. Custom metadata fields to include in the reported VPC flow logs. Can only be specified if "metadata" was set to CUSTOM_METADATA.
project Changes to this property will trigger replacement. String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
state String
Optional. The state of the VPC Flow Log configuration. Default value is ENABLED. When creating a new configuration, it must be enabled. Possible
vpnTunnel String
Traffic will be logged from the VPN Tunnel. Format: projects/{project_id}/regions/{region}/vpnTunnels/{name}
location
This property is required.
Changes to this property will trigger replacement.
string
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 networkmanagement.googleapis.com/VpcFlowLogsConfig.
vpcFlowLogsConfigId
This property is required.
Changes to this property will trigger replacement.
string
Required. ID of the VpcFlowLogsConfig.


aggregationInterval string
Optional. The aggregation interval for the logs. Default value is INTERVAL_5_SEC. Possible values: AGGREGATION_INTERVAL_UNSPECIFIED INTERVAL_5_SEC INTERVAL_30_SEC INTERVAL_1_MIN INTERVAL_5_MIN INTERVAL_10_MIN INTERVAL_15_MIN"
description string
Optional. The user-supplied description of the VPC Flow Logs configuration. Maximum of 512 characters.
filterExpr string
Optional. Export filter used to define which VPC Flow Logs should be logged.
flowSampling number
Optional. The value of the field must be in (0, 1]. The sampling rate of VPC Flow Logs where 1.0 means all collected logs are reported. Setting the sampling rate to 0.0 is not allowed. If you want to disable VPC Flow Logs, use the state field instead. Default value is 1.0.
interconnectAttachment string
Traffic will be logged from the Interconnect Attachment. Format: projects/{project_id}/regions/{region}/interconnectAttachments/{name}
labels {[key: string]: string}

Optional. Resource labels to represent user-provided metadata.

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.

metadata string
Optional. Configures whether all, none or a subset of metadata fields should be added to the reported VPC flow logs. Default value is INCLUDE_ALL_METADATA. Possible values: METADATA_UNSPECIFIED INCLUDE_ALL_METADATA EXCLUDE_ALL_METADATA CUSTOM_METADATA
metadataFields string[]
Optional. Custom metadata fields to include in the reported VPC flow logs. Can only be specified if "metadata" was set to CUSTOM_METADATA.
project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
state string
Optional. The state of the VPC Flow Log configuration. Default value is ENABLED. When creating a new configuration, it must be enabled. Possible
vpnTunnel string
Traffic will be logged from the VPN Tunnel. Format: projects/{project_id}/regions/{region}/vpnTunnels/{name}
location
This property is required.
Changes to this property will trigger replacement.
str
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 networkmanagement.googleapis.com/VpcFlowLogsConfig.
vpc_flow_logs_config_id
This property is required.
Changes to this property will trigger replacement.
str
Required. ID of the VpcFlowLogsConfig.


aggregation_interval str
Optional. The aggregation interval for the logs. Default value is INTERVAL_5_SEC. Possible values: AGGREGATION_INTERVAL_UNSPECIFIED INTERVAL_5_SEC INTERVAL_30_SEC INTERVAL_1_MIN INTERVAL_5_MIN INTERVAL_10_MIN INTERVAL_15_MIN"
description str
Optional. The user-supplied description of the VPC Flow Logs configuration. Maximum of 512 characters.
filter_expr str
Optional. Export filter used to define which VPC Flow Logs should be logged.
flow_sampling float
Optional. The value of the field must be in (0, 1]. The sampling rate of VPC Flow Logs where 1.0 means all collected logs are reported. Setting the sampling rate to 0.0 is not allowed. If you want to disable VPC Flow Logs, use the state field instead. Default value is 1.0.
interconnect_attachment str
Traffic will be logged from the Interconnect Attachment. Format: projects/{project_id}/regions/{region}/interconnectAttachments/{name}
labels Mapping[str, str]

Optional. Resource labels to represent user-provided metadata.

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.

metadata str
Optional. Configures whether all, none or a subset of metadata fields should be added to the reported VPC flow logs. Default value is INCLUDE_ALL_METADATA. Possible values: METADATA_UNSPECIFIED INCLUDE_ALL_METADATA EXCLUDE_ALL_METADATA CUSTOM_METADATA
metadata_fields Sequence[str]
Optional. Custom metadata fields to include in the reported VPC flow logs. Can only be specified if "metadata" was set to CUSTOM_METADATA.
project Changes to this property will trigger replacement. str
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
state str
Optional. The state of the VPC Flow Log configuration. Default value is ENABLED. When creating a new configuration, it must be enabled. Possible
vpn_tunnel str
Traffic will be logged from the VPN Tunnel. Format: projects/{project_id}/regions/{region}/vpnTunnels/{name}
location
This property is required.
Changes to this property will trigger replacement.
String
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 networkmanagement.googleapis.com/VpcFlowLogsConfig.
vpcFlowLogsConfigId
This property is required.
Changes to this property will trigger replacement.
String
Required. ID of the VpcFlowLogsConfig.


aggregationInterval String
Optional. The aggregation interval for the logs. Default value is INTERVAL_5_SEC. Possible values: AGGREGATION_INTERVAL_UNSPECIFIED INTERVAL_5_SEC INTERVAL_30_SEC INTERVAL_1_MIN INTERVAL_5_MIN INTERVAL_10_MIN INTERVAL_15_MIN"
description String
Optional. The user-supplied description of the VPC Flow Logs configuration. Maximum of 512 characters.
filterExpr String
Optional. Export filter used to define which VPC Flow Logs should be logged.
flowSampling Number
Optional. The value of the field must be in (0, 1]. The sampling rate of VPC Flow Logs where 1.0 means all collected logs are reported. Setting the sampling rate to 0.0 is not allowed. If you want to disable VPC Flow Logs, use the state field instead. Default value is 1.0.
interconnectAttachment String
Traffic will be logged from the Interconnect Attachment. Format: projects/{project_id}/regions/{region}/interconnectAttachments/{name}
labels Map<String>

Optional. Resource labels to represent user-provided metadata.

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.

metadata String
Optional. Configures whether all, none or a subset of metadata fields should be added to the reported VPC flow logs. Default value is INCLUDE_ALL_METADATA. Possible values: METADATA_UNSPECIFIED INCLUDE_ALL_METADATA EXCLUDE_ALL_METADATA CUSTOM_METADATA
metadataFields List<String>
Optional. Custom metadata fields to include in the reported VPC flow logs. Can only be specified if "metadata" was set to CUSTOM_METADATA.
project Changes to this property will trigger replacement. String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
state String
Optional. The state of the VPC Flow Log configuration. Default value is ENABLED. When creating a new configuration, it must be enabled. Possible
vpnTunnel String
Traffic will be logged from the VPN Tunnel. Format: projects/{project_id}/regions/{region}/vpnTunnels/{name}

Outputs

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

CreateTime string
Output only. The time the config was created.
EffectiveLabels Dictionary<string, string>
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
Id string
The provider-assigned unique ID for this managed resource.
Name string
Identifier. Unique name of the configuration using the form: projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}
PulumiLabels Dictionary<string, string>
The combination of labels configured directly on the resource and default labels configured on the provider.
UpdateTime string
Output only. The time the config was updated.
CreateTime string
Output only. The time the config was created.
EffectiveLabels map[string]string
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
Id string
The provider-assigned unique ID for this managed resource.
Name string
Identifier. Unique name of the configuration using the form: projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}
PulumiLabels map[string]string
The combination of labels configured directly on the resource and default labels configured on the provider.
UpdateTime string
Output only. The time the config was updated.
createTime String
Output only. The time the config was created.
effectiveLabels Map<String,String>
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
id String
The provider-assigned unique ID for this managed resource.
name String
Identifier. Unique name of the configuration using the form: projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}
pulumiLabels Map<String,String>
The combination of labels configured directly on the resource and default labels configured on the provider.
updateTime String
Output only. The time the config was updated.
createTime string
Output only. The time the config was created.
effectiveLabels {[key: string]: string}
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
id string
The provider-assigned unique ID for this managed resource.
name string
Identifier. Unique name of the configuration using the form: projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}
pulumiLabels {[key: string]: string}
The combination of labels configured directly on the resource and default labels configured on the provider.
updateTime string
Output only. The time the config was updated.
create_time str
Output only. The time the config was created.
effective_labels Mapping[str, str]
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
id str
The provider-assigned unique ID for this managed resource.
name str
Identifier. Unique name of the configuration using the form: projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}
pulumi_labels Mapping[str, str]
The combination of labels configured directly on the resource and default labels configured on the provider.
update_time str
Output only. The time the config was updated.
createTime String
Output only. The time the config was created.
effectiveLabels Map<String>
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
id String
The provider-assigned unique ID for this managed resource.
name String
Identifier. Unique name of the configuration using the form: projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}
pulumiLabels Map<String>
The combination of labels configured directly on the resource and default labels configured on the provider.
updateTime String
Output only. The time the config was updated.

Look up Existing VpcFlowLogsConfig Resource

Get an existing VpcFlowLogsConfig 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?: VpcFlowLogsConfigState, opts?: CustomResourceOptions): VpcFlowLogsConfig
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        aggregation_interval: Optional[str] = None,
        create_time: Optional[str] = None,
        description: Optional[str] = None,
        effective_labels: Optional[Mapping[str, str]] = None,
        filter_expr: Optional[str] = None,
        flow_sampling: Optional[float] = None,
        interconnect_attachment: Optional[str] = None,
        labels: Optional[Mapping[str, str]] = None,
        location: Optional[str] = None,
        metadata: Optional[str] = None,
        metadata_fields: Optional[Sequence[str]] = None,
        name: Optional[str] = None,
        project: Optional[str] = None,
        pulumi_labels: Optional[Mapping[str, str]] = None,
        state: Optional[str] = None,
        update_time: Optional[str] = None,
        vpc_flow_logs_config_id: Optional[str] = None,
        vpn_tunnel: Optional[str] = None) -> VpcFlowLogsConfig
func GetVpcFlowLogsConfig(ctx *Context, name string, id IDInput, state *VpcFlowLogsConfigState, opts ...ResourceOption) (*VpcFlowLogsConfig, error)
public static VpcFlowLogsConfig Get(string name, Input<string> id, VpcFlowLogsConfigState? state, CustomResourceOptions? opts = null)
public static VpcFlowLogsConfig get(String name, Output<String> id, VpcFlowLogsConfigState state, CustomResourceOptions options)
resources:  _:    type: gcp:networkmanagement:VpcFlowLogsConfig    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
AggregationInterval string
Optional. The aggregation interval for the logs. Default value is INTERVAL_5_SEC. Possible values: AGGREGATION_INTERVAL_UNSPECIFIED INTERVAL_5_SEC INTERVAL_30_SEC INTERVAL_1_MIN INTERVAL_5_MIN INTERVAL_10_MIN INTERVAL_15_MIN"
CreateTime string
Output only. The time the config was created.
Description string
Optional. The user-supplied description of the VPC Flow Logs configuration. Maximum of 512 characters.
EffectiveLabels Dictionary<string, string>
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
FilterExpr string
Optional. Export filter used to define which VPC Flow Logs should be logged.
FlowSampling double
Optional. The value of the field must be in (0, 1]. The sampling rate of VPC Flow Logs where 1.0 means all collected logs are reported. Setting the sampling rate to 0.0 is not allowed. If you want to disable VPC Flow Logs, use the state field instead. Default value is 1.0.
InterconnectAttachment string
Traffic will be logged from the Interconnect Attachment. Format: projects/{project_id}/regions/{region}/interconnectAttachments/{name}
Labels Dictionary<string, string>

Optional. Resource labels to represent user-provided metadata.

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.

Location Changes to this property will trigger replacement. string
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 networkmanagement.googleapis.com/VpcFlowLogsConfig.
Metadata string
Optional. Configures whether all, none or a subset of metadata fields should be added to the reported VPC flow logs. Default value is INCLUDE_ALL_METADATA. Possible values: METADATA_UNSPECIFIED INCLUDE_ALL_METADATA EXCLUDE_ALL_METADATA CUSTOM_METADATA
MetadataFields List<string>
Optional. Custom metadata fields to include in the reported VPC flow logs. Can only be specified if "metadata" was set to CUSTOM_METADATA.
Name string
Identifier. Unique name of the configuration using the form: projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}
Project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
PulumiLabels Dictionary<string, string>
The combination of labels configured directly on the resource and default labels configured on the provider.
State string
Optional. The state of the VPC Flow Log configuration. Default value is ENABLED. When creating a new configuration, it must be enabled. Possible
UpdateTime string
Output only. The time the config was updated.
VpcFlowLogsConfigId Changes to this property will trigger replacement. string
Required. ID of the VpcFlowLogsConfig.


VpnTunnel string
Traffic will be logged from the VPN Tunnel. Format: projects/{project_id}/regions/{region}/vpnTunnels/{name}
AggregationInterval string
Optional. The aggregation interval for the logs. Default value is INTERVAL_5_SEC. Possible values: AGGREGATION_INTERVAL_UNSPECIFIED INTERVAL_5_SEC INTERVAL_30_SEC INTERVAL_1_MIN INTERVAL_5_MIN INTERVAL_10_MIN INTERVAL_15_MIN"
CreateTime string
Output only. The time the config was created.
Description string
Optional. The user-supplied description of the VPC Flow Logs configuration. Maximum of 512 characters.
EffectiveLabels map[string]string
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
FilterExpr string
Optional. Export filter used to define which VPC Flow Logs should be logged.
FlowSampling float64
Optional. The value of the field must be in (0, 1]. The sampling rate of VPC Flow Logs where 1.0 means all collected logs are reported. Setting the sampling rate to 0.0 is not allowed. If you want to disable VPC Flow Logs, use the state field instead. Default value is 1.0.
InterconnectAttachment string
Traffic will be logged from the Interconnect Attachment. Format: projects/{project_id}/regions/{region}/interconnectAttachments/{name}
Labels map[string]string

Optional. Resource labels to represent user-provided metadata.

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.

Location Changes to this property will trigger replacement. string
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 networkmanagement.googleapis.com/VpcFlowLogsConfig.
Metadata string
Optional. Configures whether all, none or a subset of metadata fields should be added to the reported VPC flow logs. Default value is INCLUDE_ALL_METADATA. Possible values: METADATA_UNSPECIFIED INCLUDE_ALL_METADATA EXCLUDE_ALL_METADATA CUSTOM_METADATA
MetadataFields []string
Optional. Custom metadata fields to include in the reported VPC flow logs. Can only be specified if "metadata" was set to CUSTOM_METADATA.
Name string
Identifier. Unique name of the configuration using the form: projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}
Project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
PulumiLabels map[string]string
The combination of labels configured directly on the resource and default labels configured on the provider.
State string
Optional. The state of the VPC Flow Log configuration. Default value is ENABLED. When creating a new configuration, it must be enabled. Possible
UpdateTime string
Output only. The time the config was updated.
VpcFlowLogsConfigId Changes to this property will trigger replacement. string
Required. ID of the VpcFlowLogsConfig.


VpnTunnel string
Traffic will be logged from the VPN Tunnel. Format: projects/{project_id}/regions/{region}/vpnTunnels/{name}
aggregationInterval String
Optional. The aggregation interval for the logs. Default value is INTERVAL_5_SEC. Possible values: AGGREGATION_INTERVAL_UNSPECIFIED INTERVAL_5_SEC INTERVAL_30_SEC INTERVAL_1_MIN INTERVAL_5_MIN INTERVAL_10_MIN INTERVAL_15_MIN"
createTime String
Output only. The time the config was created.
description String
Optional. The user-supplied description of the VPC Flow Logs configuration. Maximum of 512 characters.
effectiveLabels Map<String,String>
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
filterExpr String
Optional. Export filter used to define which VPC Flow Logs should be logged.
flowSampling Double
Optional. The value of the field must be in (0, 1]. The sampling rate of VPC Flow Logs where 1.0 means all collected logs are reported. Setting the sampling rate to 0.0 is not allowed. If you want to disable VPC Flow Logs, use the state field instead. Default value is 1.0.
interconnectAttachment String
Traffic will be logged from the Interconnect Attachment. Format: projects/{project_id}/regions/{region}/interconnectAttachments/{name}
labels Map<String,String>

Optional. Resource labels to represent user-provided metadata.

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.

location Changes to this property will trigger replacement. String
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 networkmanagement.googleapis.com/VpcFlowLogsConfig.
metadata String
Optional. Configures whether all, none or a subset of metadata fields should be added to the reported VPC flow logs. Default value is INCLUDE_ALL_METADATA. Possible values: METADATA_UNSPECIFIED INCLUDE_ALL_METADATA EXCLUDE_ALL_METADATA CUSTOM_METADATA
metadataFields List<String>
Optional. Custom metadata fields to include in the reported VPC flow logs. Can only be specified if "metadata" was set to CUSTOM_METADATA.
name String
Identifier. Unique name of the configuration using the form: projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}
project Changes to this property will trigger replacement. String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
pulumiLabels Map<String,String>
The combination of labels configured directly on the resource and default labels configured on the provider.
state String
Optional. The state of the VPC Flow Log configuration. Default value is ENABLED. When creating a new configuration, it must be enabled. Possible
updateTime String
Output only. The time the config was updated.
vpcFlowLogsConfigId Changes to this property will trigger replacement. String
Required. ID of the VpcFlowLogsConfig.


vpnTunnel String
Traffic will be logged from the VPN Tunnel. Format: projects/{project_id}/regions/{region}/vpnTunnels/{name}
aggregationInterval string
Optional. The aggregation interval for the logs. Default value is INTERVAL_5_SEC. Possible values: AGGREGATION_INTERVAL_UNSPECIFIED INTERVAL_5_SEC INTERVAL_30_SEC INTERVAL_1_MIN INTERVAL_5_MIN INTERVAL_10_MIN INTERVAL_15_MIN"
createTime string
Output only. The time the config was created.
description string
Optional. The user-supplied description of the VPC Flow Logs configuration. Maximum of 512 characters.
effectiveLabels {[key: string]: string}
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
filterExpr string
Optional. Export filter used to define which VPC Flow Logs should be logged.
flowSampling number
Optional. The value of the field must be in (0, 1]. The sampling rate of VPC Flow Logs where 1.0 means all collected logs are reported. Setting the sampling rate to 0.0 is not allowed. If you want to disable VPC Flow Logs, use the state field instead. Default value is 1.0.
interconnectAttachment string
Traffic will be logged from the Interconnect Attachment. Format: projects/{project_id}/regions/{region}/interconnectAttachments/{name}
labels {[key: string]: string}

Optional. Resource labels to represent user-provided metadata.

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.

location Changes to this property will trigger replacement. string
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 networkmanagement.googleapis.com/VpcFlowLogsConfig.
metadata string
Optional. Configures whether all, none or a subset of metadata fields should be added to the reported VPC flow logs. Default value is INCLUDE_ALL_METADATA. Possible values: METADATA_UNSPECIFIED INCLUDE_ALL_METADATA EXCLUDE_ALL_METADATA CUSTOM_METADATA
metadataFields string[]
Optional. Custom metadata fields to include in the reported VPC flow logs. Can only be specified if "metadata" was set to CUSTOM_METADATA.
name string
Identifier. Unique name of the configuration using the form: projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}
project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
pulumiLabels {[key: string]: string}
The combination of labels configured directly on the resource and default labels configured on the provider.
state string
Optional. The state of the VPC Flow Log configuration. Default value is ENABLED. When creating a new configuration, it must be enabled. Possible
updateTime string
Output only. The time the config was updated.
vpcFlowLogsConfigId Changes to this property will trigger replacement. string
Required. ID of the VpcFlowLogsConfig.


vpnTunnel string
Traffic will be logged from the VPN Tunnel. Format: projects/{project_id}/regions/{region}/vpnTunnels/{name}
aggregation_interval str
Optional. The aggregation interval for the logs. Default value is INTERVAL_5_SEC. Possible values: AGGREGATION_INTERVAL_UNSPECIFIED INTERVAL_5_SEC INTERVAL_30_SEC INTERVAL_1_MIN INTERVAL_5_MIN INTERVAL_10_MIN INTERVAL_15_MIN"
create_time str
Output only. The time the config was created.
description str
Optional. The user-supplied description of the VPC Flow Logs configuration. Maximum of 512 characters.
effective_labels Mapping[str, str]
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
filter_expr str
Optional. Export filter used to define which VPC Flow Logs should be logged.
flow_sampling float
Optional. The value of the field must be in (0, 1]. The sampling rate of VPC Flow Logs where 1.0 means all collected logs are reported. Setting the sampling rate to 0.0 is not allowed. If you want to disable VPC Flow Logs, use the state field instead. Default value is 1.0.
interconnect_attachment str
Traffic will be logged from the Interconnect Attachment. Format: projects/{project_id}/regions/{region}/interconnectAttachments/{name}
labels Mapping[str, str]

Optional. Resource labels to represent user-provided metadata.

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.

location Changes to this property will trigger replacement. str
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 networkmanagement.googleapis.com/VpcFlowLogsConfig.
metadata str
Optional. Configures whether all, none or a subset of metadata fields should be added to the reported VPC flow logs. Default value is INCLUDE_ALL_METADATA. Possible values: METADATA_UNSPECIFIED INCLUDE_ALL_METADATA EXCLUDE_ALL_METADATA CUSTOM_METADATA
metadata_fields Sequence[str]
Optional. Custom metadata fields to include in the reported VPC flow logs. Can only be specified if "metadata" was set to CUSTOM_METADATA.
name str
Identifier. Unique name of the configuration using the form: projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}
project Changes to this property will trigger replacement. str
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
pulumi_labels Mapping[str, str]
The combination of labels configured directly on the resource and default labels configured on the provider.
state str
Optional. The state of the VPC Flow Log configuration. Default value is ENABLED. When creating a new configuration, it must be enabled. Possible
update_time str
Output only. The time the config was updated.
vpc_flow_logs_config_id Changes to this property will trigger replacement. str
Required. ID of the VpcFlowLogsConfig.


vpn_tunnel str
Traffic will be logged from the VPN Tunnel. Format: projects/{project_id}/regions/{region}/vpnTunnels/{name}
aggregationInterval String
Optional. The aggregation interval for the logs. Default value is INTERVAL_5_SEC. Possible values: AGGREGATION_INTERVAL_UNSPECIFIED INTERVAL_5_SEC INTERVAL_30_SEC INTERVAL_1_MIN INTERVAL_5_MIN INTERVAL_10_MIN INTERVAL_15_MIN"
createTime String
Output only. The time the config was created.
description String
Optional. The user-supplied description of the VPC Flow Logs configuration. Maximum of 512 characters.
effectiveLabels Map<String>
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
filterExpr String
Optional. Export filter used to define which VPC Flow Logs should be logged.
flowSampling Number
Optional. The value of the field must be in (0, 1]. The sampling rate of VPC Flow Logs where 1.0 means all collected logs are reported. Setting the sampling rate to 0.0 is not allowed. If you want to disable VPC Flow Logs, use the state field instead. Default value is 1.0.
interconnectAttachment String
Traffic will be logged from the Interconnect Attachment. Format: projects/{project_id}/regions/{region}/interconnectAttachments/{name}
labels Map<String>

Optional. Resource labels to represent user-provided metadata.

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.

location Changes to this property will trigger replacement. String
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 networkmanagement.googleapis.com/VpcFlowLogsConfig.
metadata String
Optional. Configures whether all, none or a subset of metadata fields should be added to the reported VPC flow logs. Default value is INCLUDE_ALL_METADATA. Possible values: METADATA_UNSPECIFIED INCLUDE_ALL_METADATA EXCLUDE_ALL_METADATA CUSTOM_METADATA
metadataFields List<String>
Optional. Custom metadata fields to include in the reported VPC flow logs. Can only be specified if "metadata" was set to CUSTOM_METADATA.
name String
Identifier. Unique name of the configuration using the form: projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}
project Changes to this property will trigger replacement. String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
pulumiLabels Map<String>
The combination of labels configured directly on the resource and default labels configured on the provider.
state String
Optional. The state of the VPC Flow Log configuration. Default value is ENABLED. When creating a new configuration, it must be enabled. Possible
updateTime String
Output only. The time the config was updated.
vpcFlowLogsConfigId Changes to this property will trigger replacement. String
Required. ID of the VpcFlowLogsConfig.


vpnTunnel String
Traffic will be logged from the VPN Tunnel. Format: projects/{project_id}/regions/{region}/vpnTunnels/{name}

Import

VpcFlowLogsConfig can be imported using any of these accepted formats:

  • projects/{{project}}/locations/{{location}}/vpcFlowLogsConfigs/{{vpc_flow_logs_config_id}}

  • {{project}}/{{location}}/{{vpc_flow_logs_config_id}}

  • {{location}}/{{vpc_flow_logs_config_id}}

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

$ pulumi import gcp:networkmanagement/vpcFlowLogsConfig:VpcFlowLogsConfig default projects/{{project}}/locations/{{location}}/vpcFlowLogsConfigs/{{vpc_flow_logs_config_id}}
Copy
$ pulumi import gcp:networkmanagement/vpcFlowLogsConfig:VpcFlowLogsConfig default {{project}}/{{location}}/{{vpc_flow_logs_config_id}}
Copy
$ pulumi import gcp:networkmanagement/vpcFlowLogsConfig:VpcFlowLogsConfig default {{location}}/{{vpc_flow_logs_config_id}}
Copy

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.