com.pulumi.gcp.networkmanagement.kotlin.VpcFlowLogsConfig.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.networkmanagement.kotlin
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.Double
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
/**
* Builder for [VpcFlowLogsConfig].
*/
@PulumiTagMarker
public class VpcFlowLogsConfigResourceBuilder internal constructor() {
public var name: String? = null
public var args: VpcFlowLogsConfigArgs = VpcFlowLogsConfigArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend VpcFlowLogsConfigArgsBuilder.() -> Unit) {
val builder = VpcFlowLogsConfigArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): VpcFlowLogsConfig {
val builtJavaResource =
com.pulumi.gcp.networkmanagement.VpcFlowLogsConfig(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return VpcFlowLogsConfig(builtJavaResource)
}
}
/**
* ## Example Usage
* ### Network Management Vpc Flow Logs Config Interconnect Full
*
* ```typescript
* 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",
* });
* ```
* ```python
* 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")
* ```
* ```csharp
* 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",
* });
* });
* ```
* ```go
* 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
* })
* }
* ```
* ```java
* 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());
* }
* }
* ```
* ```yaml
* 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: {}
* ```
*
* ### Network Management Vpc Flow Logs Config Interconnect Basic
*
* ```typescript
* 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}`),
* });
* ```
* ```python
* 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}"))
* ```
* ```csharp
* 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}";
* }),
* });
* });
* ```
* ```go
* 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
* })
* }
* ```
* ```java
* 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());
* }
* }
* ```
* ```yaml
* 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: {}
* ```
*
* ### Network Management Vpc Flow Logs Config Vpn Basic
*
* ```typescript
* 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,
* });
* ```
* ```python
* 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)
* ```
* ```csharp
* 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,
* });
* });
* ```
* ```go
* 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
* })
* }
* ```
* ```java
* 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());
* }
* }
* ```
* ```yaml
* 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: {}
* ```
*
* ### Network Management Vpc Flow Logs Config Vpn Full
*
* ```typescript
* 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,
* });
* ```
* ```python
* 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)
* ```
* ```csharp
* 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,
* });
* });
* ```
* ```go
* 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
* })
* }
* ```
* ```java
* 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());
* }
* }
* ```
* ```yaml
* 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: {}
* ```
*
* ## 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:
* ```sh
* $ pulumi import gcp:networkmanagement/vpcFlowLogsConfig:VpcFlowLogsConfig default projects/{{project}}/locations/{{location}}/vpcFlowLogsConfigs/{{vpc_flow_logs_config_id}}
* ```
* ```sh
* $ pulumi import gcp:networkmanagement/vpcFlowLogsConfig:VpcFlowLogsConfig default {{project}}/{{location}}/{{vpc_flow_logs_config_id}}
* ```
* ```sh
* $ pulumi import gcp:networkmanagement/vpcFlowLogsConfig:VpcFlowLogsConfig default {{location}}/{{vpc_flow_logs_config_id}}
* ```
*/
public class VpcFlowLogsConfig internal constructor(
override val javaResource: com.pulumi.gcp.networkmanagement.VpcFlowLogsConfig,
) : KotlinCustomResource(javaResource, VpcFlowLogsConfigMapper) {
/**
* 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"
*/
public val aggregationInterval: Output
get() = javaResource.aggregationInterval().applyValue({ args0 -> args0 })
/**
* Output only. The time the config was created.
*/
public val createTime: Output
get() = javaResource.createTime().applyValue({ args0 -> args0 })
/**
* Optional. The user-supplied description of the VPC Flow Logs configuration. Maximum
* of 512 characters.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
*/
public val effectiveLabels: Output
© 2015 - 2025 Weber Informatics LLC | Privacy Policy