Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TemplateGenerator: Cloudformation split function call wrapped inside list #2162

Open
ilons opened this issue Jul 6, 2023 · 0 comments
Open

Comments

@ilons
Copy link

ilons commented Jul 6, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant