go fmt
This commit is contained in:
parent
d51ee3111e
commit
5d2fe153c0
|
@ -28,7 +28,6 @@ func resourceComputeInstanceV2() *schema.Resource {
|
|||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ForceNew: true,
|
||||
DefaultFunc: envDefaultFunc("OS_REGION_NAME"),
|
||||
},
|
||||
"name": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
|
@ -125,7 +124,6 @@ func resourceComputeInstanceV2Create(d *schema.ResourceData, meta interface{}) e
|
|||
return fmt.Errorf("Error creating OpenStack compute client: %s", err)
|
||||
}
|
||||
|
||||
|
||||
var createOpts servers.CreateOptsBuilder
|
||||
|
||||
serverCreateOpts := &servers.CreateOpts{
|
||||
|
@ -228,20 +226,16 @@ func resourceComputeInstanceV2Read(d *schema.ResourceData, meta interface{}) err
|
|||
|
||||
d.Set("metadata", server.Metadata)
|
||||
|
||||
var currentSG []string
|
||||
err = secgroups.ListByServer(computeClient, d.Id()).EachPage(func(page pagination.Page) (bool, error) {
|
||||
secGrpList, err := secgroups.ExtractSecurityGroups(page)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("Error setting security groups for OpenStack server: %s", err)
|
||||
return false, fmt.Errorf("Error getting security groups for OpenStack server: %s", err)
|
||||
}
|
||||
|
||||
for _, sg := range secGrpList {
|
||||
currentSG = append(currentSG, sg.Name)
|
||||
for i, sg := range secGrpList {
|
||||
d.Set(fmt.Sprintf("security_groups.%d", i), sg.Name)
|
||||
}
|
||||
|
||||
return true, nil
|
||||
})
|
||||
d.Set("security_groups", currentSG)
|
||||
|
||||
newFlavor, ok := server.Flavor["id"].(string)
|
||||
if !ok {
|
||||
|
@ -272,12 +266,12 @@ func resourceComputeInstanceV2Update(d *schema.ResourceData, meta interface{}) e
|
|||
updateOpts.AccessIPv4 = d.Get("access_ip_v6").(string)
|
||||
}
|
||||
|
||||
log.Printf("[DEBUG] Updating Server %s with options: %+v", d.Id(), updateOpts)
|
||||
|
||||
_, err = servers.Update(computeClient, d.Id(), updateOpts).Extract()
|
||||
if updateOpts != (servers.UpdateOpts{}) {
|
||||
_, err := servers.Update(computeClient, d.Id(), updateOpts).Extract()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error updating OpenStack server: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
if d.HasChange("metadata") {
|
||||
var metadataOpts servers.MetadataOpts
|
||||
|
|
|
@ -20,7 +20,6 @@ func resourceComputeKeypairV2() *schema.Resource {
|
|||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ForceNew: true,
|
||||
DefaultFunc: envDefaultFunc("OS_REGION_NAME"),
|
||||
},
|
||||
"name": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
|
|
|
@ -22,7 +22,6 @@ func resourceComputeSecGroupV2() *schema.Resource {
|
|||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ForceNew: true,
|
||||
DefaultFunc: envDefaultFunc("OS_REGION_NAME"),
|
||||
},
|
||||
"name": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
|
|
|
@ -4,8 +4,8 @@ import (
|
|||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
"github.com/hashicorp/terraform/helper/hashcode"
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
"github.com/rackspace/gophercloud"
|
||||
"github.com/rackspace/gophercloud/openstack"
|
||||
"github.com/rackspace/gophercloud/openstack/networking/v2/extensions/lbaas/pools"
|
||||
|
|
|
@ -23,7 +23,6 @@ func resourceNetworkingNetworkV2() *schema.Resource {
|
|||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ForceNew: true,
|
||||
DefaultFunc: envDefaultFunc("OS_REGION_NAME"),
|
||||
},
|
||||
"name": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
|
|
|
@ -5,8 +5,8 @@ import (
|
|||
"log"
|
||||
"strconv"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
"github.com/hashicorp/terraform/helper/hashcode"
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
"github.com/rackspace/gophercloud"
|
||||
"github.com/rackspace/gophercloud/openstack"
|
||||
"github.com/rackspace/gophercloud/openstack/networking/v2/subnets"
|
||||
|
@ -24,7 +24,6 @@ func resourceNetworkingSubnetV2() *schema.Resource {
|
|||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ForceNew: true,
|
||||
DefaultFunc: envDefaultFunc("OS_REGION_NAME"),
|
||||
},
|
||||
"network_id": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
|
|
Loading…
Reference in New Issue