pulumi_wasm_providers_gcp_mini::compute

Module vpn_gateway

source
Expand description

Represents a VPN gateway running in GCP. This virtual device is managed by Google, but used only by you.

To get more information about VpnGateway, see:

Warning: Classic VPN is deprecating certain functionality on October 31, 2021. For more information, see the Classic VPN partial deprecation page.

§Example Usage

§Target Vpn Gateway Basic

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let frEsp = forwarding_rule::create(
        "frEsp",
        ForwardingRuleArgs::builder()
            .ip_address("${vpnStaticIp.address}")
            .ip_protocol("ESP")
            .name("fr-esp")
            .target("${targetGateway.id}")
            .build_struct(),
    );
    let frUdp4500 = forwarding_rule::create(
        "frUdp4500",
        ForwardingRuleArgs::builder()
            .ip_address("${vpnStaticIp.address}")
            .ip_protocol("UDP")
            .name("fr-udp4500")
            .port_range("4500")
            .target("${targetGateway.id}")
            .build_struct(),
    );
    let frUdp500 = forwarding_rule::create(
        "frUdp500",
        ForwardingRuleArgs::builder()
            .ip_address("${vpnStaticIp.address}")
            .ip_protocol("UDP")
            .name("fr-udp500")
            .port_range("500")
            .target("${targetGateway.id}")
            .build_struct(),
    );
    let network1 = network::create(
        "network1",
        NetworkArgs::builder().name("network-1").build_struct(),
    );
    let route1 = route::create(
        "route1",
        RouteArgs::builder()
            .dest_range("15.0.0.0/24")
            .name("route1")
            .network("${network1.name}")
            .next_hop_vpn_tunnel("${tunnel1.id}")
            .priority(1000)
            .build_struct(),
    );
    let targetGateway = vpn_gateway::create(
        "targetGateway",
        VpnGatewayArgs::builder().name("vpn-1").network("${network1.id}").build_struct(),
    );
    let tunnel1 = vpn_tunnel::create(
        "tunnel1",
        VpnTunnelArgs::builder()
            .name("tunnel1")
            .peer_ip("15.0.0.120")
            .shared_secret("a secret message")
            .target_vpn_gateway("${targetGateway.id}")
            .build_struct(),
    );
    let vpnStaticIp = address::create(
        "vpnStaticIp",
        AddressArgs::builder().name("vpn-static-ip").build_struct(),
    );
}

§Import

VpnGateway can be imported using any of these accepted formats:

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

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

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

  • {{name}}

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

$ pulumi import gcp:compute/vPNGateway:VPNGateway default projects/{{project}}/regions/{{region}}/targetVpnGateways/{{name}}
$ pulumi import gcp:compute/vPNGateway:VPNGateway default {{project}}/{{region}}/{{name}}
$ pulumi import gcp:compute/vPNGateway:VPNGateway default {{region}}/{{name}}
$ pulumi import gcp:compute/vPNGateway:VPNGateway default {{name}}

Structs§

Functions§

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