community.aws icon indicating copy to clipboard operation
community.aws copied to clipboard

ecs_service plugin not updating the "placement_constraints" property

Open anirudh-here-com opened this issue 1 year ago • 4 comments

Summary

When I try to update "placement_constraints" property of an already existing service, its not getting reflected on the aws console. However, it works perfectly fine when the service does not exist and needs to be created

Issue Type

Bug Report

Component Name

ecs_service

Ansible Version

ansible [core 2.13.2]
  config file = None
  configured module search path = ['/Users/asimha/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/6.2.0/libexec/lib/python3.10/site-packages/ansible
  ansible collection location = /Users/asimha/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.10.6 (main, Aug 11 2022, 13:49:25) [Clang 13.1.6 (clang-1316.0.21.2.5)]
  jinja version = 3.1.2
  libyaml = True


Collection Versions

Collection    Version
------------- -------
amazon.aws    4.1.0  
community.aws 4.0.0  


AWS SDK versions

Name: boto3
Version: 1.24.45
Summary: The AWS SDK for Python
Home-page: https://github.com/boto/boto3
Author: Amazon Web Services
Author-email: 
License: Apache License 2.0
Location: /usr/local/lib/python3.10/site-packages
Requires: botocore, jmespath, s3transfer
Required-by: awswrangler, redshift-connector
---
Name: botocore
Version: 1.27.46
Summary: Low-level, data-driven core of boto 3.
Home-page: https://github.com/boto/botocore
Author: Amazon Web Services
Author-email: 
License: Apache License 2.0
Location: /usr/local/lib/python3.10/site-packages
Requires: jmespath, python-dateutil, urllib3
Required-by: aiobotocore, awswrangler, boto3, redshift-connector, s3transfer

Configuration

$ ansible-config dump --only-changed

OS / Environment

No response

Steps to Reproduce

Running the ansible playbook containing ecs_service block which has "placement_constraints" parameter defined

Expected Results

placement-constraints property should be set and visible in aws console.

Actual Results

placement-constraints property is not set in aws console

Code of Conduct

  • [X] I agree to follow the Ansible Code of Conduct

anirudh-here-com avatar Aug 16 '22 15:08 anirudh-here-com

Files identified in the description:

  • [plugins/modules/ecs_service.py](https://github.com/['ansible-collections/amazon.aws', 'ansible-collections/community.aws', 'ansible-collections/community.vmware']/blob/main/plugins/modules/ecs_service.py)

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot avatar Aug 16 '22 15:08 ansibullbot

cc @Java1Guy @jillr @kaczynskid @markuman @s-hertel @tremble @zacblazic click here for bot help

ansibullbot avatar Aug 16 '22 15:08 ansibullbot

The bug is easy to spot if you look at the call to update_servce compared to the call to create_service in ecs_service.py

response = service_mgr.update_service(module.params['name'],
                                      module.params['cluster'],
                                      module.params['task_definition'],
                                      module.params['desired_count'],
                                      deploymentConfiguration,
                                      network_configuration,
                                      module.params['health_check_grace_period_seconds'],
                                      module.params['force_new_deployment'])

response = service_mgr.create_service(module.params['name'],
                                      module.params['cluster'],
                                      module.params['task_definition'],
                                      loadBalancers,
                                      module.params['desired_count'],
                                      clientToken,
                                      role,
                                      deploymentConfiguration,
                                      module.params['placement_constraints'],
                                      module.params['placement_strategy'],
                                      module.params['health_check_grace_period_seconds'],
                                      network_configuration,
                                      serviceRegistries,
                                      module.params['launch_type'],
                                      module.params['platform_version'],
                                      module.params['scheduling_strategy']
                                      )

superwesman avatar Aug 16 '22 16:08 superwesman

good point!
The the work must be done here: https://github.com/ansible-collections/community.aws/blob/main/plugins/modules/ecs_service.py#L810-L831

does one of you (@anirudh-here-com @superwesman ) have some time to provide a PR to fix this issue?

markuman avatar Aug 16 '22 16:08 markuman