aws: use IpPermissions for authorizing temporary security group

Signed-off-by: Mikhail Ushanov <gm.mephisto@gmail.com>
This commit is contained in:
Mikhail Ushanov 2017-10-30 02:13:49 +03:00
parent b316be51cd
commit 00c96fc400
1 changed files with 13 additions and 5 deletions

View File

@ -92,11 +92,19 @@ func (s *StepSecurityGroup) Run(_ context.Context, state multistep.StateBag) mul
// Authorize the SSH access for the security group
groupRules := &ec2.AuthorizeSecurityGroupIngressInput{
GroupId: groupResp.GroupId,
IpProtocol: aws.String("tcp"),
FromPort: aws.Int64(int64(port)),
ToPort: aws.Int64(int64(port)),
CidrIp: aws.String(s.TemporarySGSourceCidr),
GroupId: groupResp.GroupId,
IpPermissions: []*ec2.IpPermission{
{
FromPort: aws.Int64(int64(port)),
ToPort: aws.Int64(int64(port)),
IpRanges: []*ec2.IpRange{
{
CidrIp: aws.String(s.TemporarySGSourceCidr),
},
},
IpProtocol: aws.String("tcp"),
},
},
}
ui.Say(fmt.Sprintf(