Implement specification of AWS security groups in ingress rules as <owner>/<id>
This commit is contained in:
parent
70b06674c8
commit
7109b8c770
|
@ -81,8 +81,13 @@ func expandIPPerms(configured []interface{}) ([]ec2.IPPerm, error) {
|
|||
gs := expandStringList(secGroups)
|
||||
|
||||
for _, g := range gs {
|
||||
ownerId, id := "", g
|
||||
if items := strings.Split(g, "/"); len(items) > 1 {
|
||||
ownerId, id = items[0], items[1]
|
||||
}
|
||||
newG := ec2.UserSecurityGroup{
|
||||
Id: g,
|
||||
Id: id,
|
||||
OwnerId: ownerId,
|
||||
}
|
||||
expandedGroups = append(expandedGroups, newG)
|
||||
}
|
||||
|
|
|
@ -26,8 +26,9 @@ func testConf() map[string]string {
|
|||
"ingress.0.to_port": "-1",
|
||||
"ingress.0.cidr_blocks.#": "1",
|
||||
"ingress.0.cidr_blocks.0": "0.0.0.0/0",
|
||||
"ingress.0.security_groups.#": "1",
|
||||
"ingress.0.security_groups.#": "2",
|
||||
"ingress.0.security_groups.0": "sg-11111",
|
||||
"ingress.0.security_groups.1": "foo/sg-22222",
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,6 +48,10 @@ func Test_expandIPPerms(t *testing.T) {
|
|||
ec2.UserSecurityGroup{
|
||||
Id: "sg-11111",
|
||||
},
|
||||
ec2.UserSecurityGroup{
|
||||
OwnerId: "foo",
|
||||
Id: "sg-22222",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -92,6 +97,10 @@ func Test_expandIPPerms_NoCidr(t *testing.T) {
|
|||
ec2.UserSecurityGroup{
|
||||
Id: "sg-11111",
|
||||
},
|
||||
ec2.UserSecurityGroup{
|
||||
OwnerId: "foo",
|
||||
Id: "sg-22222",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue