Skip to content

SecurityGroupIngress/Egress formatting with additional [] #109

@yumpy

Description

@yumpy

I have defined a SecurityGroup with an 'embedded' Ingress rule

EC2_SecurityGroup(:mySG) {
  VpcId Ref(:VPC)
  GroupDescription "my SG"
  SecurityGroupIngress [
    {
      "CidrIp"     => "10.0.0.0/8",
      "IpProtocol" => "tcp",
      "FromPort"   => "22",
      "ToPort"     => "22"
    }
  ]
}  

The generated JSON for the Ingress contains an additional [ .... ] which is rejected by CloudFormation. This also happens for Egress as well. Note that the similar format NetworkInterfaces (in EC2_Instance) seems to work OK.

Generated:

            "SecurityGroupIngress" : [
               [
                  {
                     "FromPort" : "22",
                     "IpProtocol" : "tcp",
                     "CidrIp" : "10.0.0.0/8",
                     "ToPort" : "22"
                  }
               ]
            ]

should be:

            "SecurityGroupIngress" : [
                  {
                     "FromPort" : "22",
                     "IpProtocol" : "tcp",
                     "CidrIp" : "10.0.0.0/8",
                     "ToPort" : "22"
                  }
               ]

Removing the [ ...] from around

     SecurityGroupIngress: [ EC2SecurityGroupRule ]
     SecurityGroupEgress: [ EC2SecurityGroupRule ]

in aws_types.yaml seems to fix the problem for me but I don't think that's the correct approach

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions