From 4eb5242092120fced93026b07a89eb82f7f19b2e Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 18 Mar 2020 15:12:22 -0700 Subject: [PATCH] Add google_compute_instance current_status to data source (#3269) (#5926) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add current status on compute instance * Add current_status on data compute_instance * Add field on test * Update resource_compute_instance.go * Update resource_compute_instance.go * clean Co-authored-by: Sébastien GLON Signed-off-by: Modular Magician Co-authored-by: Sébastien GLON --- .changelog/3269.txt | 3 +++ google/data_source_google_compute_instance.go | 1 + google/data_source_google_compute_instance_test.go | 1 + 3 files changed, 5 insertions(+) create mode 100644 .changelog/3269.txt diff --git a/.changelog/3269.txt b/.changelog/3269.txt new file mode 100644 index 00000000000..03f81d67a5c --- /dev/null +++ b/.changelog/3269.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +compute: Added `current_status` field to `data.google_compute_instance` +``` diff --git a/google/data_source_google_compute_instance.go b/google/data_source_google_compute_instance.go index 3868f405c45..e227b94ab5d 100644 --- a/google/data_source_google_compute_instance.go +++ b/google/data_source_google_compute_instance.go @@ -153,6 +153,7 @@ func dataSourceGoogleComputeInstanceRead(d *schema.ResourceData, meta interface{ d.Set("instance_id", fmt.Sprintf("%d", instance.Id)) d.Set("project", project) d.Set("zone", GetResourceNameFromSelfLink(instance.Zone)) + d.Set("current_status", instance.Status) d.Set("name", instance.Name) d.SetId(fmt.Sprintf("projects/%s/zones/%s/instances/%s", project, instance.Zone, instance.Name)) return nil diff --git a/google/data_source_google_compute_instance_test.go b/google/data_source_google_compute_instance_test.go index 4efaf0b43e5..ff374791afa 100644 --- a/google/data_source_google_compute_instance_test.go +++ b/google/data_source_google_compute_instance_test.go @@ -53,6 +53,7 @@ func testAccDataSourceComputeInstanceCheck(datasourceName string, resourceName s instanceAttrsToTest := []string{ "name", "machine_type", + "current_status", "can_ip_forward", "description", "deletion_protection",