ecs_service: make assign_public_ip option a boolean (#41759)
This commit is contained in:
parent
3ea936312a
commit
c4a6bce69f
3 changed files with 8 additions and 5 deletions
|
@ -113,7 +113,7 @@ options:
|
||||||
assign_public_ip:
|
assign_public_ip:
|
||||||
description:
|
description:
|
||||||
- Whether the task's elastic network interface receives a public IP address. This option requires botocore >= 1.8.4.
|
- Whether the task's elastic network interface receives a public IP address. This option requires botocore >= 1.8.4.
|
||||||
choices: ["ENABLED", "DISABLED"]
|
type: bool
|
||||||
version_added: 2.7
|
version_added: 2.7
|
||||||
launch_type:
|
launch_type:
|
||||||
description:
|
description:
|
||||||
|
@ -338,7 +338,10 @@ class EcsServiceManager:
|
||||||
result['securityGroups'] = groups
|
result['securityGroups'] = groups
|
||||||
if network_config['assign_public_ip'] is not None:
|
if network_config['assign_public_ip'] is not None:
|
||||||
if self.module.botocore_at_least('1.8.4'):
|
if self.module.botocore_at_least('1.8.4'):
|
||||||
result['assignPublicIp'] = network_config['assign_public_ip']
|
if network_config['assign_public_ip'] is True:
|
||||||
|
result['assignPublicIp'] = "ENABLED"
|
||||||
|
else:
|
||||||
|
result['assignPublicIp'] = "DISABLED"
|
||||||
else:
|
else:
|
||||||
self.module.fail_json(msg='botocore needs to be version 1.8.4 or higher to use assign_public_ip in network_configuration')
|
self.module.fail_json(msg='botocore needs to be version 1.8.4 or higher to use assign_public_ip in network_configuration')
|
||||||
return dict(awsvpcConfiguration=result)
|
return dict(awsvpcConfiguration=result)
|
||||||
|
@ -461,7 +464,7 @@ def main():
|
||||||
network_configuration=dict(required=False, type='dict', options=dict(
|
network_configuration=dict(required=False, type='dict', options=dict(
|
||||||
subnets=dict(type='list'),
|
subnets=dict(type='list'),
|
||||||
security_groups=dict(type='list'),
|
security_groups=dict(type='list'),
|
||||||
assign_public_ip=dict(choices=['ENABLED', 'DISABLED']),
|
assign_public_ip=dict(type='bool'),
|
||||||
)),
|
)),
|
||||||
launch_type=dict(required=False, choices=['EC2', 'FARGATE'])
|
launch_type=dict(required=False, choices=['EC2', 'FARGATE'])
|
||||||
))
|
))
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
- subnet-abcd1234
|
- subnet-abcd1234
|
||||||
security_groups:
|
security_groups:
|
||||||
- sg-abcd1234
|
- sg-abcd1234
|
||||||
assign_public_ip: ENABLED
|
assign_public_ip: true
|
||||||
state: present
|
state: present
|
||||||
<<: *aws_connection_info
|
<<: *aws_connection_info
|
||||||
register: ecs_service_creation_vpc
|
register: ecs_service_creation_vpc
|
||||||
|
|
|
@ -629,7 +629,7 @@
|
||||||
subnets: "{{ setup_subnet.results | json_query('[].subnet.id') }}"
|
subnets: "{{ setup_subnet.results | json_query('[].subnet.id') }}"
|
||||||
security_groups:
|
security_groups:
|
||||||
- '{{ setup_sg.group_id }}'
|
- '{{ setup_sg.group_id }}'
|
||||||
assign_public_ip: ENABLED
|
assign_public_ip: true
|
||||||
<<: *aws_connection_info
|
<<: *aws_connection_info
|
||||||
register: ecs_fargate_service_network_with_awsvpc
|
register: ecs_fargate_service_network_with_awsvpc
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue