Skip to content

(ecs): Deployment Circuit Breaker cannot be turned off via CDK #27131

@mlartz

Description

@mlartz

Describe the bug

I believe this is similar #25840, but for the DeploymentCircuitBreaker.

We are unable to turn off the DeploymentCircuitBreaker from an ECS service via CDK.

Expected Behavior

Deploying an ECS service with an unset .circuitBreaker will turn off the ECS Deployment Circuit Breaker if it was previously turned on.

Current Behavior

When setting the .circuitBreaker property on an ECS service in CDK, we see the following added to the resulting ECS::Service CFN:

   "Type": "AWS::ECS::Service",
   "Properties": {
    "DeploymentConfiguration": {
     "DeploymentCircuitBreaker": {
      "Enable" : true,
      "Rollback" : false,
     },
    ...
    },
   ...

When attempting to remove the circuit breaker by not setting the .circuitBreaker property on the CDK service, the DeploymentCircuitBreaker is no longer set in the resulting CFN. When this new stack (with a removed DeploymentCircuitBreaker), ECS does not turn off the circuit breaker. I believe that this is due to ECS not treating missing values as "different" when processing the CFN.

Manually editing the CFN to explicitly set the "Enable": false in the CFN does cause ECS to turn off the circuit breaker, e.g.:

   "Type": "AWS::ECS::Service",
   "Properties": {
    "DeploymentConfiguration": {
     "DeploymentCircuitBreaker": {
      "Enable" : false,
      "Rollback" : false,
     },
    ...
    },
   ...

Unfortunately, this ability to explicitly disable the circuit breaker is not provided by the L2 CDK construct, and instead it is implied that not settting .circuitBreaker on the service will achieve this.

Reproduction Steps

See "Current Behavior"

Possible Solution

I believe the right way to fix this is explicitly disable the DeploymentCircuitBreaker in the CFN when the .circuitBreaker property is unset.

Additional Information/Context

https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.FargateService.html#circuitbreaker

CDK CLI Version

2.93.0

Framework Version

No response

Node.js Version

14.21.3

OS

Linux

Language

Typescript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-ecsRelated to Amazon Elastic ContainerbugThis issue is a bug.effort/smallSmall work item – less than a day of effortp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions