Merge pull request #5495 from nicolai86/bugfix/aws_security_group-protocol-case-sensitivity

provider/aws Always transform aws_security_group protocol to lower case
This commit is contained in:
Clint 2016-03-10 09:34:55 -06:00
commit 99ddea503d
2 changed files with 26 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import (
"fmt"
"log"
"sort"
"strings"
"time"
"github.com/aws/aws-sdk-go/aws"
@ -818,7 +819,7 @@ func idHash(rType, protocol string, toPort, fromPort int64, self bool) string {
buf.WriteString(fmt.Sprintf("%s-", rType))
buf.WriteString(fmt.Sprintf("%d-", toPort))
buf.WriteString(fmt.Sprintf("%d-", fromPort))
buf.WriteString(fmt.Sprintf("%s-", protocol))
buf.WriteString(fmt.Sprintf("%s-", strings.ToLower(protocol)))
buf.WriteString(fmt.Sprintf("%t-", self))
return fmt.Sprintf("rule-%d", hashcode.String(buf.String()))

View File

@ -186,6 +186,30 @@ func TestRulesMixedMatching(t *testing.T) {
},
},
},
// test lower/ uppercase handling
{
local: []interface{}{
map[string]interface{}{
"from_port": 80,
"to_port": 8000,
"protocol": "TCP",
},
},
remote: []map[string]interface{}{
map[string]interface{}{
"from_port": int64(80),
"to_port": int64(8000),
"protocol": "tcp",
},
},
saves: []map[string]interface{}{
map[string]interface{}{
"from_port": 80,
"to_port": 8000,
"protocol": "tcp",
},
},
},
// local and remote differ
{
local: []interface{}{