mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-07-01 07:42:40 +00:00
Fix bug where range variable is improperly dereferenced (#217)
* Fix bug where range variable is improperly dereferenced * Add comment explaining why a value is copied
This commit is contained in:
parent
6c27e076ce
commit
8f75c1c9a5
|
@ -103,7 +103,10 @@ func expandComputeMetadata(m map[string]string) []*compute.MetadataItems {
|
|||
|
||||
idx := 0
|
||||
for key, value := range m {
|
||||
metadata[idx] = &compute.MetadataItems{Key: key, Value: &value}
|
||||
// Make a copy of value as we need a ptr type; if we directly use 'value' then all items will reference the same
|
||||
// memory address
|
||||
vtmp := value
|
||||
metadata[idx] = &compute.MetadataItems{Key: key, Value: &vtmp}
|
||||
idx++
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user