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

Validation of AutoScalingGroup with UpdatePolicy fails when maxSize is an expression #445

Closed
ubergeek42 opened this issue Apr 3, 2016 · 1 comment

Comments

@ubergeek42
Copy link
Contributor

Troposphere version: troposphere==1.5.0
Snippet example:

t.add_resource(AutoScalingGroup(
        "WebserverAutoScalingGroup",
        AvailabilityZones=GetAZs(Ref("AWS::Region")),
        LaunchConfigurationName=Ref(r['webserver_lc']),
        LoadBalancerNames=[Ref(r['webserver_elb'])],

        UpdatePolicy=UpdatePolicy(
            AutoScalingRollingUpdate=AutoScalingRollingUpdate(
                PauseTime='PT5M',
                MinInstancesInService="1",
                MaxBatchSize='1',
                WaitOnResourceSignals=True
            )
        ),
        CreationPolicy=CreationPolicy(
            ResourceSignal=ResourceSignal(
                Timeout='PT15M'
            )
        ),
        HealthCheckGracePeriod=300,
        HealthCheckType="EC2",

        DesiredCapacity=If(
            "IsStaging",
            '1',
            '3',
        ),
        MinSize=If(
            "IsStaging",
            '1',
            '3'
        ),
        MaxSize=If(
            "IsStaging",
            '1',
            '5'
        )
    ))

This gives the error:

Traceback (most recent call last):
<-- snip -->
packages/troposphere/__init__.py", line 367, in default
    return obj.JSONrepr()
  File "venv/lib/python2.7/site-packages/troposphere/__init__.py", line 176, in JSONrepr
    self.validate()
  File "venv/lib/python2.7/site-packages/troposphere/autoscaling.py", line 147, in validate
    maxCount = int(self.MaxSize)
TypeError: int() argument must be a string or a number, not 'If'

Let me know if you need any other details.

@ubergeek42
Copy link
Contributor Author

I added a simple PR that fixes this for me. See #446

markpeek pushed a commit that referenced this issue Apr 3, 2016
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

1 participant