fix go formatting

This commit is contained in:
Clint Shryock 2015-05-05 16:42:08 -05:00
parent e9b08cf31f
commit eb7c1bb218
1 changed files with 36 additions and 36 deletions

View File

@ -146,11 +146,11 @@ func resourceAwsSecurityGroup() *schema.Resource {
func resourceAwsSecurityGroupCreate(d *schema.ResourceData, meta interface{}) error { func resourceAwsSecurityGroupCreate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).ec2conn conn := meta.(*AWSClient).ec2conn
securityGroupOpts := &ec2.CreateSecurityGroupInput{} securityGroupOpts := &ec2.CreateSecurityGroupInput{}
if v := d.Get("vpc_id"); v != nil { if v := d.Get("vpc_id"); v != nil {
securityGroupOpts.VPCID = aws.String(v.(string)) securityGroupOpts.VPCID = aws.String(v.(string))
} }
if v := d.Get("description"); v != nil { if v := d.Get("description"); v != nil {
securityGroupOpts.Description = aws.String(v.(string)) securityGroupOpts.Description = aws.String(v.(string))
@ -186,42 +186,42 @@ func resourceAwsSecurityGroupCreate(d *schema.ResourceData, meta interface{}) er
Timeout: 1 * time.Minute, Timeout: 1 * time.Minute,
} }
resp, err := stateConf.WaitForState() resp, err := stateConf.WaitForState()
if err != nil { if err != nil {
return fmt.Errorf( return fmt.Errorf(
"Error waiting for Security Group (%s) to become available: %s", "Error waiting for Security Group (%s) to become available: %s",
d.Id(), err) d.Id(), err)
} }
// AWS defaults all Security Groups to have an ALLOW ALL egress rule. Here we // AWS defaults all Security Groups to have an ALLOW ALL egress rule. Here we
// revoke that rule, so users don't unknowningly have/use it. // revoke that rule, so users don't unknowningly have/use it.
group := resp.(*ec2.SecurityGroup) group := resp.(*ec2.SecurityGroup)
if group.VPCID != nil && *group.VPCID != "" { if group.VPCID != nil && *group.VPCID != "" {
log.Printf("[DEBUG] Revoking default egress rule for Security Group for %s", d.Id()) log.Printf("[DEBUG] Revoking default egress rule for Security Group for %s", d.Id())
req := &ec2.RevokeSecurityGroupEgressInput{ req := &ec2.RevokeSecurityGroupEgressInput{
GroupID: createResp.GroupID, GroupID: createResp.GroupID,
IPPermissions: []*ec2.IPPermission{ IPPermissions: []*ec2.IPPermission{
&ec2.IPPermission{ &ec2.IPPermission{
FromPort: aws.Long(int64(0)), FromPort: aws.Long(int64(0)),
ToPort: aws.Long(int64(0)), ToPort: aws.Long(int64(0)),
IPRanges: []*ec2.IPRange{ IPRanges: []*ec2.IPRange{
&ec2.IPRange{ &ec2.IPRange{
CIDRIP: aws.String("0.0.0.0/0"), CIDRIP: aws.String("0.0.0.0/0"),
}, },
}, },
IPProtocol: aws.String("-1"), IPProtocol: aws.String("-1"),
}, },
}, },
} }
if _, err = conn.RevokeSecurityGroupEgress(req); err != nil { if _, err = conn.RevokeSecurityGroupEgress(req); err != nil {
return fmt.Errorf( return fmt.Errorf(
"Error revoking default egress rule for Security Group (%s): %s", "Error revoking default egress rule for Security Group (%s): %s",
d.Id(), err) d.Id(), err)
} }
} }
return resourceAwsSecurityGroupUpdate(d, meta) return resourceAwsSecurityGroupUpdate(d, meta)
} }
@ -436,12 +436,12 @@ func resourceAwsSecurityGroupUpdateRules(
} }
os := o.(*schema.Set) os := o.(*schema.Set)
ns := n.(*schema.Set) ns := n.(*schema.Set)
remove := expandIPPerms(group, os.Difference(ns).List()) remove := expandIPPerms(group, os.Difference(ns).List())
add := expandIPPerms(group, ns.Difference(os).List()) add := expandIPPerms(group, ns.Difference(os).List())
// TODO: We need to handle partial state better in the in-between // TODO: We need to handle partial state better in the in-between
// in this update. // in this update.
// TODO: It'd be nicer to authorize before removing, but then we have // TODO: It'd be nicer to authorize before removing, but then we have