Skip to content

Commit

Permalink
Added state as computed attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
nickithewatt committed Aug 12, 2017
1 parent d43a0f1 commit 945b69e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions google/resource_spanner_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ func resourceSpannerInstance() *schema.Resource {
Optional: true,
ForceNew: true,
},

"state": {
Type: schema.TypeString,
Computed: true,
},
},
}
}
Expand Down Expand Up @@ -163,6 +168,7 @@ func resourceSpannerInstanceRead(d *schema.ResourceData, meta interface{}) error
d.Set("labels", instance.Labels)
d.Set("display_name", instance.DisplayName)
d.Set("num_nodes", instance.NodeCount)
d.Set("state", instance.State)

return nil
}
Expand Down
1 change: 1 addition & 0 deletions google/resource_spanner_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ func TestAccSpannerInstance_basic(t *testing.T) {
resource.TestCheckResourceAttr("google_spanner_instance.basic", "name", idName),
resource.TestCheckResourceAttr("google_spanner_instance.basic", "display_name", idName+"-dname"),
resource.TestCheckResourceAttr("google_spanner_instance.basic", "num_nodes", "1"),
resource.TestCheckResourceAttrSet("google_spanner_instance.basic", "state"),
),
},
},
Expand Down
5 changes: 4 additions & 1 deletion website/docs/r/spanner_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ The following arguments are supported:

## Attributes Reference

No additional attributes are computed other than those defined above.
In addition to the arguments listed above, the following computed attributes are
exported:

* `state` - The current state of the instance.

## Import

Expand Down

0 comments on commit 945b69e

Please sign in to comment.