Skip to content

Commit

Permalink
adding conditional logic on parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
numcys committed Nov 7, 2024
1 parent 8a342a0 commit dcd8305
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions provider/aws/formation/rack.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" }, "" ] },
Expand Down Expand Up @@ -789,8 +790,7 @@
},
"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",
"Default": "30s"
"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",
Expand Down Expand Up @@ -1928,7 +1928,12 @@
] },
" - echo ECS_CLUSTER=", { "Ref": "BuildCluster" }, " >> /etc/ecs/ecs.config\n",
" - echo ECS_IMAGE_PULL_BEHAVIOR=", { "Ref": "ImagePullBehavior" }, " >> /etc/ecs/ecs.config\n",
" - echo ECS_CONTAINER_STOP_TIMEOUT=", { "Ref": "EcsContainerStopTimeout" }, " >> /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",
Expand Down Expand Up @@ -2171,7 +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",
" - echo ECS_CONTAINER_STOP_TIMEOUT=", { "Ref": "EcsContainerStopTimeout" }, " >> /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",
Expand Down Expand Up @@ -2731,7 +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",
" - echo ECS_CONTAINER_STOP_TIMEOUT=", { "Ref": "EcsContainerStopTimeout" }, " >> /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",
Expand Down Expand Up @@ -3088,7 +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",
" - echo ECS_CONTAINER_STOP_TIMEOUT=", { "Ref": "EcsContainerStopTimeout" }, " >> /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",
Expand Down

0 comments on commit dcd8305

Please sign in to comment.