Skip to content

Commit

Permalink
Add platform to ecs service (#353)
Browse files Browse the repository at this point in the history
* Add platformVersion params to ecs_service
* Add changelog fragment
* Add version_added
Co-authored-by: Mark Chappell <[email protected]>
  • Loading branch information
duderamos authored Mar 29, 2021
1 parent 327aabe commit 515ca23
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelogs/fragments/353-add_platform_to_ecs_service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- ecs_service - Add ``platform_version`` parameter to ``ecs_service`` (https://github.com/ansible-collections/community.aws/pull/353).
14 changes: 13 additions & 1 deletion plugins/modules/ecs_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,13 @@
required: false
choices: ["EC2", "FARGATE"]
type: str
platform_version:
type: str
description:
- Numeric part of platform version or LATEST
- See U(https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html) for more details.
required: false
version_added: 1.5.0
health_check_grace_period_seconds:
description:
- Seconds to wait before health checking the freshly added/updated services.
Expand Down Expand Up @@ -561,7 +568,8 @@ def is_matching_service(self, expected, existing):
def create_service(self, service_name, cluster_name, task_definition, load_balancers,
desired_count, client_token, role, deployment_configuration,
placement_constraints, placement_strategy, health_check_grace_period_seconds,
network_configuration, service_registries, launch_type, scheduling_strategy):
network_configuration, service_registries, launch_type, platform_version,
scheduling_strategy):

params = dict(
cluster=cluster_name,
Expand All @@ -578,6 +586,8 @@ def create_service(self, service_name, cluster_name, task_definition, load_balan
params['networkConfiguration'] = network_configuration
if launch_type:
params['launchType'] = launch_type
if platform_version:
params['platformVersion'] = platform_version
if self.health_check_setable(params) and health_check_grace_period_seconds is not None:
params['healthCheckGracePeriodSeconds'] = health_check_grace_period_seconds
if service_registries:
Expand Down Expand Up @@ -685,6 +695,7 @@ def main():
assign_public_ip=dict(type='bool')
)),
launch_type=dict(required=False, choices=['EC2', 'FARGATE']),
platform_version=dict(required=False, type='str'),
service_registries=dict(required=False, type='list', default=[], elements='dict'),
scheduling_strategy=dict(required=False, choices=['DAEMON', 'REPLICA'])
)
Expand Down Expand Up @@ -804,6 +815,7 @@ def main():
network_configuration,
serviceRegistries,
module.params['launch_type'],
module.params['platform_version'],
module.params['scheduling_strategy']
)
except botocore.exceptions.ClientError as e:
Expand Down

0 comments on commit 515ca23

Please sign in to comment.