Google Compute Engine Router

This page shows how to write Terraform for Compute Engine Router and write them securely.

google_compute_router (Terraform)

The Router in Compute Engine can be configured in Terraform with the resource name google_compute_router. The following sections describe 3 examples of how to use the resource and its parameters.

Example Usage from GitHub

cloudRouter.tf#L2
resource "google_compute_router" "nat-router-usce1" {
    name = "nat-router-usce1"
    network = "default"
    region = "us-central1"

}
routers.tf#L3
resource "google_compute_router" "router-subnetwork-1" {
  name    = "router-subnetwork-1"
  region  = google_compute_subnetwork.subnetwork-1.region
  network = google_compute_network.shared-vpc.id

  depends_on = [
network.tf#L17
resource "google_compute_router" "mgmt_router" {
  name    = "mgmt-router"
  region  = var.region
  network = google_compute_network.mgmt_vpc.self_link

  bgp {

Parameters

  • creation_timestamp requiredcomputed - string
    • Creation timestamp in RFC3339 text format.

  • description optional - string
    • An optional description of this resource.

  • id optionalcomputed - string
  • name required - string
    • 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?' 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.

  • network required - string
    • A reference to the network to which this router belongs.

  • project optionalcomputed - string
  • region optionalcomputed - string
    • Region where the router resides.

  • self_link requiredcomputed - string

Explanation in Terraform Registry

Represents a Router resource. To get more information about Router, see:

Frequently asked questions

What is Google Compute Engine Router?

Google Compute Engine Router is a resource for Compute Engine of Google Cloud Platform. Settings can be wrote in Terraform.

Where can I find the example code for the Google Compute Engine Router?

For Terraform, the jonathanpaliza/gcloudProjects, seanmccorkle/terraform-gcp and boreal321/terraform-bigip-gcp source code examples are useful. See the Terraform Example section for further details.

security-icon

Scan your IaC problem in 3 minutes for free

You can keep your IaC security for free. No credit card required.