Skip to content

Commit

Permalink
provider/aws: Update to aws-sdk 0.9.0 rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
catsby committed Aug 17, 2015
1 parent 86ce5f1 commit 0c2f189
Show file tree
Hide file tree
Showing 97 changed files with 1,128 additions and 1,128 deletions.
2 changes: 1 addition & 1 deletion builtin/providers/aws/autoscaling_tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func autoscalingTagsFromMap(m map[string]interface{}, resourceID string) []*auto
Key: aws.String(k),
Value: aws.String(attr["value"].(string)),
PropagateAtLaunch: aws.Bool(attr["propagate_at_launch"].(bool)),
ResourceID: aws.String(resourceID),
ResourceId: aws.String(resourceID),
ResourceType: aws.String("auto-scaling-group"),
})
}
Expand Down
2 changes: 1 addition & 1 deletion builtin/providers/aws/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func (c *Config) ValidateAccountId(iamconn *iam.IAM) error {
return fmt.Errorf("Failed getting account ID from IAM: %s", err)
}

account_id := strings.Split(*out.User.ARN, ":")[4]
account_id := strings.Split(*out.User.Arn, ":")[4]

if c.ForbiddenAccountIds != nil {
for _, id := range c.ForbiddenAccountIds {
Expand Down
18 changes: 9 additions & 9 deletions builtin/providers/aws/network_acl_entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"github.com/aws/aws-sdk-go/service/ec2"
)

func expandNetworkAclEntries(configured []interface{}, entryType string) ([]*ec2.NetworkACLEntry, error) {
entries := make([]*ec2.NetworkACLEntry, 0, len(configured))
func expandNetworkAclEntries(configured []interface{}, entryType string) ([]*ec2.NetworkAclEntry, error) {
entries := make([]*ec2.NetworkAclEntry, 0, len(configured))
for _, eRaw := range configured {
data := eRaw.(map[string]interface{})
protocol := data["protocol"].(string)
Expand All @@ -23,7 +23,7 @@ func expandNetworkAclEntries(configured []interface{}, entryType string) ([]*ec2
}
}

e := &ec2.NetworkACLEntry{
e := &ec2.NetworkAclEntry{
Protocol: aws.String(strconv.Itoa(p)),
PortRange: &ec2.PortRange{
From: aws.Int64(int64(data["from_port"].(int))),
Expand All @@ -32,17 +32,17 @@ func expandNetworkAclEntries(configured []interface{}, entryType string) ([]*ec2
Egress: aws.Bool((entryType == "egress")),
RuleAction: aws.String(data["action"].(string)),
RuleNumber: aws.Int64(int64(data["rule_no"].(int))),
CIDRBlock: aws.String(data["cidr_block"].(string)),
CidrBlock: aws.String(data["cidr_block"].(string)),
}

// Specify additional required fields for ICMP
if p == 1 {
e.ICMPTypeCode = &ec2.ICMPTypeCode{}
e.IcmpTypeCode = &ec2.IcmpTypeCode{}
if v, ok := data["icmp_code"]; ok {
e.ICMPTypeCode.Code = aws.Int64(int64(v.(int)))
e.IcmpTypeCode.Code = aws.Int64(int64(v.(int)))
}
if v, ok := data["icmp_type"]; ok {
e.ICMPTypeCode.Type = aws.Int64(int64(v.(int)))
e.IcmpTypeCode.Type = aws.Int64(int64(v.(int)))
}
}

Expand All @@ -51,7 +51,7 @@ func expandNetworkAclEntries(configured []interface{}, entryType string) ([]*ec2
return entries, nil
}

func flattenNetworkAclEntries(list []*ec2.NetworkACLEntry) []map[string]interface{} {
func flattenNetworkAclEntries(list []*ec2.NetworkAclEntry) []map[string]interface{} {
entries := make([]map[string]interface{}, 0, len(list))

for _, entry := range list {
Expand All @@ -61,7 +61,7 @@ func flattenNetworkAclEntries(list []*ec2.NetworkACLEntry) []map[string]interfac
"action": *entry.RuleAction,
"rule_no": *entry.RuleNumber,
"protocol": *entry.Protocol,
"cidr_block": *entry.CIDRBlock,
"cidr_block": *entry.CidrBlock,
})
}

Expand Down
24 changes: 12 additions & 12 deletions builtin/providers/aws/network_acl_entry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,38 +37,38 @@ func Test_expandNetworkACLEntry(t *testing.T) {
}
expanded, _ := expandNetworkAclEntries(input, "egress")

expected := []*ec2.NetworkACLEntry{
&ec2.NetworkACLEntry{
expected := []*ec2.NetworkAclEntry{
&ec2.NetworkAclEntry{
Protocol: aws.String("6"),
PortRange: &ec2.PortRange{
From: aws.Int64(22),
To: aws.Int64(22),
},
RuleAction: aws.String("deny"),
RuleNumber: aws.Int64(1),
CIDRBlock: aws.String("0.0.0.0/0"),
CidrBlock: aws.String("0.0.0.0/0"),
Egress: aws.Bool(true),
},
&ec2.NetworkACLEntry{
&ec2.NetworkAclEntry{
Protocol: aws.String("6"),
PortRange: &ec2.PortRange{
From: aws.Int64(443),
To: aws.Int64(443),
},
RuleAction: aws.String("deny"),
RuleNumber: aws.Int64(2),
CIDRBlock: aws.String("0.0.0.0/0"),
CidrBlock: aws.String("0.0.0.0/0"),
Egress: aws.Bool(true),
},
&ec2.NetworkACLEntry{
&ec2.NetworkAclEntry{
Protocol: aws.String("-1"),
PortRange: &ec2.PortRange{
From: aws.Int64(443),
To: aws.Int64(443),
},
RuleAction: aws.String("deny"),
RuleNumber: aws.Int64(2),
CIDRBlock: aws.String("0.0.0.0/0"),
CidrBlock: aws.String("0.0.0.0/0"),
Egress: aws.Bool(true),
},
}
Expand All @@ -84,26 +84,26 @@ func Test_expandNetworkACLEntry(t *testing.T) {

func Test_flattenNetworkACLEntry(t *testing.T) {

apiInput := []*ec2.NetworkACLEntry{
&ec2.NetworkACLEntry{
apiInput := []*ec2.NetworkAclEntry{
&ec2.NetworkAclEntry{
Protocol: aws.String("tcp"),
PortRange: &ec2.PortRange{
From: aws.Int64(22),
To: aws.Int64(22),
},
RuleAction: aws.String("deny"),
RuleNumber: aws.Int64(1),
CIDRBlock: aws.String("0.0.0.0/0"),
CidrBlock: aws.String("0.0.0.0/0"),
},
&ec2.NetworkACLEntry{
&ec2.NetworkAclEntry{
Protocol: aws.String("tcp"),
PortRange: &ec2.PortRange{
From: aws.Int64(443),
To: aws.Int64(443),
},
RuleAction: aws.String("deny"),
RuleNumber: aws.Int64(2),
CIDRBlock: aws.String("0.0.0.0/0"),
CidrBlock: aws.String("0.0.0.0/0"),
},
}
flattened := flattenNetworkAclEntries(apiInput)
Expand Down
8 changes: 4 additions & 4 deletions builtin/providers/aws/resource_aws_autoscaling_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ func waitForASGCapacity(d *schema.ResourceData, meta interface{}) error {
haveELB := 0

for _, i := range g.Instances {
if i.HealthStatus == nil || i.InstanceID == nil || i.LifecycleState == nil {
if i.HealthStatus == nil || i.InstanceId == nil || i.LifecycleState == nil {
continue
}

Expand All @@ -497,7 +497,7 @@ func waitForASGCapacity(d *schema.ResourceData, meta interface{}) error {
if wantELB > 0 {
inAllLbs := true
for _, states := range lbis {
state, ok := states[*i.InstanceID]
state, ok := states[*i.InstanceId]
if !ok || !strings.EqualFold(state, "InService") {
inAllLbs = false
}
Expand Down Expand Up @@ -535,10 +535,10 @@ func getLBInstanceStates(g *autoscaling.Group, meta interface{}) (map[string]map
return nil, err
}
for _, is := range r.InstanceStates {
if is.InstanceID == nil || is.State == nil {
if is.InstanceId == nil || is.State == nil {
continue
}
lbInstanceStates[*lbName][*is.InstanceID] = *is.State
lbInstanceStates[*lbName][*is.InstanceId] = *is.State
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ func testAccCheckAWSAutoScalingGroupAttributes(group *autoscaling.Group) resourc
Value: aws.String("foo-bar"),
PropagateAtLaunch: aws.Bool(true),
ResourceType: aws.String("auto-scaling-group"),
ResourceID: group.AutoScalingGroupName,
ResourceId: group.AutoScalingGroupName,
}

if !reflect.DeepEqual(group.Tags[0], t) {
Expand Down
18 changes: 9 additions & 9 deletions builtin/providers/aws/resource_aws_customer_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ func resourceAwsCustomerGatewayCreate(d *schema.ResourceData, meta interface{})
conn := meta.(*AWSClient).ec2conn

createOpts := &ec2.CreateCustomerGatewayInput{
BGPASN: aws.Int64(int64(d.Get("bgp_asn").(int))),
PublicIP: aws.String(d.Get("ip_address").(string)),
BgpAsn: aws.Int64(int64(d.Get("bgp_asn").(int))),
PublicIp: aws.String(d.Get("ip_address").(string)),
Type: aws.String(d.Get("type").(string)),
}

Expand All @@ -62,14 +62,14 @@ func resourceAwsCustomerGatewayCreate(d *schema.ResourceData, meta interface{})

// Store the ID
customerGateway := resp.CustomerGateway
d.SetId(*customerGateway.CustomerGatewayID)
log.Printf("[INFO] Customer gateway ID: %s", *customerGateway.CustomerGatewayID)
d.SetId(*customerGateway.CustomerGatewayId)
log.Printf("[INFO] Customer gateway ID: %s", *customerGateway.CustomerGatewayId)

// Wait for the CustomerGateway to be available.
stateConf := &resource.StateChangeConf{
Pending: []string{"pending"},
Target: "available",
Refresh: customerGatewayRefreshFunc(conn, *customerGateway.CustomerGatewayID),
Refresh: customerGatewayRefreshFunc(conn, *customerGateway.CustomerGatewayId),
Timeout: 10 * time.Minute,
Delay: 10 * time.Second,
MinTimeout: 3 * time.Second,
Expand All @@ -79,7 +79,7 @@ func resourceAwsCustomerGatewayCreate(d *schema.ResourceData, meta interface{})
if stateErr != nil {
return fmt.Errorf(
"Error waiting for customer gateway (%s) to become ready: %s",
*customerGateway.CustomerGatewayID, err)
*customerGateway.CustomerGatewayId, err)
}

// Create tags.
Expand Down Expand Up @@ -145,8 +145,8 @@ func resourceAwsCustomerGatewayRead(d *schema.ResourceData, meta interface{}) er
}

customerGateway := resp.CustomerGateways[0]
d.Set("bgp_asn", customerGateway.BGPASN)
d.Set("ip_address", customerGateway.IPAddress)
d.Set("bgp_asn", customerGateway.BgpAsn)
d.Set("ip_address", customerGateway.IpAddress)
d.Set("type", customerGateway.Type)
d.Set("tags", tagsToMap(customerGateway.Tags))

Expand All @@ -170,7 +170,7 @@ func resourceAwsCustomerGatewayDelete(d *schema.ResourceData, meta interface{})
conn := meta.(*AWSClient).ec2conn

_, err := conn.DeleteCustomerGateway(&ec2.DeleteCustomerGatewayInput{
CustomerGatewayID: aws.String(d.Id()),
CustomerGatewayId: aws.String(d.Id()),
})
if err != nil {
if ec2err, ok := err.(awserr.Error); ok && ec2err.Code() == "InvalidCustomerGatewayID.NotFound" {
Expand Down
20 changes: 10 additions & 10 deletions builtin/providers/aws/resource_aws_db_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func resourceAwsDbInstanceCreate(d *schema.ResourceData, meta interface{}) error
Tags: tags,
}
if attr, ok := d.GetOk("iops"); ok {
opts.IOPS = aws.Int64(int64(attr.(int)))
opts.Iops = aws.Int64(int64(attr.(int)))
}

if attr, ok := d.GetOk("port"); ok {
Expand Down Expand Up @@ -315,7 +315,7 @@ func resourceAwsDbInstanceCreate(d *schema.ResourceData, meta interface{}) error
}

if attr, ok := d.GetOk("iops"); ok {
opts.IOPS = aws.Int64(int64(attr.(int)))
opts.Iops = aws.Int64(int64(attr.(int)))
}

if attr, ok := d.GetOk("license_model"); ok {
Expand All @@ -339,7 +339,7 @@ func resourceAwsDbInstanceCreate(d *schema.ResourceData, meta interface{}) error
}

if attr, ok := d.GetOk("tde_credential_arn"); ok {
opts.TDECredentialARN = aws.String(attr.(string))
opts.TdeCredentialArn = aws.String(attr.(string))
}

if attr, ok := d.GetOk("storage_type"); ok {
Expand Down Expand Up @@ -390,7 +390,7 @@ func resourceAwsDbInstanceCreate(d *schema.ResourceData, meta interface{}) error
for _, v := range attr.List() {
s = append(s, aws.String(v.(string)))
}
opts.VPCSecurityGroupIDs = s
opts.VpcSecurityGroupIds = s
}

if attr := d.Get("security_group_names").(*schema.Set); attr.Len() > 0 {
Expand All @@ -409,7 +409,7 @@ func resourceAwsDbInstanceCreate(d *schema.ResourceData, meta interface{}) error
}

if attr, ok := d.GetOk("iops"); ok {
opts.IOPS = aws.Int64(int64(attr.(int)))
opts.Iops = aws.Int64(int64(attr.(int)))
}

if attr, ok := d.GetOk("port"); ok {
Expand Down Expand Up @@ -533,8 +533,8 @@ func resourceAwsDbInstanceRead(d *schema.ResourceData, meta interface{}) error {
ids := &schema.Set{
F: schema.HashString,
}
for _, v := range v.VPCSecurityGroups {
ids.Add(*v.VPCSecurityGroupID)
for _, v := range v.VpcSecurityGroups {
ids.Add(*v.VpcSecurityGroupId)
}
d.Set("vpc_security_group_ids", ids)

Expand Down Expand Up @@ -638,7 +638,7 @@ func resourceAwsDbInstanceUpdate(d *schema.ResourceData, meta interface{}) error
}
if d.HasChange("iops") {
d.SetPartial("iops")
req.IOPS = aws.Int64(int64(d.Get("iops").(int)))
req.Iops = aws.Int64(int64(d.Get("iops").(int)))
requestUpdate = true
}
if d.HasChange("backup_window") {
Expand Down Expand Up @@ -673,7 +673,7 @@ func resourceAwsDbInstanceUpdate(d *schema.ResourceData, meta interface{}) error
for _, v := range attr.List() {
s = append(s, aws.String(v.(string)))
}
req.VPCSecurityGroupIDs = s
req.VpcSecurityGroupIds = s
}
requestUpdate = true
}
Expand Down Expand Up @@ -791,7 +791,7 @@ func buildRDSARN(d *schema.ResourceData, meta interface{}) (string, error) {
if err != nil {
return "", err
}
userARN := *resp.User.ARN
userARN := *resp.User.Arn
accountID := strings.Split(userARN, ":")[4]
arn := fmt.Sprintf("arn:aws:rds:%s:%s:db:%s", region, accountID, d.Id())
return arn, nil
Expand Down
8 changes: 4 additions & 4 deletions builtin/providers/aws/resource_aws_db_security_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ func resourceAwsDbSecurityGroupRead(d *schema.ResourceData, meta interface{}) er
for _, g := range sg.EC2SecurityGroups {
rule := map[string]interface{}{
"security_group_name": *g.EC2SecurityGroupName,
"security_group_id": *g.EC2SecurityGroupID,
"security_group_owner_id": *g.EC2SecurityGroupOwnerID,
"security_group_id": *g.EC2SecurityGroupId,
"security_group_owner_id": *g.EC2SecurityGroupOwnerId,
}
rules.Add(rule)
}
Expand Down Expand Up @@ -221,11 +221,11 @@ func resourceAwsDbSecurityGroupAuthorizeRule(ingress interface{}, dbSecurityGrou
}

if attr, ok := ing["security_group_id"]; ok && attr != "" {
opts.EC2SecurityGroupID = aws.String(attr.(string))
opts.EC2SecurityGroupId = aws.String(attr.(string))
}

if attr, ok := ing["security_group_owner_id"]; ok && attr != "" {
opts.EC2SecurityGroupOwnerID = aws.String(attr.(string))
opts.EC2SecurityGroupOwnerId = aws.String(attr.(string))
}

log.Printf("[DEBUG] Authorize ingress rule configuration: %#v", opts)
Expand Down
2 changes: 1 addition & 1 deletion builtin/providers/aws/resource_aws_db_subnet_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func resourceAwsDbSubnetGroupCreate(d *schema.ResourceData, meta interface{}) er
createOpts := rds.CreateDBSubnetGroupInput{
DBSubnetGroupName: aws.String(d.Get("name").(string)),
DBSubnetGroupDescription: aws.String(d.Get("description").(string)),
SubnetIDs: subnetIds,
SubnetIds: subnetIds,
}

log.Printf("[DEBUG] Create DB Subnet Group: %#v", createOpts)
Expand Down
2 changes: 1 addition & 1 deletion builtin/providers/aws/resource_aws_dynamodb_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ func resourceAwsDynamoDbTableRead(d *schema.ResourceData, meta interface{}) erro
}

d.Set("global_secondary_index", gsiList)
d.Set("arn", table.TableARN)
d.Set("arn", table.TableArn)

return nil
}
Expand Down
Loading

0 comments on commit 0c2f189

Please sign in to comment.