ec2_instance: Force int when ebs.volume_size or ebs.iops is specified (#55716)

* Force int when volume_size is specified

* changelog

* both volume_size and iops must be int

* updated changelog fragment

(cherry picked from commit 5a6f888036)
This commit is contained in:
Andrea Tartaglia 2019-05-08 13:11:00 +01:00 committed by Toshio Kuratomi
parent bce7ccc26d
commit 2a1e7403c4
2 changed files with 7 additions and 0 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- ec2_instance - Ensures ``ebs.volume_size`` and ``ebs.iops`` are ``int`` to avoid issues with Jinja2 templating

View file

@ -818,6 +818,11 @@ def manage_tags(match, new_tags, purge_tags, ec2):
def build_volume_spec(params):
volumes = params.get('volumes') or []
for volume in volumes:
if 'ebs' in volume:
for int_value in ['volume_size', 'iops']:
if int_value in volume['ebs']:
volume['ebs'][int_value] = int(volume['ebs'][int_value])
return [ec2_utils.snake_dict_to_camel_dict(v, capitalize_first=True) for v in volumes]