pulumi_wasm_providers_gcp_mini::compute

Module external_vpn_gateway

source
Expand description

Represents a VPN gateway managed outside of GCP.

To get more information about ExternalVpnGateway, see:

§Example Usage

§External Vpn Gateway

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let externalGateway = external_vpn_gateway::create(
        "externalGateway",
        ExternalVpnGatewayArgs::builder()
            .description("An externally managed VPN gateway")
            .interfaces(
                vec![
                    ExternalVpnGatewayInterface::builder().id(0).ipAddress("8.8.8.8")
                    .build_struct(),
                ],
            )
            .name("external-gateway")
            .redundancy_type("SINGLE_IP_INTERNALLY_REDUNDANT")
            .build_struct(),
    );
    let haGateway = ha_vpn_gateway::create(
        "haGateway",
        HaVpnGatewayArgs::builder()
            .name("ha-vpn")
            .network("${network.id}")
            .region("us-central1")
            .build_struct(),
    );
    let network = network::create(
        "network",
        NetworkArgs::builder()
            .auto_create_subnetworks(false)
            .name("network-1")
            .routing_mode("GLOBAL")
            .build_struct(),
    );
    let networkSubnet1 = subnetwork::create(
        "networkSubnet1",
        SubnetworkArgs::builder()
            .ip_cidr_range("10.0.1.0/24")
            .name("ha-vpn-subnet-1")
            .network("${network.id}")
            .region("us-central1")
            .build_struct(),
    );
    let networkSubnet2 = subnetwork::create(
        "networkSubnet2",
        SubnetworkArgs::builder()
            .ip_cidr_range("10.0.2.0/24")
            .name("ha-vpn-subnet-2")
            .network("${network.id}")
            .region("us-west1")
            .build_struct(),
    );
    let router1 = router::create(
        "router1",
        RouterArgs::builder()
            .bgp(RouterBgp::builder().asn(64514).build_struct())
            .name("ha-vpn-router1")
            .network("${network.name}")
            .build_struct(),
    );
    let router1Interface1 = router_interface::create(
        "router1Interface1",
        RouterInterfaceArgs::builder()
            .ip_range("169.254.0.1/30")
            .name("router1-interface1")
            .region("us-central1")
            .router("${router1.name}")
            .vpn_tunnel("${tunnel1.name}")
            .build_struct(),
    );
    let router1Interface2 = router_interface::create(
        "router1Interface2",
        RouterInterfaceArgs::builder()
            .ip_range("169.254.1.1/30")
            .name("router1-interface2")
            .region("us-central1")
            .router("${router1.name}")
            .vpn_tunnel("${tunnel2.name}")
            .build_struct(),
    );
    let router1Peer1 = router_peer::create(
        "router1Peer1",
        RouterPeerArgs::builder()
            .advertised_route_priority(100)
            .interface("${router1Interface1.name}")
            .name("router1-peer1")
            .peer_asn(64515)
            .peer_ip_address("169.254.0.2")
            .region("us-central1")
            .router("${router1.name}")
            .build_struct(),
    );
    let router1Peer2 = router_peer::create(
        "router1Peer2",
        RouterPeerArgs::builder()
            .advertised_route_priority(100)
            .interface("${router1Interface2.name}")
            .name("router1-peer2")
            .peer_asn(64515)
            .peer_ip_address("169.254.1.2")
            .region("us-central1")
            .router("${router1.name}")
            .build_struct(),
    );
    let tunnel1 = vpn_tunnel::create(
        "tunnel1",
        VpnTunnelArgs::builder()
            .name("ha-vpn-tunnel1")
            .peer_external_gateway("${externalGateway.id}")
            .peer_external_gateway_interface(0)
            .region("us-central1")
            .router("${router1.id}")
            .shared_secret("a secret message")
            .vpn_gateway("${haGateway.id}")
            .vpn_gateway_interface(0)
            .build_struct(),
    );
    let tunnel2 = vpn_tunnel::create(
        "tunnel2",
        VpnTunnelArgs::builder()
            .name("ha-vpn-tunnel2")
            .peer_external_gateway("${externalGateway.id}")
            .peer_external_gateway_interface(0)
            .region("us-central1")
            .router(" ${router1.id}")
            .shared_secret("a secret message")
            .vpn_gateway("${haGateway.id}")
            .vpn_gateway_interface(1)
            .build_struct(),
    );
}

§Import

ExternalVpnGateway can be imported using any of these accepted formats:

  • projects/{{project}}/global/externalVpnGateways/{{name}}

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

  • {{name}}

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

$ pulumi import gcp:compute/externalVpnGateway:ExternalVpnGateway default projects/{{project}}/global/externalVpnGateways/{{name}}
$ pulumi import gcp:compute/externalVpnGateway:ExternalVpnGateway default {{project}}/{{name}}
$ pulumi import gcp:compute/externalVpnGateway:ExternalVpnGateway default {{name}}

Structs§

Functions§

  • Registers a new resource with the given unique name and arguments