diff --git a/changelogs/fragments/353-add_platform_to_ecs_service.yml b/changelogs/fragments/353-add_platform_to_ecs_service.yml new file mode 100644 index 00000000000..1d313700826 --- /dev/null +++ b/changelogs/fragments/353-add_platform_to_ecs_service.yml @@ -0,0 +1,2 @@ +minor_changes: +- ecs_service - Add ``platform_version`` parameter to ``ecs_service`` (https://github.com/ansible-collections/community.aws/pull/353). diff --git a/plugins/modules/ecs_service.py b/plugins/modules/ecs_service.py index 42a45bba064..e498bb6d827 100644 --- a/plugins/modules/ecs_service.py +++ b/plugins/modules/ecs_service.py @@ -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. @@ -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, @@ -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: @@ -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']) ) @@ -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: