This commit is contained in:
Mitchell Hashimoto 2015-06-23 22:31:24 -07:00
parent 823a9fa878
commit cddd54c3de
13 changed files with 60 additions and 67 deletions

View File

@ -27,9 +27,9 @@ func resourceAwsIAMServerCertificate() *schema.Resource {
},
"certificate_chain": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Type: schema.TypeString,
Optional: true,
ForceNew: true,
StateFunc: normalizeCert,
},

View File

@ -5,10 +5,10 @@ import (
"testing"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/service/sns"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
"github.com/aws/aws-sdk-go/aws/awserr"
)
func TestAccAWSSNSTopicSubscription_basic(t *testing.T) {
@ -28,7 +28,6 @@ func TestAccAWSSNSTopicSubscription_basic(t *testing.T) {
})
}
func testAccCheckAWSSNSTopicSubscriptionDestroy(s *terraform.State) error {
conn := testAccProvider.Meta().(*AWSClient).snsconn
@ -42,7 +41,6 @@ func testAccCheckAWSSNSTopicSubscriptionDestroy(s *terraform.State) error {
SubscriptionARN: aws.String(rs.Primary.ID),
}
_, err := conn.GetSubscriptionAttributes(req)
if err == nil {
@ -59,7 +57,6 @@ func testAccCheckAWSSNSTopicSubscriptionDestroy(s *terraform.State) error {
return nil
}
func testAccCheckAWSSNSTopicSubscriptionExists(n string) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[n]

View File

@ -5,10 +5,10 @@ import (
"testing"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/service/sns"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
"github.com/aws/aws-sdk-go/aws/awserr"
)
func TestAccAWSSNSTopic_basic(t *testing.T) {
@ -27,7 +27,6 @@ func TestAccAWSSNSTopic_basic(t *testing.T) {
})
}
func testAccCheckAWSSNSTopicDestroy(s *terraform.State) error {
conn := testAccProvider.Meta().(*AWSClient).snsconn
@ -55,7 +54,6 @@ func testAccCheckAWSSNSTopicDestroy(s *terraform.State) error {
return nil
}
func testAccCheckAWSSNSTopicExists(n string) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[n]

View File

@ -85,7 +85,7 @@ func resourceDockerContainerCreate(d *schema.ResourceData, meta interface{}) err
d.SetId(retContainer.ID)
hostConfig := &dc.HostConfig{
Privileged: d.Get("privileged").(bool),
Privileged: d.Get("privileged").(bool),
PublishAllPorts: d.Get("publish_all_ports").(bool),
}

View File

@ -13,8 +13,8 @@ import (
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
"golang.org/x/oauth2/jwt"
"google.golang.org/api/compute/v1"
computeBeta "google.golang.org/api/compute/v0.beta"
"google.golang.org/api/compute/v1"
"google.golang.org/api/dns/v1"
"google.golang.org/api/storage/v1"
)
@ -26,10 +26,10 @@ type Config struct {
Project string
Region string
clientCompute *compute.Service
clientCompute *compute.Service
clientComputeBeta *computeBeta.Service
clientDns *dns.Service
clientStorage *storage.Service
clientDns *dns.Service
clientStorage *storage.Service
}
func (c *Config) loadAndValidate() error {

View File

@ -7,9 +7,9 @@ import (
)
type DnsChangeWaiter struct {
Service *dns.Service
Change *dns.Change
Project string
Service *dns.Service
Change *dns.Change
Project string
ManagedZone string
}

View File

@ -101,7 +101,7 @@ func resourceComputeInstance() *schema.Resource {
},
"device_name": &schema.Schema{
Type: schema.TypeString,
Type: schema.TypeString,
Optional: true,
},
},
@ -148,9 +148,9 @@ func resourceComputeInstance() *schema.Resource {
},
"network": &schema.Schema{
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Deprecated: "Please use network_interface",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
@ -229,7 +229,7 @@ func resourceComputeInstance() *schema.Resource {
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
Set: stringHashcode,
Set: stringHashcode,
},
"metadata_fingerprint": &schema.Schema{
@ -327,7 +327,7 @@ func resourceComputeInstanceCreate(d *schema.ResourceData, meta interface{}) err
disk.Source = diskData.SelfLink
} else {
// Create a new disk
disk.InitializeParams = &compute.AttachedDiskInitializeParams{ }
disk.InitializeParams = &compute.AttachedDiskInitializeParams{}
}
if v, ok := d.GetOk(prefix + ".scratch"); ok {
@ -367,7 +367,7 @@ func resourceComputeInstanceCreate(d *schema.ResourceData, meta interface{}) err
disk.InitializeParams.DiskSizeGb = int64(diskSizeGb)
}
if v, ok := d.GetOk(prefix + ".device_name"); ok {
if v, ok := d.GetOk(prefix + ".device_name"); ok {
disk.DeviceName = v.(string)
}

View File

@ -6,7 +6,7 @@ import (
"strconv"
"strings"
"github.com/hashicorp/terraform/helper/hashcode"
"github.com/hashicorp/terraform/helper/hashcode"
"github.com/hashicorp/terraform/terraform"
)
@ -127,7 +127,6 @@ func migrateStateV1toV2(is *terraform.InstanceState) (*terraform.InstanceState,
delete(is.Attributes, k)
}
for service_acct_index, newScopes := range newScopesMap {
for _, newScope := range newScopes {
hash := hashcode.String(canonicalizeServiceScope(newScope))

View File

@ -30,8 +30,8 @@ func TestComputeInstanceMigrateState(t *testing.T) {
"change scope from list to set": {
StateVersion: 1,
Attributes: map[string]string{
"service_account.#": "1",
"service_account.0.email": "xxxxxx-compute@developer.gserviceaccount.com",
"service_account.#": "1",
"service_account.0.email": "xxxxxx-compute@developer.gserviceaccount.com",
"service_account.0.scopes.#": "4",
"service_account.0.scopes.0": "https://www.googleapis.com/auth/compute",
"service_account.0.scopes.1": "https://www.googleapis.com/auth/datastore",
@ -39,12 +39,12 @@ func TestComputeInstanceMigrateState(t *testing.T) {
"service_account.0.scopes.3": "https://www.googleapis.com/auth/logging.write",
},
Expected: map[string]string{
"service_account.#": "1",
"service_account.0.email": "xxxxxx-compute@developer.gserviceaccount.com",
"service_account.0.scopes.#": "4",
"service_account.#": "1",
"service_account.0.email": "xxxxxx-compute@developer.gserviceaccount.com",
"service_account.0.scopes.#": "4",
"service_account.0.scopes.1693978638": "https://www.googleapis.com/auth/devstorage.full_control",
"service_account.0.scopes.172152165": "https://www.googleapis.com/auth/logging.write",
"service_account.0.scopes.299962681": "https://www.googleapis.com/auth/compute",
"service_account.0.scopes.172152165": "https://www.googleapis.com/auth/logging.write",
"service_account.0.scopes.299962681": "https://www.googleapis.com/auth/compute",
"service_account.0.scopes.3435931483": "https://www.googleapis.com/auth/datastore",
},
},

View File

@ -50,18 +50,18 @@ func resourceDnsManagedZone() *schema.Resource {
func resourceDnsManagedZoneCreate(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)
// Build the parameter
zone := &dns.ManagedZone{
Name: d.Get("name").(string),
// Build the parameter
zone := &dns.ManagedZone{
Name: d.Get("name").(string),
DnsName: d.Get("dns_name").(string),
}
// Optional things
if v, ok := d.GetOk("description"); ok {
zone.Description = v.(string)
}
if v, ok := d.GetOk("dns_name"); ok {
zone.DnsName = v.(string)
}
}
// Optional things
if v, ok := d.GetOk("description"); ok {
zone.Description = v.(string)
}
if v, ok := d.GetOk("dns_name"); ok {
zone.DnsName = v.(string)
}
log.Printf("[DEBUG] DNS ManagedZone create request: %#v", zone)
zone, err := config.clientDns.ManagedZones.Create(config.Project, zone).Do()
@ -90,7 +90,7 @@ func resourceDnsManagedZoneRead(d *schema.ResourceData, meta interface{}) error
return fmt.Errorf("Error reading DNS ManagedZone: %#v", err)
}
d.Set("name_servers", zone.NameServers)
d.Set("name_servers", zone.NameServers)
return nil
}

View File

@ -61,17 +61,17 @@ func resourceDnsRecordSetCreate(d *schema.ResourceData, meta interface{}) error
// Build the change
chg := &dns.Change{
Additions: []*dns.ResourceRecordSet {
&dns.ResourceRecordSet {
Name: d.Get("name").(string),
Type: d.Get("type").(string),
Ttl: int64(d.Get("ttl").(int)),
Additions: []*dns.ResourceRecordSet{
&dns.ResourceRecordSet{
Name: d.Get("name").(string),
Type: d.Get("type").(string),
Ttl: int64(d.Get("ttl").(int)),
Rrdatas: make([]string, rrdatasCount),
},
},
}
for i := 0; i < rrdatasCount ; i++ {
for i := 0; i < rrdatasCount; i++ {
rrdata := fmt.Sprintf("rrdatas.%d", i)
chg.Additions[0].Rrdatas[i] = d.Get(rrdata).(string)
}
@ -85,9 +85,9 @@ func resourceDnsRecordSetCreate(d *schema.ResourceData, meta interface{}) error
d.SetId(chg.Id)
w := &DnsChangeWaiter{
Service: config.clientDns,
Change: chg,
Project: config.Project,
Service: config.clientDns,
Change: chg,
Project: config.Project,
ManagedZone: zone,
}
state := w.Conf()
@ -126,7 +126,6 @@ func resourceDnsRecordSetRead(d *schema.ResourceData, meta interface{}) error {
return fmt.Errorf("Only expected 1 record set, got %d", len(resp.Rrsets))
}
d.Set("ttl", resp.Rrsets[0].Ttl)
d.Set("rrdatas", resp.Rrsets[0].Rrdatas)
@ -142,17 +141,17 @@ func resourceDnsRecordSetDelete(d *schema.ResourceData, meta interface{}) error
// Build the change
chg := &dns.Change{
Deletions: []*dns.ResourceRecordSet {
&dns.ResourceRecordSet {
Name: d.Get("name").(string),
Type: d.Get("type").(string),
Ttl: int64(d.Get("ttl").(int)),
Deletions: []*dns.ResourceRecordSet{
&dns.ResourceRecordSet{
Name: d.Get("name").(string),
Type: d.Get("type").(string),
Ttl: int64(d.Get("ttl").(int)),
Rrdatas: make([]string, rrdatasCount),
},
},
}
for i := 0; i < rrdatasCount ; i++ {
for i := 0; i < rrdatasCount; i++ {
rrdata := fmt.Sprintf("rrdatas.%d", i)
chg.Deletions[0].Rrdatas[i] = d.Get(rrdata).(string)
}
@ -163,9 +162,9 @@ func resourceDnsRecordSetDelete(d *schema.ResourceData, meta interface{}) error
}
w := &DnsChangeWaiter{
Service: config.clientDns,
Change: chg,
Project: config.Project,
Service: config.clientDns,
Change: chg,
Project: config.Project,
ManagedZone: zone,
}
state := w.Conf()

View File

@ -82,7 +82,7 @@ func (c *SwiftClient) Get() (*Payload, error) {
hash := md5.Sum(bytes)
payload := &Payload{
Data: bytes,
MD5: hash[:md5.Size],
MD5: hash[:md5.Size],
}
return payload, nil

View File

@ -2,8 +2,8 @@ package remote
import (
"net/http"
"testing"
"os"
"testing"
)
func TestSwiftClient_impl(t *testing.T) {