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

ECS LoadBalancer 'LoadBalancerName' property takes an array #342

Closed
sangngh opened this issue Nov 3, 2015 · 2 comments
Closed

ECS LoadBalancer 'LoadBalancerName' property takes an array #342

sangngh opened this issue Nov 3, 2015 · 2 comments

Comments

@sangngh
Copy link

sangngh commented Nov 3, 2015

Hi all,

A bit new to troposphere and python development in general so excuse my ignorance..

We are trying to use troposphere to create an ECS cloud formation stack and running into some issues with setting up load balancing.
The current issue is that the ECS LoadBalancer class takes an array of string for the 'LoadBalancerName' property and its used in the ECS Service class, it generates a cloud formation template that is invalid.

The invalid cfn snippet looks like this:

        "stubvalidatorservice": {
            "Properties": {
                "Cluster": {
                    "Ref": "MobiusEcsCluster"
                },
                "DesiredCount": 3,
                "LoadBalancers": [
                    {
                        "ContainerName": "stubvalidator",
                        "ContainerPort": 9000,
                        "LoadBalancerName": [
                            "stubvalidatorELB"
                        ]
                    }
                ],
                "TaskDefinition": {
                    "Ref": "stubvalidatortaskdef"
                }
            },
            "Type": "AWS::ECS::Service"
        },

Cloud formation complains with this error:

CREATE_FAILED   AWS::ECS::Service   stubvalidatorservice    Value of property LoadBalancerName must be of type String

My troposphere codes looks like this:

ecs_lb = ecs.LoadBalancer(service_name + 'EcsElb', ContainerName=service_name, ContainerPort=container_config['port'], LoadBalancerName=[self.lb.title])
@markpeek
Copy link
Member

markpeek commented Nov 3, 2015

Please try this change and let me know if it works:

--- a/troposphere/ecs.py
+++ b/troposphere/ecs.py
@@ -12,7 +12,7 @@ class LoadBalancer(AWSProperty):
     props = {
         'ContainerName': (basestring, False),
         'ContainerPort': (network_port, False),
-        'LoadBalancerName': ([basestring, Ref], False),
+        'LoadBalancerName': (basestring, False),
     }

@sangngh
Copy link
Author

sangngh commented Nov 3, 2015

I made the change it seems to fix the issue. I just wanted to know if this change will make into a future troposphere release.

Thanks
Sang

amosshapira pushed a commit to amosshapira/troposphere that referenced this issue Oct 24, 2016
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

2 participants