Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add platform to ecs service #353

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
tremble marked this conversation as resolved.
Show resolved Hide resolved
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