Skip to content

Commit f409bf3

Browse files
authored
backport-2: ecs_service deployment_circuit_breaker (#1226)
backport-2: ecs_service deployment_circuit_breaker SUMMARY manual backport of #1215 #1217 there is no version_added, because the module already supports this feature. it was just undocumented. ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request COMPONENT NAME ecs_service ADDITIONAL INFORMATION Reviewed-by: Alina Buzachis <None>
1 parent 957945f commit f409bf3

File tree

4 files changed

+52
-5
lines changed

4 files changed

+52
-5
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
minor_changes:
2+
- ecs_service - ``deployment_circuit_breaker`` has been added as a supported feature (https://github.com/ansible-collections/community.aws/pull/1215).

plugins/modules/ecs_service.py

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,16 @@
101101
minimum_healthy_percent:
102102
type: int
103103
description: A lower limit on the number of tasks in a service that must remain in the RUNNING state during a deployment.
104+
deployment_circuit_breaker:
105+
type: dict
106+
description: The deployment circuit breaker determines whether a service deployment will fail if the service can't reach a steady state.
107+
suboptions:
108+
enable:
109+
type: bool
110+
description: If enabled, a service deployment will transition to a failed state and stop launching new tasks.
111+
rollback:
112+
type: bool
113+
description: If enabled, ECS will roll back your service to the last completed deployment after a failure.
104114
placement_constraints:
105115
description:
106116
- The placement constraints for the tasks in the service.
@@ -328,6 +338,19 @@
328338
description: minimumHealthyPercent param
329339
returned: always
330340
type: int
341+
deploymentCircuitBreaker:
342+
description: dictionary of deploymentCircuitBreaker
343+
returned: always
344+
type: complex
345+
contains:
346+
enable:
347+
description: The state of the circuit breaker feature.
348+
returned: always
349+
type: bool
350+
rollback:
351+
description: The state of the rollback feature of the circuit breaker.
352+
returned: always
353+
type: bool
331354
events:
332355
description: list of service events
333356
returned: always
@@ -444,6 +467,19 @@
444467
description: minimumHealthyPercent param
445468
returned: always
446469
type: int
470+
deploymentCircuitBreaker:
471+
description: dictionary of deploymentCircuitBreaker
472+
returned: always
473+
type: complex
474+
contains:
475+
enable:
476+
description: The state of the circuit breaker feature.
477+
returned: always
478+
type: bool
479+
rollback:
480+
description: The state of the rollback feature of the circuit breaker.
481+
returned: always
482+
type: bool
447483
events:
448484
description: list of service events
449485
returned: always
@@ -485,7 +521,8 @@
485521

486522
DEPLOYMENT_CONFIGURATION_TYPE_MAP = {
487523
'maximum_percent': 'int',
488-
'minimum_healthy_percent': 'int'
524+
'minimum_healthy_percent': 'int',
525+
'deployment_circuit_breaker': 'dict',
489526
}
490527

491528
from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule

tests/integration/targets/ecs_cluster/defaults/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ ecs_task_containers:
2424
ecs_service_deployment_configuration:
2525
minimum_healthy_percent: 0
2626
maximum_percent: 100
27+
deployment_circuit_breaker:
28+
enable: true
29+
rollback: true
2730
ecs_service_placement_strategy:
2831
- type: binpack
2932
field: memory

tests/integration/targets/ecs_cluster/tasks/main.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,16 +225,21 @@
225225
role: "ecsServiceRole"
226226
register: ecs_service
227227

228-
- name: check that placement constraint has been applied
228+
- name: check that ECS service creation changed
229229
assert:
230230
that:
231231
- ecs_service.changed
232-
- "ecs_service.service.placementConstraints[0].type == 'distinctInstance'"
233232

234-
- name: check that ECS service creation changed
233+
- name: check that placement constraint has been applied
235234
assert:
236235
that:
237-
- ecs_service.changed
236+
- "ecs_service.service.placementConstraints[0].type == 'distinctInstance'"
237+
238+
- name: check that ECS service was created with deployment_circuit_breaker
239+
assert:
240+
that:
241+
- ecs_service.service.deploymentConfiguration.deploymentCircuitBreaker.enable
242+
- ecs_service.service.deploymentConfiguration.deploymentCircuitBreaker.rollback
238243

239244
- name: create same ECS service definition (should not change)
240245
ecs_service:

0 commit comments

Comments
 (0)