» google_compute_router_peer

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

resource "google_compute_router_peer" "peer" {
  name                      = "my-router-peer"
  router                    = "my-router"
  region                    = "us-central1"
  peer_ip_address           = "169.254.1.2"
  peer_asn                  = 65513
  advertised_route_priority = 100
  interface                 = "interface-1"
}

» Argument Reference

The following arguments are supported:

  • name - (Required) Name of this BGP peer. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

  • interface - (Required) Name of the interface the BGP peer is associated with.

  • peer_ip_address - (Required) IP address of the BGP interface outside Google Cloud Platform. Only IPv4 is supported.

  • peer_asn - (Required) Peer BGP Autonomous System Number (ASN). Each BGP interface may use a different value.

  • router - (Required) The name of the Cloud Router in which this BgpPeer will be configured.


  • advertised_route_priority - (Optional) The priority of routes advertised to this BGP peer. Where there is more than one matching route of maximum length, the routes with the lowest priority value win.

  • advertise_mode - (Optional) User-specified flag to indicate which mode to use for advertisement. Valid values of this enum field are: DEFAULT, CUSTOM Default value is DEFAULT. Possible values are DEFAULT and CUSTOM.

  • advertised_groups - (Optional) User-specified list of prefix groups to advertise in custom mode, which can take one of the following options:

Note that this field can only be populated if advertiseMode is CUSTOM and overrides the list defined for the router (in the "bgp" message). These groups are advertised in addition to any specified prefixes. Leave this field blank to advertise no custom groups.

  • advertised_ip_ranges - (Optional) User-specified list of individual IP ranges to advertise in custom mode. This field can only be populated if advertiseMode is CUSTOM and is advertised to all peers of the router. These IP ranges will be advertised in addition to any specified groups. Leave this field blank to advertise no custom IP ranges. Structure is documented below.

  • region - (Optional) Region where the router and BgpPeer reside. If it is not provided, the provider region is used.

  • project - (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

The advertised_ip_ranges block supports:

  • range - (Required) The IP range to advertise. The value must be a CIDR-formatted string.

  • description - (Optional) User-specified description for the IP range.

» Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

  • id - an identifier for the resource with format projects/{{project}}/regions/{{region}}/routers/{{router}}/{{name}}

  • ip_address - IP address of the interface inside Google Cloud Platform. Only IPv4 is supported.

  • management_type - The resource that configures and manages this BGP peer.

    • MANAGED_BY_USER is the default value and can be managed by you or other users
    • MANAGED_BY_ATTACHMENT is a BGP peer that is configured and managed by Cloud Interconnect, specifically by an InterconnectAttachment of type PARTNER. Google automatically creates, updates, and deletes this type of BGP peer when the PARTNER InterconnectAttachment is created, updated, or deleted.

» Timeouts

This resource provides the following Timeouts configuration options:

  • create - Default is 10 minutes.
  • update - Default is 10 minutes.
  • delete - Default is 10 minutes.

» Import

RouterBgpPeer can be imported using any of these accepted formats:

$ terraform import google_compute_router_peer.default projects/{{project}}/regions/{{region}}/routers/{{router}}/{{name}}
$ terraform import google_compute_router_peer.default {{project}}/{{region}}/{{router}}/{{name}}
$ terraform import google_compute_router_peer.default {{region}}/{{router}}/{{name}}
$ terraform import google_compute_router_peer.default {{router}}/{{name}}

» User Project Overrides

This resource supports User Project Overrides.