This commit is contained in:
Mitchell Hashimoto 2015-02-20 10:22:26 -08:00
parent 4a11b1ce1f
commit 523639b5cd
11 changed files with 34 additions and 46 deletions

View File

@ -1,8 +1,8 @@
package aws package aws
import ( import (
"github.com/mitchellh/goamz/ec2"
"fmt" "fmt"
"github.com/mitchellh/goamz/ec2"
) )
func expandNetworkAclEntries(configured []interface{}, entryType string) ([]ec2.NetworkAclEntry, error) { func expandNetworkAclEntries(configured []interface{}, entryType string) ([]ec2.NetworkAclEntry, error) {
@ -11,7 +11,7 @@ func expandNetworkAclEntries(configured []interface{}, entryType string) ([]ec2.
data := eRaw.(map[string]interface{}) data := eRaw.(map[string]interface{})
protocol := data["protocol"].(string) protocol := data["protocol"].(string)
_, ok := protocolIntegers()[protocol] _, ok := protocolIntegers()[protocol]
if(!ok){ if !ok {
return nil, fmt.Errorf("Invalid Protocol %s for rule %#v", protocol, data) return nil, fmt.Errorf("Invalid Protocol %s for rule %#v", protocol, data)
} }
p := extractProtocolInteger(data["protocol"].(string)) p := extractProtocolInteger(data["protocol"].(string))

View File

@ -216,4 +216,3 @@ resource "aws_vpc" "bar" {
cidr_block = "10.2.0.0/16" cidr_block = "10.2.0.0/16"
} }
` `

View File

@ -14,7 +14,6 @@ import (
"golang.org/x/oauth2/jwt" "golang.org/x/oauth2/jwt"
) )
// Config is the configuration structure used to instantiate the Google // Config is the configuration structure used to instantiate the Google
// provider. // provider.
type Config struct { type Config struct {

View File

@ -10,7 +10,6 @@ import (
// If it is of the form name then look in the configured project and then hosted image projects. // If it is of the form name then look in the configured project and then hosted image projects.
func resolveImage(c *Config, name string) (string, error) { func resolveImage(c *Config, name string) (string, error) {
if strings.HasPrefix(name, "https://www.googleapis.com/compute/v1/") { if strings.HasPrefix(name, "https://www.googleapis.com/compute/v1/") {
return name, nil return name, nil

View File

@ -32,7 +32,6 @@ func resourceComputeAddress() *schema.Resource {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
}, },
} }
} }

View File

@ -216,4 +216,3 @@ func resourceComputeForwardingRuleDelete(d *schema.ResourceData, meta interface{
d.SetId("") d.SetId("")
return nil return nil
} }

View File

@ -122,4 +122,3 @@ resource "google_compute_forwarding_rule" "foobar" {
target = "${google_compute_target_pool.foobar-tp.self_link}" target = "${google_compute_target_pool.foobar-tp.self_link}"
} }
` `

View File

@ -248,7 +248,6 @@ func resourceOperationWaitZone(
return nil return nil
} }
func resourceComputeInstanceCreate(d *schema.ResourceData, meta interface{}) error { func resourceComputeInstanceCreate(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config) config := meta.(*Config)
@ -308,7 +307,6 @@ func resourceComputeInstanceCreate(d *schema.ResourceData, meta interface{}) err
if v, ok := d.GetOk(prefix + ".image"); ok { if v, ok := d.GetOk(prefix + ".image"); ok {
imageName := v.(string) imageName := v.(string)
imageUrl, err := resolveImage(config, imageName) imageUrl, err := resolveImage(config, imageName)
if err != nil { if err != nil {
return fmt.Errorf( return fmt.Errorf(
@ -557,7 +555,6 @@ func resourceComputeInstanceRead(d *schema.ResourceData, meta interface{}) error
internalIP = iface.NetworkIP internalIP = iface.NetworkIP
} }
} }
} }
@ -654,7 +651,7 @@ func resourceComputeInstanceUpdate(d *schema.ResourceData, meta interface{}) err
for i := 0; i < networkInterfacesCount; i++ { for i := 0; i < networkInterfacesCount; i++ {
prefix := fmt.Sprintf("network_interface.%d", i) prefix := fmt.Sprintf("network_interface.%d", i)
instNetworkInterface := instance.NetworkInterfaces[i] instNetworkInterface := instance.NetworkInterfaces[i]
networkName := d.Get(prefix+".name").(string) networkName := d.Get(prefix + ".name").(string)
// TODO: This sanity check is broken by #929, disabled for now (by forcing the equality) // TODO: This sanity check is broken by #929, disabled for now (by forcing the equality)
networkName = instNetworkInterface.Name networkName = instNetworkInterface.Name
@ -663,7 +660,7 @@ func resourceComputeInstanceUpdate(d *schema.ResourceData, meta interface{}) err
return fmt.Errorf("Instance networkInterface had unexpected name: %s", instNetworkInterface.Name) return fmt.Errorf("Instance networkInterface had unexpected name: %s", instNetworkInterface.Name)
} }
if d.HasChange(prefix+".access_config") { if d.HasChange(prefix + ".access_config") {
// TODO: This code deletes then recreates accessConfigs. This is bad because it may // TODO: This code deletes then recreates accessConfigs. This is bad because it may
// leave the machine inaccessible from either ip if the creation part fails (network // leave the machine inaccessible from either ip if the creation part fails (network
@ -672,9 +669,9 @@ func resourceComputeInstanceUpdate(d *schema.ResourceData, meta interface{}) err
// necessary, and also add before removing. // necessary, and also add before removing.
// Delete any accessConfig that currently exists in instNetworkInterface // Delete any accessConfig that currently exists in instNetworkInterface
for _, ac := range(instNetworkInterface.AccessConfigs) { for _, ac := range instNetworkInterface.AccessConfigs {
op, err := config.clientCompute.Instances.DeleteAccessConfig( op, err := config.clientCompute.Instances.DeleteAccessConfig(
config.Project, zone, d.Id(), networkName, ac.Name).Do(); config.Project, zone, d.Id(), networkName, ac.Name).Do()
if err != nil { if err != nil {
return fmt.Errorf("Error deleting old access_config: %s", err) return fmt.Errorf("Error deleting old access_config: %s", err)
} }
@ -693,7 +690,7 @@ func resourceComputeInstanceUpdate(d *schema.ResourceData, meta interface{}) err
NatIP: d.Get(acPrefix + ".nat_ip").(string), NatIP: d.Get(acPrefix + ".nat_ip").(string),
} }
op, err := config.clientCompute.Instances.AddAccessConfig( op, err := config.clientCompute.Instances.AddAccessConfig(
config.Project, zone, d.Id(), networkName, ac).Do(); config.Project, zone, d.Id(), networkName, ac).Do()
if err != nil { if err != nil {
return fmt.Errorf("Error adding new access_config: %s", err) return fmt.Errorf("Error adding new access_config: %s", err)
} }

View File

@ -215,7 +215,6 @@ func calcAddRemove(from []string, to []string) ([]string, []string) {
return add, remove return add, remove
} }
func resourceComputeTargetPoolUpdate(d *schema.ResourceData, meta interface{}) error { func resourceComputeTargetPoolUpdate(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config) config := meta.(*Config)

View File

@ -2,9 +2,9 @@ package heroku
import ( import (
"fmt" "fmt"
"testing"
"os"
"io/ioutil" "io/ioutil"
"os"
"testing"
"github.com/cyberdelia/heroku-go/v3" "github.com/cyberdelia/heroku-go/v3"
"github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/resource"
@ -112,5 +112,3 @@ func testAccCheckHerokuCertExists(n string, endpoint *heroku.SSLEndpoint) resour
return nil return nil
} }
} }