forked from hashicorp/terraform-provider-google
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Autogenerate router resource. Also adds update support and a few new …
…fields. (hashicorp#1723)
- Loading branch information
1 parent
2785c63
commit 7243785
Showing
2 changed files
with
115 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,152 +1,162 @@ | ||
--- | ||
# ---------------------------------------------------------------------------- | ||
# | ||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** | ||
# | ||
# ---------------------------------------------------------------------------- | ||
# | ||
# This file is automatically generated by Magic Modules and manual | ||
# changes will be clobbered when the file is regenerated. | ||
# | ||
# Please read more about how to change this file in | ||
# .github/CONTRIBUTING.md. | ||
# | ||
# ---------------------------------------------------------------------------- | ||
layout: "google" | ||
page_title: "Google: google_compute_router" | ||
sidebar_current: "docs-google-compute-router-x" | ||
sidebar_current: "docs-google-compute-router" | ||
description: |- | ||
Manages a Cloud Router resource. | ||
Represents a Router resource. | ||
--- | ||
|
||
# google\_compute\_router | ||
|
||
Manages a Cloud Router resource. For more information see | ||
[the official documentation](https://cloud.google.com/compute/docs/cloudrouter) | ||
and | ||
[API](https://cloud.google.com/compute/docs/reference/latest/routers). | ||
Represents a Router resource. | ||
|
||
To get more information about Router, see: | ||
|
||
* [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/routers) | ||
* How-to Guides | ||
* [Google Cloud Router](https://cloud.google.com/router/docs/) | ||
|
||
## 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}" | ||
name = "my-network" | ||
auto_create_subnetworks = false | ||
} | ||
resource "google_compute_router" "foobar" { | ||
name = "router-1" | ||
region = "${google_compute_forwarding_rule.foobar_udp500.region}" | ||
network = "${google_compute_network.foobar.self_link}" | ||
name = "my-router" | ||
network = "${google_compute_network.foobar.name}" | ||
bgp { | ||
asn = 64512 | ||
asn = 64514 | ||
advertise_mode = "CUSTOM" | ||
advertised_groups = ["ALL_SUBNETS"] | ||
advertised_ip_ranges { | ||
range = "1.2.3.4" | ||
} | ||
advertised_ip_ranges { | ||
range = "6.7.0.0/16" | ||
} | ||
} | ||
} | ||
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. | ||
* `name` - | ||
(Required) | ||
Name of the resource. 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. | ||
|
||
* `bgp` - (Required) BGP information specific to this router. | ||
Changing this forces a new router to be created. | ||
Structure is documented below. | ||
* `network` - | ||
(Required) | ||
A reference to the network to which this router belongs. | ||
|
||
- - - | ||
|
||
* `description` - (Optional) A description of the resource. | ||
Changing this forces a new router to be created. | ||
|
||
* `project` - (Optional) The ID of 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. | ||
* `description` - | ||
(Optional) | ||
An optional description of this resource. | ||
|
||
* `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. | ||
* `bgp` - | ||
(Optional) | ||
BGP information specific to this router. Structure is documented below. | ||
|
||
- - - | ||
* `region` - | ||
(Optional) | ||
Region where the router resides. | ||
* `project` (Optional) The ID of the project in which the resource belongs. | ||
If it is not provided, the provider project is used. | ||
|
||
The `bgp` block supports: | ||
|
||
* `asn` - (Required) Local BGP Autonomous System Number (ASN). Must be an | ||
RFC6996 private ASN. | ||
* `asn` - | ||
(Required) | ||
Local BGP Autonomous System Number (ASN). Must be an RFC6996 | ||
private ASN, either 16-bit or 32-bit. The value will be fixed for | ||
this router resource. All VPN tunnels that link to this router | ||
will have the same local ASN. | ||
|
||
* `advertise_mode` - | ||
(Optional) | ||
User-specified flag to indicate which mode to use for advertisement. | ||
Valid values of this enum field are: DEFAULT, CUSTOM | ||
|
||
* `advertised_groups` - | ||
(Optional) | ||
User-specified list of prefix groups 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 groups will be | ||
advertised in addition to any specified prefixes. Leave this field | ||
blank to advertise no custom groups. | ||
This enum field has the one valid value: ALL_SUBNETS | ||
|
||
* `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. | ||
The `advertised_ip_ranges` block supports: | ||
|
||
* `range` - | ||
(Optional) | ||
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: | ||
In addition to the arguments listed above, the following computed attributes are exported: | ||
|
||
|
||
* `creation_timestamp` - | ||
Creation timestamp in RFC3339 text format. | ||
* `self_link` - The URI of the created resource. | ||
|
||
|
||
## Timeouts | ||
|
||
This resource provides the following | ||
[Timeouts](/docs/configuration/resources.html#timeouts) configuration options: | ||
|
||
- `create` - Default is 4 minutes. | ||
- `update` - Default is 4 minutes. | ||
- `delete` - Default is 4 minutes. | ||
|
||
## Import | ||
|
||
Routers can be imported using the `region` and `name`, e.g. | ||
Router can be imported using any of these accepted formats: | ||
|
||
``` | ||
$ terraform import google_compute_router.foobar us-central1/router-1 | ||
$ terraform import google_compute_router.default projects/{{project}}/regions/{{region}}/routers/{{name}} | ||
$ terraform import google_compute_router.default {{region}}/{{name}} | ||
$ terraform import google_compute_router.default {{project}}/{{region}}/{{name}} | ||
$ terraform import google_compute_router.default {{name}} | ||
``` |