Skip to content

Commit 7d8357c

Browse files
modular-magicianEdward Sun
and
Edward Sun
authored
fixing id for a data source (#6476) (#12405)
Co-authored-by: Edward Sun <[email protected]> Signed-off-by: Modular Magician <[email protected]> Signed-off-by: Modular Magician <[email protected]> Co-authored-by: Edward Sun <[email protected]>
1 parent 48dbb51 commit 7d8357c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

.changelog/6476.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
compute: fixed the `id` format of the data source `google_compute_instance`
3+
```

google/data_source_google_compute_instance.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,6 @@ func dataSourceGoogleComputeInstanceRead(d *schema.ResourceData, meta interface{
191191
if err := d.Set("name", instance.Name); err != nil {
192192
return fmt.Errorf("Error setting name: %s", err)
193193
}
194-
d.SetId(fmt.Sprintf("projects/%s/zones/%s/instances/%s", project, instance.Zone, instance.Name))
194+
d.SetId(fmt.Sprintf("projects/%s/zones/%s/instances/%s", project, GetResourceNameFromSelfLink(instance.Zone), instance.Name))
195195
return nil
196196
}

0 commit comments

Comments
 (0)