troposphere icon indicating copy to clipboard operation
troposphere copied to clipboard

cfn2py tbd: security groups

Open bhyde opened this issue 10 years ago • 0 comments

Causes like this cause cfn2py to fail.

    "ZippySecurityGroup" : {
      "Type" : "AWS::EC2::SecurityGroup",
      "Properties" : {
        "GroupDescription" : "Enable HTTP access via port 80 and SSH access",
        "SecurityGroupIngress" : [

          {"IpProtocol" : "tcp", "FromPort" : "80", "ToPort" : "80", "CidrIp" : "0.0.0.0/0"},
          {"IpProtocol" : "tcp", "FromPort" : "443", "ToPort" : "443", "CidrIp" : "0.0.0.0/0"},
          {"IpProtocol" : "tcp", "FromPort" : "22", "ToPort" : "22", "CidrIp" : { "Ref" : "SSHLocation"}},
        ...

Something like this in do_resources might help.

            elif pk == 'SecurityGroupIngress':
                print "    %s=[" % (pk)
                print ',\n'.join([("            SecurityGroupRule(%s)" % (output_dict(rule)))
                                  for rule in pv])
                print "        ],"

I didn't test that, nor did I think thru what utilities for this pattern might already be in place.


There is also a rough edge in that a AWS::CloudFormation::WaitConditionHandle with no Properties fails too. Cloud formation doesn't mind that abbreviated form. The cloud formation doc shows an empty Property, so it's easy to work around.


Thanks for the nice tool!

bhyde avatar Feb 16 '15 16:02 bhyde