cloudtools / cloudtools/troposphere

AutoScalingGroup MinSize and MaxSize do not allow use of Select intrinsic function

Open
#753 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
4.9k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

I am trying to consolidate the ASG Min, Max, and Desired values into a single parameter, and I am hitting an error. I have the parameter formatted as a list of `|` delimited values, and I am using Select and Split to separate the items. I currently have the following values set for three properties:

```
MinSize=Select(0, Split("|", Ref(scaling_settings))),
MaxSize=Select(2, Split("|", Ref(scaling_settings))),
DesiredCapacity=Select(1, Split("|", Ref(scaling_settings))),
```

When trying to generate the template, I am hitting the following error:
```
...
File "c:\python27\lib\site-packages\troposphere\__init__.py", line 556, in to_dict
return encode_to_dict(t)
File "c:\python27\lib\site-packages\troposphere\__init__.py", line 61, in encode_to_dict
props[name] = encode_to_dict(prop)
File "c:\python27\lib\site-packages\troposphere\__init__.py", line 61, in encode_to_dict
props[name] = encode_to_dict(prop)
File "c:\python27\lib\site-packages\troposphere\__init__.py", line 52, in encode_to_dict
return encode_to_dict(obj.to_dict())
File "c:\python27\lib\site-packages\troposphere\__init__.py", line 206, in to_dict
self.validate()
File "c:\python27\lib\site-packages\troposphere\autoscaling.py", line 146, in validate
max_count = int(self.MaxSize)
RuntimeError: Failed to build JSON for template : int() argument must be a string or a number, not 'Select'
```

It appears only the `If`, `FindInMap`, and `Ref` functions are currently allowed. I would like to propose adding `Select` to the allowed functions for the `MinSize` and `MaxSize` properties as well.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.