From 533af84eb19bcb54550cbb638842c5085b349451 Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 16 Mar 2020 11:52:24 -0700 Subject: [PATCH] Add current status on compute instance (#3248) (#1857) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sébastien GLON Signed-off-by: Modular Magician Co-authored-by: Sébastien GLON --- .changelog/3248.txt | 3 +++ google-beta/resource_compute_instance.go | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changelog/3248.txt diff --git a/.changelog/3248.txt b/.changelog/3248.txt new file mode 100644 index 0000000000..6f42dd3de9 --- /dev/null +++ b/.changelog/3248.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +compute: Add new attribute reference `current_status` +``` diff --git a/google-beta/resource_compute_instance.go b/google-beta/resource_compute_instance.go index a43f5e260b..2dc1bacdd4 100644 --- a/google-beta/resource_compute_instance.go +++ b/google-beta/resource_compute_instance.go @@ -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, @@ -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)