diff --git a/.changelog/6476.txt b/.changelog/6476.txt new file mode 100644 index 0000000000..74d90dface --- /dev/null +++ b/.changelog/6476.txt @@ -0,0 +1,3 @@ +```release-note:bug +compute: fixed the `id` format of the data source `google_compute_instance` +``` diff --git a/google-beta/data_source_google_compute_instance.go b/google-beta/data_source_google_compute_instance.go index 789bd170a8..d1b9e252b9 100644 --- a/google-beta/data_source_google_compute_instance.go +++ b/google-beta/data_source_google_compute_instance.go @@ -191,6 +191,6 @@ func dataSourceGoogleComputeInstanceRead(d *schema.ResourceData, meta interface{ if err := d.Set("name", instance.Name); err != nil { return fmt.Errorf("Error setting name: %s", err) } - d.SetId(fmt.Sprintf("projects/%s/zones/%s/instances/%s", project, instance.Zone, instance.Name)) + d.SetId(fmt.Sprintf("projects/%s/zones/%s/instances/%s", project, GetResourceNameFromSelfLink(instance.Zone), instance.Name)) return nil }