diff --git a/provider/aws/formation/rack.json b/provider/aws/formation/rack.json index 843466fc8..a2fa8434c 100644 --- a/provider/aws/formation/rack.json +++ b/provider/aws/formation/rack.json @@ -11,6 +11,7 @@ "BlankExistingVpcAndThirdAvailabilityZone": { "Fn::And": [ { "Condition": "BlankExistingVpc" }, { "Condition": "ThirdAvailabilityZone" } ] }, + "HasEcsContainerStopTimeout": { "Fn::Not": [ { "Fn::Equals": [ { "Ref": "EcsContainerStopTimeout" }, "" ] } ] } , "BlankInstanceBootCommand": { "Fn::Equals": [ { "Ref": "InstanceBootCommand" }, "" ] }, "BlankInstancePolicy": { "Fn::Equals": [ { "Ref": "InstancePolicy" }, "" ] }, "BlankInstanceRunCommand": { "Fn::Equals": [ { "Ref": "InstanceRunCommand" }, "" ] }, @@ -787,6 +788,10 @@ "Default": "default", "AllowedValues": ["default", "always", "once", "prefer-cached"] }, + "EcsContainerStopTimeout": { + "Type": "String", + "Description": "The behavior used to customize the timeout on when a container is forcibly stopped by sending a SIGTERM signal to the container. See ECS_CONTAINER_STOP_TIMEOUT https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-config.html" + }, "IMDSHttpTokens": { "Type": "String", "Description": "You can set EC2 instances to use only v2 by setting IMDSHttpTokens as 'required', see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-options.html#configuring-IMDS-new-instances", @@ -1923,6 +1928,12 @@ ] }, " - echo ECS_CLUSTER=", { "Ref": "BuildCluster" }, " >> /etc/ecs/ecs.config\n", " - echo ECS_IMAGE_PULL_BEHAVIOR=", { "Ref": "ImagePullBehavior" }, " >> /etc/ecs/ecs.config\n", + { "Fn::If": [ "HasEcsContainerStopTimeout", + { "Fn::Join": [ "", [ + " - echo ECS_CONTAINER_STOP_TIMEOUT=", { "Ref": "EcsContainerStopTimeout" }, " >> /etc/ecs/ecs.config\n" + ] ] }, + { "Ref": "AWS::NoValue" } + ] }, " - echo ECS_ENGINE_AUTH_TYPE=docker >> /etc/ecs/ecs.config\n", " - echo 'ECS_INSTANCE_ATTRIBUTES={\"asg\":\"build\"}' >> /etc/ecs/ecs.config\n", " - echo HTTP_PROXY=", { "Ref": "HttpProxy" }, " >> /etc/ecs/ecs.config\n", @@ -2165,6 +2176,12 @@ ] }, " - [ cloud-init-per, instance, docker_storage_setup, /usr/bin/docker-storage-setup ]\n", " - echo ECS_CLUSTER=", { "Ref": "Cluster" }, " >> /etc/ecs/ecs.config\n", + { "Fn::If": [ "HasEcsContainerStopTimeout", + { "Fn::Join": [ "", [ + " - echo ECS_CONTAINER_STOP_TIMEOUT=", { "Ref": "EcsContainerStopTimeout" }, " >> /etc/ecs/ecs.config\n" + ] ] }, + { "Ref": "AWS::NoValue" } + ] }, " - echo ECS_ENABLE_CONTAINER_METADATA=true >> /etc/ecs/ecs.config\n", " - echo ECS_ENGINE_AUTH_TYPE=docker >> /etc/ecs/ecs.config\n", " - echo 'ECS_INSTANCE_ATTRIBUTES={\"asg\":\"primary\"}' >> /etc/ecs/ecs.config\n", @@ -2724,6 +2741,12 @@ ] }, " - [ cloud-init-per, instance, docker_storage_setup, /usr/bin/docker-storage-setup ]\n", " - echo ECS_CLUSTER=", { "Ref": "Cluster" }, " >> /etc/ecs/ecs.config\n", + { "Fn::If": [ "HasEcsContainerStopTimeout", + { "Fn::Join": [ "", [ + " - echo ECS_CONTAINER_STOP_TIMEOUT=", { "Ref": "EcsContainerStopTimeout" }, " >> /etc/ecs/ecs.config\n" + ] ] }, + { "Ref": "AWS::NoValue" } + ] }, " - echo ECS_ENABLE_CONTAINER_METADATA=true >> /etc/ecs/ecs.config\n", " - echo ECS_ENABLE_SPOT_INSTANCE_DRAINING=true >> /etc/ecs/ecs.config\n", " - echo ECS_ENGINE_AUTH_TYPE=docker >> /etc/ecs/ecs.config\n", @@ -3080,6 +3103,12 @@ ] }, " - [ cloud-init-per, instance, docker_storage_setup, /usr/bin/docker-storage-setup ]\n", " - echo ECS_CLUSTER=", { "Ref": "Cluster" }, " >> /etc/ecs/ecs.config\n", + { "Fn::If": [ "HasEcsContainerStopTimeout", + { "Fn::Join": [ "", [ + " - echo ECS_CONTAINER_STOP_TIMEOUT=", { "Ref": "EcsContainerStopTimeout" }, " >> /etc/ecs/ecs.config\n" + ] ] }, + { "Ref": "AWS::NoValue" } + ] }, " - echo ECS_ENABLE_CONTAINER_METADATA=true >> /etc/ecs/ecs.config\n", " - echo ECS_ENABLE_SPOT_INSTANCE_DRAINING=true >> /etc/ecs/ecs.config\n", " - echo ECS_ENGINE_AUTH_TYPE=docker >> /etc/ecs/ecs.config\n",