Skip to content

TemplateGenerator: Cloudformation split function call wrapped inside list #2162

Description

@ilons

I'm trying to parse a cloudformation template into a troposphere template using the TemplateGenerator class.

This works good for most parts, but I've ran into an issue where TemplateGenerator would wrap calls to Fn::Split inside a list, making the result invalid (as it becomes a list of lists when deployed by cloudformation).

Small snippet to reproduce this issue:


template = troposphere.template_generator.TemplateGenerator({
    "Resources": {
        "TestLB": {
            "Properties": {
                "IpAddressType": "ipv4",
                "Name": "MyTestLB",
                "Scheme": "internet-facing",
                "SecurityGroups": [
                    {
                        "Ref": "MySG"
                    }
                ],
                "Subnets": {
                    "Fn::Split": [
                        ",",
                        {
                            "Fn::ImportValue": "MyPublicSubnets"
                        }
                    ]
                },
                "Type": "application"
            },
            "Type": "AWS::ElasticLoadBalancingV2::LoadBalancer"
        }
    }
})
assert isinstance(template.resources["TestLB"].properties["Subnets"], troposphere.Split), "Expected troposphere.Split"

I'm getting this running:

Python 3.10.6

cfn-flip==1.3.0
click==8.1.3
PyYAML==6.0
six==1.16.0
troposphere==4.3.2

Is there any way around this?

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