mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
allow use of jinja2 variables for ec2_group from_port/to_port params (#27145)
This commit is contained in:
parent
622ea7ca62
commit
24e393aef1
2 changed files with 70 additions and 0 deletions
|
@ -500,6 +500,9 @@ def serialize_group_grant(group_id, rule):
|
|||
'FromPort': rule['from_port'],
|
||||
'ToPort': rule['to_port'],
|
||||
'UserIdGroupPairs': [{'GroupId': group_id}]}
|
||||
|
||||
convert_ports_to_int(permission)
|
||||
|
||||
return permission
|
||||
|
||||
|
||||
|
@ -539,9 +542,18 @@ def serialize_ip_grant(rule, thisip, ethertype):
|
|||
permission.update({'IpRanges': [{'CidrIp': thisip}]})
|
||||
elif ethertype == "ipv6":
|
||||
permission.update({'Ipv6Ranges': [{'CidrIpv6': thisip}]})
|
||||
|
||||
convert_ports_to_int(permission)
|
||||
|
||||
return permission
|
||||
|
||||
|
||||
def convert_ports_to_int(permission):
|
||||
for key in ['FromPort', 'ToPort']:
|
||||
if permission[key] is not None:
|
||||
permission[key] = int(permission[key])
|
||||
|
||||
|
||||
def main():
|
||||
argument_spec = ec2_argument_spec()
|
||||
argument_spec.update(dict(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue