Skip to content

Commit

Permalink
Add google_compute_instance current_status to data source (#3269) (#5926
Browse files Browse the repository at this point in the history
)

* 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 <[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 18, 2020
1 parent cd3d763 commit 4eb5242
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/3269.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
compute: Added `current_status` field to `data.google_compute_instance`
```
1 change: 1 addition & 0 deletions google/data_source_google_compute_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions google/data_source_google_compute_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func testAccDataSourceComputeInstanceCheck(datasourceName string, resourceName s
instanceAttrsToTest := []string{
"name",
"machine_type",
"current_status",
"can_ip_forward",
"description",
"deletion_protection",
Expand Down

0 comments on commit 4eb5242

Please sign in to comment.