Skip to content

Commit

Permalink
Add current status on compute instance (#3248) (#1857)
Browse files Browse the repository at this point in the history
Co-authored-by: Sébastien GLON <[email protected]>
Signed-off-by: Modular Magician <[email protected]>

Co-authored-by: Sébastien GLON <[email protected]>
  • Loading branch information
modular-magician and sebglon authored Mar 16, 2020
1 parent d76d23e commit 533af84
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/3248.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
compute: Add new attribute reference `current_status`
```
6 changes: 5 additions & 1 deletion google-beta/resource_compute_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,10 @@ func resourceComputeInstance() *schema.Resource {
Optional: true,
ValidateFunc: validation.StringInSlice([]string{"RUNNING", "TERMINATED"}, false),
},

"current_status": {
Type: schema.TypeString,
Computed: true,
},
"tags": {
Type: schema.TypeSet,
Optional: true,
Expand Down Expand Up @@ -1011,6 +1014,7 @@ func resourceComputeInstanceRead(d *schema.ResourceData, meta interface{}) error
d.Set("name", instance.Name)
d.Set("description", instance.Description)
d.Set("hostname", instance.Hostname)
d.Set("current_status", instance.Status)

if d.Get("desired_status") != "" {
d.Set("desired_status", instance.Status)
Expand Down

0 comments on commit 533af84

Please sign in to comment.