Repository: ansible-collections/community.aws

Issue:
circuit breaker settings missing in ecs_service module
### Summary

AWS API provides ability to set deployment configuration for ecs service. Currently ansible module community.aws.ecs_service implements only `maximumPercent` and `minimumHealthyPercent` options but `deploymentCircuitBreaker` is missing. Requesting to add this much needed missing option.

### Issue Type

Feature Idea

### Component Name

community.aws.ecs_service

### Additional Information

<!--- Paste example playbooks or commands between quotes below -->
as described in https://docs.aws.amazon.com/cli/latest/reference/ecs/update-service.html yaml should be:
```
ecs_service:
<..>
  deployment_configuration:
    minimum_percent: x
    minimum_healthy_percent: y
    deploymentCircuitBreaker:
      enabled: yes
      rollback: yes
```
JSON syntax:
```
"deployment_configuration": {
  "deploymentCircuitBreaker": {
    "enable": true|false,
    "rollback": true|false
  },
  "maximumPercent": integer,
  "minimumHealthyPercent": integer
}
```

### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct


Discussion:
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](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
cc @Java1Guy @jillr @kaczynskid @markuman @s-hertel @tremble @zacblazic
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->
This already works as an undocumented feature. I can add the documentation and examples.

Then maybe we just add ```'deployment_circuit_breaker': 'dict'``` to this https://github.com/ansible-collections/community.aws/blob/main/plugins/modules/ecs_service.py#L486 and I think that's it? Do you see anything else?

Working example:
```
- name: Build an ECS service.
      community.aws.ecs_service:
        state: "present"
        region: "{{ AWS_REGION }}"
        validate_certs: False
        aws_access_key: "{{ survey_access_key_id }}"
        aws_secret_key: "{{ survey_secret_access_key }}"
        aws_security_token: "{{ survey_session_token }}"
        name: service2
        cluster: my_cluster_name
        task_definition: my-task-def
        desired_count: 1
        launch_type: FARGATE
        network_configuration:
          assign_public_ip: no
          security_groups:
            - sg-abcd
          subnets:
            - subnet-1
            - subnet-2
            - subnet-3
            - subnet-4
        deployment_configuration:
          minimum_healthy_percent: 1
          deployment_circuit_breaker:
            enable: True
            rollback: True
```

Resolving patch:
diff --git a/plugins/modules/ecs_service.py b/plugins/modules/ecs_service.py
--- a/plugins/modules/ecs_service.py
+++ b/plugins/modules/ecs_service.py
@@ -101,6 +101,16 @@
           minimum_healthy_percent:
             type: int
             description: A lower limit on the number of tasks in a service that must remain in the RUNNING state during a deployment.
+          deployment_circuit_breaker:
+            type: dict
+            description: The deployment circuit breaker determines whether a service deployment will fail if the service can't reach a steady state.
+            suboptions:
+              enable:
+                type: bool
+                description: If enabled, a service deployment will transition to a failed state and stop launching new tasks.
+              rollback:
+                type: bool
+                description: If enabled, ECS will roll back your service to the last completed deployment after a failure.
     placement_constraints:
         description:
           - The placement constraints for the tasks in the service.
@@ -328,6 +338,19 @@
                     description: minimumHealthyPercent param
                     returned: always
                     type: int
+                deploymentCircuitBreaker:
+                    description: dictionary of deploymentCircuitBreaker
+                    returned: always
+                    type: complex
+                    contains:
+                        enable:
+                            description: The state of the circuit breaker feature.
+                            returned: always
+                            type: bool
+                        rollback:
+                            description: The state of the rollback feature of the circuit breaker.
+                            returned: always
+                            type: bool
         events:
             description: list of service events
             returned: always
@@ -444,6 +467,19 @@
                             description: minimumHealthyPercent param
                             returned: always
                             type: int
+                        deploymentCircuitBreaker:
+                            description: dictionary of deploymentCircuitBreaker
+                            returned: always
+                            type: complex
+                            contains:
+                                enable:
+                                    description: The state of the circuit breaker feature.
+                                    returned: always
+                                    type: bool
+                                rollback:
+                                    description: The state of the rollback feature of the circuit breaker.
+                                    returned: always
+                                    type: bool
                 events:
                     description: list of service events
                     returned: always
@@ -485,7 +521,8 @@
 
 DEPLOYMENT_CONFIGURATION_TYPE_MAP = {
     'maximum_percent': 'int',
-    'minimum_healthy_percent': 'int'
+    'minimum_healthy_percent': 'int',
+    'deployment_circuit_breaker': 'dict',
 }
 
 from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule


Test patch:
diff --git a/tests/integration/targets/ecs_cluster/defaults/main.yml b/tests/integration/targets/ecs_cluster/defaults/main.yml
--- a/tests/integration/targets/ecs_cluster/defaults/main.yml
+++ b/tests/integration/targets/ecs_cluster/defaults/main.yml
@@ -24,6 +24,9 @@ ecs_task_containers:
 ecs_service_deployment_configuration:
   minimum_healthy_percent: 0
   maximum_percent: 100
+  deployment_circuit_breaker:
+    enable: true
+    rollback: true
 ecs_service_placement_strategy:
   - type: binpack
     field: memory
diff --git a/tests/integration/targets/ecs_cluster/tasks/main.yml b/tests/integration/targets/ecs_cluster/tasks/main.yml
--- a/tests/integration/targets/ecs_cluster/tasks/main.yml
+++ b/tests/integration/targets/ecs_cluster/tasks/main.yml
@@ -225,16 +225,21 @@
         role: "ecsServiceRole"
       register: ecs_service
 
-    - name: check that placement constraint has been applied
+    - name: check that ECS service creation changed
       assert:
         that:
           - ecs_service.changed
-          - "ecs_service.service.placementConstraints[0].type == 'distinctInstance'"
 
-    - name: check that ECS service creation changed
+    - name: check that placement constraint has been applied
       assert:
         that:
-          - ecs_service.changed
+          - "ecs_service.service.placementConstraints[0].type == 'distinctInstance'"
+  
+    - name: check that ECS service was created with deployment_circuit_breaker
+      assert:
+        that:
+          - ecs_service.service.deploymentConfiguration.deploymentCircuitBreaker.enable
+          - ecs_service.service.deploymentConfiguration.deploymentCircuitBreaker.rollback
 
     - name: create same ECS service definition (should not change)
       ecs_service: