pulumi_wasm_providers_gcp_mini::compute

Module router_peer

source
Expand description

BGP information that must be configured into the routing stack to establish BGP peering. This information must specify the peer ASN and either the interface name, IP address, or peer IP address. Please refer to RFC4273.

To get more information about RouterBgpPeer, see:

§Example Usage

§Router Peer Basic

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let peer = router_peer::create(
        "peer",
        RouterPeerArgs::builder()
            .advertised_route_priority(100)
            .interface("interface-1")
            .name("my-router-peer")
            .peer_asn(65513)
            .region("us-central1")
            .router("my-router")
            .build_struct(),
    );
}

§Router Peer Disabled

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let peer = router_peer::create(
        "peer",
        RouterPeerArgs::builder()
            .advertised_route_priority(100)
            .enable(false)
            .interface("interface-1")
            .name("my-router-peer")
            .peer_asn(65513)
            .peer_ip_address("169.254.1.2")
            .region("us-central1")
            .router("my-router")
            .build_struct(),
    );
}

§Router Peer Bfd

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let peer = router_peer::create(
        "peer",
        RouterPeerArgs::builder()
            .advertised_route_priority(100)
            .bfd(
                RouterPeerBfd::builder()
                    .minReceiveInterval(1000)
                    .minTransmitInterval(1000)
                    .multiplier(5)
                    .sessionInitializationMode("ACTIVE")
                    .build_struct(),
            )
            .interface("interface-1")
            .name("my-router-peer")
            .peer_asn(65513)
            .peer_ip_address("169.254.1.2")
            .region("us-central1")
            .router("my-router")
            .build_struct(),
    );
}

§Router Peer Router Appliance

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let addrIntf = address::create(
        "addrIntf",
        AddressArgs::builder()
            .address_type("INTERNAL")
            .name("my-router-addr-intf")
            .region("${subnetwork.region}")
            .subnetwork("${subnetwork.id}")
            .build_struct(),
    );
    let addrIntfRedundant = address::create(
        "addrIntfRedundant",
        AddressArgs::builder()
            .address_type("INTERNAL")
            .name("my-router-addr-intf-red")
            .region("${subnetwork.region}")
            .subnetwork("${subnetwork.id}")
            .build_struct(),
    );
    let addrPeer = address::create(
        "addrPeer",
        AddressArgs::builder()
            .address_type("INTERNAL")
            .name("my-router-addr-peer")
            .region("${subnetwork.region}")
            .subnetwork("${subnetwork.id}")
            .build_struct(),
    );
    let hub = hub::create(
        "hub",
        HubArgs::builder().name("my-router-hub").build_struct(),
    );
    let instance = instance::create(
        "instance",
        InstanceArgs::builder()
            .boot_disk(
                InstanceBootDisk::builder()
                    .initializeParams(
                        InstanceBootDiskInitializeParams::builder()
                            .image("debian-cloud/debian-11")
                            .build_struct(),
                    )
                    .build_struct(),
            )
            .can_ip_forward(true)
            .machine_type("e2-medium")
            .name("router-appliance")
            .network_interfaces(
                vec![
                    InstanceNetworkInterface::builder().networkIp("${addrPeer.address}")
                    .subnetwork("${subnetwork.selfLink}").build_struct(),
                ],
            )
            .zone("us-central1-a")
            .build_struct(),
    );
    let interface = router_interface::create(
        "interface",
        RouterInterfaceArgs::builder()
            .name("my-router-intf")
            .private_ip_address("${addrIntf.address}")
            .redundant_interface("${interfaceRedundant.name}")
            .region("${router.region}")
            .router("${router.name}")
            .subnetwork("${subnetwork.selfLink}")
            .build_struct(),
    );
    let interfaceRedundant = router_interface::create(
        "interfaceRedundant",
        RouterInterfaceArgs::builder()
            .name("my-router-intf-red")
            .private_ip_address("${addrIntfRedundant.address}")
            .region("${router.region}")
            .router("${router.name}")
            .subnetwork("${subnetwork.selfLink}")
            .build_struct(),
    );
    let network = network::create(
        "network",
        NetworkArgs::builder()
            .auto_create_subnetworks(false)
            .name("my-router-net")
            .build_struct(),
    );
    let peer = router_peer::create(
        "peer",
        RouterPeerArgs::builder()
            .interface("${interface.name}")
            .name("my-router-peer")
            .peer_asn(65513)
            .peer_ip_address("${addrPeer.address}")
            .region("${router.region}")
            .router("${router.name}")
            .router_appliance_instance("${instance.selfLink}")
            .build_struct(),
    );
    let router = router::create(
        "router",
        RouterArgs::builder()
            .bgp(RouterBgp::builder().asn(64514).build_struct())
            .name("my-router-router")
            .network("${network.selfLink}")
            .region("${subnetwork.region}")
            .build_struct(),
    );
    let spoke = spoke::create(
        "spoke",
        SpokeArgs::builder()
            .hub("${hub.id}")
            .linked_router_appliance_instances(
                SpokeLinkedRouterApplianceInstances::builder()
                    .instances(
                        vec![
                            SpokeLinkedRouterApplianceInstancesInstance::builder()
                            .ipAddress("${addrPeer.address}")
                            .virtualMachine("${instance.selfLink}").build_struct(),
                        ],
                    )
                    .siteToSiteDataTransfer(false)
                    .build_struct(),
            )
            .location("${subnetwork.region}")
            .name("my-router-spoke")
            .build_struct(),
    );
    let subnetwork = subnetwork::create(
        "subnetwork",
        SubnetworkArgs::builder()
            .ip_cidr_range("10.0.0.0/16")
            .name("my-router-sub")
            .network("${network.selfLink}")
            .region("us-central1")
            .build_struct(),
    );
}

