Code cleanup

This commit is contained in:
Clint Shryock 2015-03-11 08:30:43 -05:00
parent 3977256c17
commit 902ca25f36
1 changed files with 4 additions and 8 deletions

View File

@ -320,15 +320,11 @@ func resourceAwsSecurityGroupIPPermGather(d *schema.ResourceData, permissions []
ruleMap := make(map[string]map[string]interface{}) ruleMap := make(map[string]map[string]interface{})
for _, perm := range permissions { for _, perm := range permissions {
var fromPort, toPort int var fromPort, toPort int
if perm.FromPort == nil { if v := perm.FromPort; v != nil {
fromPort = 0 fromPort = *v
} else {
fromPort = *perm.FromPort
} }
if perm.ToPort == nil { if v := perm.ToPort; v != nil {
toPort = 0 toPort = *v
} else {
toPort = *perm.ToPort
} }
k := fmt.Sprintf("%s-%d-%d", *perm.IPProtocol, fromPort, toPort) k := fmt.Sprintf("%s-%d-%d", *perm.IPProtocol, fromPort, toPort)