hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.65k stars 9.03k forks source link

[Enhancement]: Add support for setting the deploymentConfiguration field on aws_ecs_service resources #32265

Open cristim opened 1 year ago

cristim commented 1 year ago

Description

This is a relatively new feature documented in this blog post, which allows ECS to automatically rollback deployments in case of failures:

Here's how the new parameter looks like in JSON, as per the above blog:

"deploymentConfiguration":{
   "deploymentCircuitBreaker":{
      "enable":true,
      "rollback":true
   },
   "maximumPercent":200,
   "minimumHealthyPercent":50,
   "alarms":{
      "alarmNames":[
         "HighResponseLatencyAlarm"
      ],
      "enable":true,
      "rollback":true
   }
} 

And here's how to do the same in CloudFormation.

Affected Resource(s) and/or Data Source(s)

aws_ecs_service

Potential Terraform Configuration

resource "aws-ecs_service" "example"{
[...]

deployment_configuration {

   deployment_circuit_breaker {
      enable   = true
      rollback = true
   }

   maximum_percent         = 200
   minimum_healthy_percent = 50

   alarms {
      alarm_names = [
         "HighResponseLatencyAlarm"
      ]
      enable   = true
      rollback = true
   }
[...]
}

References

Would you like to implement a fix?

No

github-actions[bot] commented 1 year ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

justinretzolk commented 12 months ago

Hey @cristim 👋 Thank you for taking the time to raise this! I took a look over this, and I believe that everything is already in place for this as it stands today, though the structure looks a little different than your sample configuration. The equivalent Terraform configuration would be something like:

resource "aws_ecs_service" "example" {
# ...other configuration...
  deployment_maximum_percent         = 200
  deployment_minimum_healthy_percent = 50

  deployment_circuit_breaker {
    enable   = true
    rollback = true
  }

  alarms {
    alarm_names = ["HighResponseLatencyAlarm"]
    enable      = true
    rollback    = true
  }
}
mvallim commented 9 months ago

Hey @cristim 👋 Thank you for taking the time to raise this! I took a look over this, and I believe that everything is already in place for this as it stands today, though the structure looks a little different than your sample configuration. The equivalent Terraform configuration would be something like:

resource "aws_ecs_service" "example" {
# ...other configuration...
  deployment_maximum_percent         = 200
  deployment_minimum_healthy_percent = 50

  deployment_circuit_breaker {
    enable   = true
    rollback = true
  }

  alarms {
    alarm_names = ["HighResponseLatencyAlarm"]
    enable      = true
    rollback    = true
  }
}

Hi @justinretzolk,

On the other hand, when 'alarms' is removed, this is not reflected in the resource previously created with 'alarms'.

Ex.

alarms {
  alarm_names = []
  enable = false
  rollback = false
}

Did you observe this?