From fea17dd162951e07fac6218a454f9b381ce5227e Mon Sep 17 00:00:00 2001 From: Cintia Del Rio Calvo Date: Wed, 8 Apr 2020 16:36:05 +1000 Subject: [PATCH] Allow empty launchtype (uses default capacity provider) --- ecs-service.cfhighlander.rb | 1 + ecs-service.cfndsl.rb | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ecs-service.cfhighlander.rb b/ecs-service.cfhighlander.rb index 3dfe414..b2644b8 100644 --- a/ecs-service.cfhighlander.rb +++ b/ecs-service.cfhighlander.rb @@ -36,6 +36,7 @@ ComponentParam 'SubnetIds', type: 'CommaDelimitedList' ComponentParam 'SecurityGroupBackplane' ComponentParam 'EnableFargate', 'false' + ComponentParam 'DisableLaunchType', 'false' end task_definition.each do |task_def, task| diff --git a/ecs-service.cfndsl.rb b/ecs-service.cfndsl.rb index 7b7bf75..06843e1 100644 --- a/ecs-service.cfndsl.rb +++ b/ecs-service.cfndsl.rb @@ -7,6 +7,7 @@ if network_mode == 'awsvpc' awsvpc_enabled = true Condition('IsFargate', FnEquals(Ref('EnableFargate'), 'true')) + Condition('IsEmptyLaunchType', FnEquals(Ref('DisableLaunchType'), 'true')) end tags = [] @@ -433,7 +434,7 @@ ECS_Service('Service') do DependsOn rule_names if rule_names.any? if awsvpc_enabled - LaunchType FnIf('IsFargate', 'FARGATE', 'EC2') + LaunchType FnIf('IsEmptyLaunchType', Ref('AWS::NoValue'), FnIf('IsFargate', 'FARGATE', 'EC2')) end Cluster Ref("EcsCluster") HealthCheckGracePeriodSeconds health_check_grace_period if !health_check_grace_period.nil?