From 7477c7482cdd4db4bdbc3c6f63b8643c05e03713 Mon Sep 17 00:00:00 2001 From: Julien Phalip Date: Thu, 15 Feb 2018 13:03:28 -0800 Subject: [PATCH] Let route resource accept "description" attribute (#1088) --- google/resource_compute_route.go | 8 ++++++++ google/resource_compute_route_test.go | 3 +++ 2 files changed, 11 insertions(+) diff --git a/google/resource_compute_route.go b/google/resource_compute_route.go index 525144b109c..836f7e2aee4 100644 --- a/google/resource_compute_route.go +++ b/google/resource_compute_route.go @@ -83,6 +83,12 @@ func resourceComputeRoute() *schema.Resource { ForceNew: true, }, + "description": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + "tags": &schema.Schema{ Type: schema.TypeSet, Optional: true, @@ -162,6 +168,7 @@ func resourceComputeRouteCreate(d *schema.ResourceData, meta interface{}) error // Build the route parameter route := &compute.Route{ Name: d.Get("name").(string), + Description: d.Get("description").(string), DestRange: d.Get("dest_range").(string), Network: network.RelativeLink(), NextHopInstance: nextHopInstance, @@ -209,6 +216,7 @@ func resourceComputeRouteRead(d *schema.ResourceData, meta interface{}) error { } d.Set("name", route.Name) + d.Set("description", route.Description) d.Set("dest_range", route.DestRange) d.Set("network", route.Network) d.Set("priority", route.Priority) diff --git a/google/resource_compute_route_test.go b/google/resource_compute_route_test.go index 32d75066ed9..73623647878 100644 --- a/google/resource_compute_route_test.go +++ b/google/resource_compute_route_test.go @@ -26,6 +26,8 @@ func TestAccComputeRoute_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckComputeRouteExists( "google_compute_route.foobar", &route), + resource.TestMatchResourceAttr( + "google_compute_route.foobar", "description", regexp.MustCompile("This is a route")), ), }, resource.TestStep{ @@ -150,6 +152,7 @@ resource "google_compute_network" "foobar" { resource "google_compute_route" "foobar" { name = "route-test-%s" + description = "This is a route" dest_range = "15.0.0.0/24" network = "${google_compute_network.foobar.name}" next_hop_ip = "10.0.1.5"