troposphere icon indicating copy to clipboard operation
troposphere copied to clipboard

cfn2py crashes on nested functions

Open jabadie-iseatz opened this issue 10 years ago • 1 comments

I have a template that stands up a VPC, subnets and, route tables, IGW, etc. Running it through cnf2py causes the following crash:

Traceback (most recent call last):
  File "/usr/local/bin/cfn2py", line 332, in <module>
    globals()["do_" + s.lower()](d)
  File "/usr/local/bin/cfn2py", line 232, in do_resources
    print '    %s=%s,' % (pk, output_value(pv))
  File "/usr/local/bin/cfn2py", line 286, in output_value
    return handler(shortname, fv)
  File "/usr/local/bin/cfn2py", line 251, in handle_one_object
    ret += objects.lookup(param)
  File "/usr/local/bin/cfn2py", line 23, in lookup
    if o in self.objects:
TypeError: unhashable type: 'dict'

Here is the block it's choking on, specifically when processing the Availability zone block:

"SubPubLb3": {
      "Type": "AWS::EC2::Subnet",
      "Properties": {
        "VpcId": {
          "Ref": "Vpc"
        },
        "AvailabilityZone": {
          "Fn::Select": [
            {
              "Ref": "SegmentAz3"
            },
            {
              "Fn::GetAZs": ""
            }
          ]
        },
        "CidrBlock": {
          "Fn::Join": [
            ".",
            [
              {
                "Ref": "VpcCidrPrefixThis"
              },
              "0.128/26"
            ]
          ]
        },
        "Tags": [
          {
            "Value": {
              "Fn::Join": [
                "",
                [
                  {
                    "Ref": "NameTagPrefix"
                  },
                  "SubPubLb3"
                ]
              ]
            },
            "Key": "Name"
          }
        ]
      }
    },

It appears that nested intrinsic functions may not be processed correctly.

jabadie-iseatz avatar Apr 22 '15 15:04 jabadie-iseatz

I'm seeing the same error. uh oh, this is 2 years later. Are we abandoning this script?

brettswift avatar Apr 21 '17 14:04 brettswift