Changing how security groups are read for compute instances
This commit is contained in:
parent
64d53009a0
commit
4df32aebed
|
@ -366,17 +366,9 @@ func resourceComputeInstanceV2Read(d *schema.ResourceData, meta interface{}) err
|
||||||
d.Set("metadata", server.Metadata)
|
d.Set("metadata", server.Metadata)
|
||||||
|
|
||||||
secGrpNames := []string{}
|
secGrpNames := []string{}
|
||||||
err = secgroups.ListByServer(computeClient, d.Id()).EachPage(func(page pagination.Page) (bool, error) {
|
for _, sg := range server.SecurityGroups {
|
||||||
secGrpList, err := secgroups.ExtractSecurityGroups(page)
|
secGrpNames = append(secGrpNames, sg["name"].(string))
|
||||||
if err != nil {
|
|
||||||
return false, fmt.Errorf("Error getting security groups for OpenStack server: %s", err)
|
|
||||||
}
|
}
|
||||||
log.Printf("[DEBUG] secGrpList: %+v\n\n", secGrpList)
|
|
||||||
for _, sg := range secGrpList {
|
|
||||||
secGrpNames = append(secGrpNames, sg.Name)
|
|
||||||
}
|
|
||||||
return true, nil
|
|
||||||
})
|
|
||||||
d.Set("security_groups", secGrpNames)
|
d.Set("security_groups", secGrpNames)
|
||||||
|
|
||||||
flavorId, ok := server.Flavor["id"].(string)
|
flavorId, ok := server.Flavor["id"].(string)
|
||||||
|
|
Loading…
Reference in New Issue