§Router Peer Md5 Authentication Key

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let foobar = router_peer::create(
        "foobar",
        RouterPeerArgs::builder()
            .advertised_route_priority(100)
            .interface("${foobarGoogleComputeRouterInterface.name}")
            .md_5_authentication_key(
                RouterPeerMd5AuthenticationKey::builder()
                    .key("%s-peer-key-value")
                    .name("%s-peer-key")
                    .build_struct(),
            )
            .name("%s-peer")
            .peer_asn(65515)
            .peer_ip_address("169.254.3.2")
            .region("${foobarGoogleComputeRouter.region}")
            .router("${foobarGoogleComputeRouter.name}")
            .build_struct(),
    );
}

§Router Peer Export And Import Policies

resources:
  network:
    type: gcp:compute:Network
    properties:
      name: my-router-net
      autoCreateSubnetworks: false
  subnetwork:
    type: gcp:compute:Subnetwork
    properties:
      name: my-router-subnet
      network: ${network.selfLink}
      ipCidrRange: 10.0.0.0/16
      region: us-central1
  address:
    type: gcp:compute:Address
    properties:
      name: my-router
      region: ${subnetwork.region}
  vpnGateway:
    type: gcp:compute:HaVpnGateway
    name: vpn_gateway
    properties:
      name: my-router-gateway
      network: ${network.selfLink}
      region: ${subnetwork.region}
  externalGateway:
    type: gcp:compute:ExternalVpnGateway
    name: external_gateway
    properties:
      name: my-router-external-gateway
      redundancyType: SINGLE_IP_INTERNALLY_REDUNDANT
      description: An externally managed VPN gateway
      interfaces:
        - id: 0
          ipAddress: 8.8.8.8
  router:
    type: gcp:compute:Router
    properties:
      name: my-router
      region: ${subnetwork.region}
      network: ${network.selfLink}
      bgp:
        asn: 64514
  vpnTunnel:
    type: gcp:compute:VPNTunnel
    name: vpn_tunnel
    properties:
      name: my-router
      region: ${subnetwork.region}
      vpnGateway: ${vpnGateway.id}
      peerExternalGateway: ${externalGateway.id}
      peerExternalGatewayInterface: 0
      sharedSecret: unguessable
      router: ${router.name}
      vpnGatewayInterface: 0
  routerInterface:
    type: gcp:compute:RouterInterface
    name: router_interface
    properties:
      name: my-router
      router: ${router.name}
      region: ${router.region}
      vpnTunnel: ${vpnTunnel.name}
  rp-export:
    type: gcp:compute:RouterRoutePolicy
    properties:
      name: my-router-rp-export
      router: ${router.name}
      region: ${router.region}
      type: ROUTE_POLICY_TYPE_EXPORT
      terms:
        - priority: 2
          match:
            expression: destination == '10.0.0.0/12'
            title: export_expression
            description: acceptance expression for export
          actions:
            - expression: accept()
    options:
      dependsOn:
        - ${routerInterface}
  rp-import:
    type: gcp:compute:RouterRoutePolicy
    properties:
      name: my-router-rp-import
      router: ${router.name}
      region: ${router.region}
      type: ROUTE_POLICY_TYPE_IMPORT
      terms:
        - priority: 1
          match:
            expression: destination == '10.0.0.0/12'
            title: import_expression
            description: acceptance expression for import
          actions:
            - expression: accept()
    options:
      dependsOn:
        - ${routerInterface}
        - ${["rp-export"]}
  routerPeer:
    type: gcp:compute:RouterPeer
    name: router_peer
    properties:
      name: my-router-peer
      router: ${router.name}
      region: ${router.region}
      peerAsn: 65515
      advertisedRoutePriority: 100
      interface: ${routerInterface.name}
      md5AuthenticationKey:
        name: my-router-peer-key
        key: my-router-peer-key-value
      importPolicies:
        - ${["rp-import"].name}
      exportPolicies:
        - ${["rp-export"].name}
    options:
      dependsOn:
        - ${["rp-export"]}
        - ${["rp-import"]}
        - ${routerInterface}

§Import

RouterBgpPeer can be imported using any of these accepted formats:

  • projects/{{project}}/regions/{{region}}/routers/{{router}}/{{name}}

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

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

  • {{router}}/{{name}}

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

$ pulumi import gcp:compute/routerPeer:RouterPeer default projects/{{project}}/regions/{{region}}/routers/{{router}}/{{name}}
$ pulumi import gcp:compute/routerPeer:RouterPeer default {{project}}/{{region}}/{{router}}/{{name}}
$ pulumi import gcp:compute/routerPeer:RouterPeer default {{region}}/{{router}}/{{name}}
$ pulumi import gcp:compute/routerPeer:RouterPeer default {{router}}/{{name}}

Structs§

Functions§

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