Skip to content

Commit

Permalink
Let route resource accept "description" attribute (#1088)
Browse files Browse the repository at this point in the history
  • Loading branch information
jphalip authored and nat-henderson committed Feb 15, 2018
1 parent c607b46 commit 7477c74
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions google/resource_compute_route.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions google/resource_compute_route_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 7477c74

Please sign in to comment.