From 4d2e3151cc05b79296213491ebdcc593e43bf650 Mon Sep 17 00:00:00 2001 From: Roberto Jung Drebes Date: Fri, 28 Apr 2017 21:17:08 +0200 Subject: [PATCH] wip: review changes: - config.clientCompute.Routers - peer fields renamed - more consistent logging - better handling of SetId for error handling - function for router locks - test configs as functions - simplify exists logic - use getProject, getRegion logic on acceptance tests - CheckDestroy for peers an interfaces - dynamic router name for tunnel test - extra fields for BgpPeer - resource documentation --- r/compute_router.html.markdown | 151 +++++++++++++++++++++++ r/compute_router_interface.html.markdown | 62 ++++++++++ r/compute_router_peer.html.markdown | 72 +++++++++++ r/compute_vpn_tunnel.html.markdown | 4 + 4 files changed, 289 insertions(+) create mode 100644 r/compute_router.html.markdown create mode 100644 r/compute_router_interface.html.markdown create mode 100644 r/compute_router_peer.html.markdown diff --git a/r/compute_router.html.markdown b/r/compute_router.html.markdown new file mode 100644 index 00000000..73e91565 --- /dev/null +++ b/r/compute_router.html.markdown @@ -0,0 +1,151 @@ +--- +layout: "google" +page_title: "Google: google_compute_router" +sidebar_current: "docs-google-compute-router" +description: |- + Manages a Cloud Router resource. +--- + +# google\_compute\_router + +Manages a Cloud Router resource. For more info, read the +[documentation](https://cloud.google.com/compute/docs/cloudrouter). + +## Example Usage + +```hcl +resource "google_compute_network" "foobar" { + name = "network-1" +} + +resource "google_compute_subnetwork" "foobar" { + name = "subnet-1" + network = "${google_compute_network.foobar.self_link}" + ip_cidr_range = "10.0.0.0/16" + region = "us-central1" +} + +resource "google_compute_address" "foobar" { + name = "vpn-gateway-1-address" + region = "${google_compute_subnetwork.foobar.region}" +} + +resource "google_compute_vpn_gateway" "foobar" { + name = "vpn-gateway-1" + network = "${google_compute_network.foobar.self_link}" + region = "${google_compute_subnetwork.foobar.region}" +} + +resource "google_compute_forwarding_rule" "foobar_esp" { + name = "vpn-gw-1-esp" + region = "${google_compute_vpn_gateway.foobar.region}" + ip_protocol = "ESP" + ip_address = "${google_compute_address.foobar.address}" + target = "${google_compute_vpn_gateway.foobar.self_link}" +} + +resource "google_compute_forwarding_rule" "foobar_udp500" { + name = "vpn-gw-1-udp-500" + region = "${google_compute_forwarding_rule.foobar_esp.region}" + ip_protocol = "UDP" + port_range = "500-500" + ip_address = "${google_compute_address.foobar.address}" + target = "${google_compute_vpn_gateway.foobar.self_link}" +} + +resource "google_compute_forwarding_rule" "foobar_udp4500" { + name = "vpn-gw-1-udp-4500" + region = "${google_compute_forwarding_rule.foobar_udp500.region}" + ip_protocol = "UDP" + port_range = "4500-4500" + ip_address = "${google_compute_address.foobar.address}" + target = "${google_compute_vpn_gateway.foobar.self_link}" +} + +resource "google_compute_router" "foobar" { + name = "router-1" + region = "${google_compute_forwarding_rule.foobar_udp500.region}" + network = "${google_compute_network.foobar.self_link}" + + bgp { + asn = 64512 + } +} + +resource "google_compute_vpn_tunnel" "foobar" { + name = "vpn-tunnel-1" + region = "${google_compute_forwarding_rule.foobar_udp4500.region}" + target_vpn_gateway = "${google_compute_vpn_gateway.foobar.self_link}" + shared_secret = "unguessable" + peer_ip = "8.8.8.8" + router = "${google_compute_router.foobar.name}" +} + +resource "google_compute_router_interface" "foobar" { + name = "interface-1" + router = "${google_compute_router.foobar.name}" + region = "${google_compute_router.foobar.region}" + ip_range = "169.254.1.1/30" + vpn_tunnel = "${google_compute_vpn_tunnel.foobar.name}" +} + +resource "google_compute_router_peer" "foobar" { + name = "peer-1" + router = "${google_compute_router.foobar.name}" + region = "${google_compute_router.foobar.region}" + peer_ip_address = "169.254.1.2" + peer_asn = 65513 + advertised_route_priority = 100 + interface = "${google_compute_router_interface.foobar.name}" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) A unique name for the router, required by GCE. Changing + this forces a new router to be created. + +* `network` - (Required) The name or resource link to the network this Cloud Router + will use to learn and announce routes. Changing this forces a new router to be created. + +* `bgp` - (Required) BGP information specific to this router. + Changing this forces a new router to be created. + Structure is documented below. + +- - - + +* `description` - (Optional) A description of the resource. + Changing this forces a new router to be created. + +* `project` - (Optional) The project in which the resource belongs. If it + is not provided, the provider project is used. + Changing this forces a new router to be created. + +* `region` - (Optional) The region this router should sit in. If not specified, + the project region will be used. Changing this forces a new router to be + created. + +- - - + +The `bgp` block supports: + +* `asn` - (Required) Local BGP Autonomous System Number (ASN). Must be an + RFC6996 private ASN. + +## Attributes Reference + +In addition to the arguments listed above, the following computed attributes are +exported: + +* `self_link` - The URI of the created resource. + +## Import + +Routers can be imported using the `region` and `name`, e.g. + +``` +$ terraform import google_compute_router.router-1 us-central1/router-1 +``` + diff --git a/r/compute_router_interface.html.markdown b/r/compute_router_interface.html.markdown new file mode 100644 index 00000000..5c3a17b5 --- /dev/null +++ b/r/compute_router_interface.html.markdown @@ -0,0 +1,62 @@ +--- +layout: "google" +page_title: "Google: google_compute_router_interface" +sidebar_current: "docs-google-compute-router-interface" +description: |- + Manages a Cloud Router interface. +--- + +# google\_compute\_router_interface + +Manages a Cloud Router interface. For more info, read the +[documentation](https://cloud.google.com/compute/docs/cloudrouter). + +## Example Usage + +```hcl +resource "google_compute_router_interface" "foobar" { + name = "interface-1" + router = "router-1" + region = "us-central1" + ip_range = "169.254.1.1/30" + vpn_tunnel = "tunnel-1" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) A unique name for the interface, required by GCE. Changing + this forces a new interface to be created. + +* `router` - (Required) The name of the router this interface will be attached to. + Changing this forces a new interface to be created. + +* `vpn_tunnel` - (Required) The name or resource link to the VPN tunnel this + interface will be linked to. Changing this forces a new interface to be created. + +- - - + +* `ip_range` - (Optional) IP address and range of the interface. The IP range must be + in the RFC3927 link-local IP space. Changing this forces a new interface to be created. + +* `project` - (Optional) The project in which this interface's router belongs. If it + is not provided, the provider project is used. Changing this forces a new interface to be created. + +* `region` - (Optional) The region this interface's router sits in. If not specified, + the project region will be used. Changing this forces a new interface to be + created. + +## Attributes Reference + +Only the arguments listed above are exposed as attributes. + +## Import + +Router interfaces can be imported using the `region`, `router` and `name`, e.g. + +``` +$ terraform import google_compute_router_interface.interface-1 us-central1/router-1/interface-1 +``` + diff --git a/r/compute_router_peer.html.markdown b/r/compute_router_peer.html.markdown new file mode 100644 index 00000000..d5305be4 --- /dev/null +++ b/r/compute_router_peer.html.markdown @@ -0,0 +1,72 @@ +--- +layout: "google" +page_title: "Google: google_compute_router_peer" +sidebar_current: "docs-google-compute-router-peer" +description: |- + Manages a Cloud Router BGP peer. +--- + +# google\_compute\_router + +Manages a Cloud Router BGP peer. For more info, read the +[documentation](https://cloud.google.com/compute/docs/cloudrouter). + +## Example Usage + +```hcl +resource "google_compute_router_peer" "foobar" { + name = "peer-1" + router = "router-1" + 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) A unique name for BGP peer, required by GCE. Changing + this forces a new peer to be created. + +* `router` - (Required) The name of the router in which this BGP peer will be configured. + Changing this forces a new peer to be created. + +* `interface` - (Required) The name of the interface the BGP peer is associated with. + Changing this forces a new peer to be created. + +* `peer_ip_address` - (Required) IP address of the BGP interface outside Google Cloud. + Changing this forces a new peer to be created. + +* `peer_asn` - (Required) Peer BGP Autonomous System Number (ASN). + Changing this forces a new peer to be created. + +- - - + +* `advertised_route_priority` - (Optional) The priority of routes advertised to this BGP peer. + Changing this forces a new peer to be created. + +* `project` - (Optional) The project in which this peer's router belongs. If it + is not provided, the provider project is used. Changing this forces a new peer to be created. + +* `region` - (Optional) The region this peer's router sits in. If not specified, + the project region will be used. Changing this forces a new peer to be + created. + +## Attributes Reference + +In addition to the arguments listed above, the following computed attributes are +exported: + +* `ip_address` - IP address of the interface inside Google Cloud Platform. + +## Import + +Router BGP peers can be imported using the `region`, `router` and `name`, e.g. + +``` +$ terraform import google_compute_router_peer.peer-1 us-central1/router-1/peer-1 +``` diff --git a/r/compute_vpn_tunnel.html.markdown b/r/compute_vpn_tunnel.html.markdown index 05952788..0fa53c89 100644 --- a/r/compute_vpn_tunnel.html.markdown +++ b/r/compute_vpn_tunnel.html.markdown @@ -120,6 +120,10 @@ The following arguments are supported: custom subnetted network. Refer to Google documentation for more information. +* `router` - (Optional) Name of a Cloud Router in the same region + to be used for dynamic routing. Refer to Google documentation for more + information. + * `project` - (Optional) The project in which the resource belongs. If it is not provided, the provider project is used.