google::router

Creates a router.

Example

google::router router-example
    name: "router-example"
    description: "example description"
    network: $(google::compute-network network-example-subnet)
    region: "us-east1"

    router-bgp
        asn: 64512
        advertise-mode: "CUSTOM"

        advertised-groups: [
            "ALL_SUBNETS"
        ]

        ip-range
            range: "192.168.1.0/24"
            description: "example ip range updated"
        end
    end

    router-bgp-peer
        name: "ex-2"
        interface-name: "if-ex-2"
        peer-ip-address: "169.254.0.2"
        peer-asn: 64513
        advertise-mode: "DEFAULT"
        advertised-route-priority: 1
    end

    router-interface
        name: "if-ex-2"
        ip-range: "169.254.0.1/30"
    end

    router-nat
        icmp-idle-timeout-sec: 35

        log-config
            enable: true
            filter: "ALL"
        end

        min-ports-per-vm: 32
        name: "nats-example"
        ip-allocation-option: "AUTO_ONLY"

        source-subnetwork-ip-ranges-to-nat: [
            "LIST_OF_SUBNETWORKS"
        ]

        subnet
            subnet: $(google::compute-subnet subnet-example)

            source-ip-ranges-to-nat: [
                "ALL_IP_RANGES"
            ]
        end
    end
end

Attributes

Attribute Description
name The name of the router. Must be a string starting with a lowercase letter, followed by hyphens, lowercase letters, or digits, except the last character, which cannot be a hyphen. Valid values satisfy the regex: [^[a-z]([-a-z0-9]*[a-z0-9])?$]. (Required)
description The description of the router.
region The region where the router resides. (Required)
network The network to which this router belongs. (Required)
router-bgp subresource

The Border Gateway Protocol (BGP) information specific to the router.

asn
Local BGP Autonomous System Number (ASN). Valid values belong in between 64512 to 65534 for a 16-bit ASN or between 4200000000 to 4294967294 for a 32-bit ASN. (Required)
advertise-mode
The mode to use for advertisement. Valid values are DEFAULT or CUSTOM.
advertised-groups list
The list of prefix groups when advertise-mode is set to CUSTOM. Currently the only supported value is ALL_SUBNETS.
ip-range list subresource

The list of individual IP ranges when advertise-mode is set to CUSTOM.

range
The IP range to advertise. (Required)
description
The description for the IP range.
router-nat list subresource

The list of Network Address Translation (NAT) gateway configuration to be created in this router.

icmp-idle-timeout-sec
The timeout for ICMP connections. Defaults to 30.
log-config subresource

Configuration options for logging on the NAT Gateway.

enable
Indicates whether or not to export logs. Defaults to false.
filter
The desired filtering of logs for NAT gateway. Valid values are ERRORS_ONLY, TRANSLATIONS_ONLY or ALL.
min-ports-per-vm
The minimum number of ports allocated to a VM from this NAT config.
name
The name of the NAT gateway. Must be a string starting with a lowercase letter, followed by hyphens, lowercase letters, or digits, except the last character, which cannot be a hyphen. Valid values satisfy the regex: [^[a-z]([-a-z0-9]*[a-z0-9])?$]. (Required)
ip-allocation-option
The NAT gateway IP allocation option. Valid values are MANUAL_ONLY or AUTO_ONLY.
nat-ip list
The list address resources used for this NAT service.
source-subnetwork-ip-ranges-to-nat
The option for the type of subnet IP ranges. Valid values are ALL_SUBNETWORKS_ALL_IP_RANGES, ALL_SUBNETWORKS_ALL_PRIMARY_IP_RANGES, LIST_OF_SUBNETWORKS or SUBNETWORK_IP_RANGE_TO_NAT_OPTION_UNSPECIFIED.
subnet list subresource

The list of subnets whose traffic should be translated by the NAT gateway.

subnet
The subnet that will use this NAT gateway. (Required)
source-ip-ranges-to-nat list
The options to select which IP ranges of the subnet are allowed to the NAT gateway. Defaults to ALL_IP_RANGES. Valid values are ALL_IP_RANGES, PRIMARY_IP_RANGE, LIST_OF_SECONDARY_IP_RANGES and NAT_IP_RANGE_OPTION_UNSPECIFIED.
secondary-ip-range-names list
A list of secondary IP ranges of the subnet that are allowed to use the NAT gateway.
tcp-established-idle-timeout-sec
The timeout for TCP established connections. Defaults to 1200.
tcp-transitory-idle-timeout-sec
The timeout for TCP transitory connections. Defaults to 30.
udp-idle-timeout-sec
The timeout for UDP connections. Defaults to 30.
router-interface list subresource

The list of router interfaces.

name
The name of the router interface. Must be a string starting with a lowercase letter, followed by hyphens, lowercase letters, or digits, except the last character, which cannot be a hyphen. Valid values satisfy the regex: [^[a-z]([-a-z0-9]*[a-z0-9])?$]. (Required)
linked-vpn-tunnel
The Url of the linked VPN tunnel. Cannot be set if linked-interconnect-attachment is set.
linked-interconnect-attachment
The Url of the linked Interconnect attachment. Cannot be set if linked-vpn-tunnel is set.
ip-range
The IP address and range of the interface.
router-bgp-peer list subresource

The BGP information that must be configured to establish BGP peering.

name
The name of the BGP peer. Must be a string starting with a lowercase letter, followed by hyphens, lowercase letters, or digits, except the last character, which cannot be a hyphen. Valid values satisfy the regex: [^[a-z]([-a-z0-9]*[a-z0-9])?$]. (Required)
interface-name
The name of the interface the BGP peer is associated with.
ip-address
The IP address of the interface.
peer-ip-address
The IP address of the peer BGP interface.
peer-asn
Peer BGP Autonomous System Number (ASN). Valid values belong in between 64512 to 65534 for a 16-bit ASN or between 4200000000 to 4294967294 for a 32-bit ASN. (Required)
advertised-route-priority
The priority of routes advertised to this BGP peer.
advertise-mode
The mode to use for advertisement. Valid values are DEFAULT or CUSTOM.
advertised-groups list
The list of prefix groups when advertise-mode is set to CUSTOM. Valid values are ALL_SUBNETS, ALL_VPC_SUBNETS and ALL_PEER_VPC_SUBNETS.
ip-range list subresource

The list of individual IP ranges when advertise-mode is set to CUSTOM.

range
The IP range to advertise. (Required)
description
The description for the IP range.

Outputs

Attribute Description
self-link The URL of the router.