Skip to content

Commit

Permalink
allows passing -1 as desired count to not set a value for DesiredCoun…
Browse files Browse the repository at this point in the history
…t on the service
  • Loading branch information
aaronwalker committed Feb 16, 2022
1 parent 65cf74d commit 911958d
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 15 deletions.
3 changes: 2 additions & 1 deletion ecs-service.cfndsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
tags << { Key: "EnvironmentType", Value: Ref("EnvironmentType") }

Condition('IsScalingEnabled', FnEquals(Ref('EnableScaling'), 'true'))
Condition('NoDesiredCount', FnEquals(Ref('DesiredCount'), '-1'))

log_retention = external_parameters.fetch(:log_retention, 7)
loggroup_name = external_parameters.fetch(:loggroup_name, Ref('AWS::StackName'))
Expand Down Expand Up @@ -494,7 +495,7 @@
end
Cluster Ref("EcsCluster")
HealthCheckGracePeriodSeconds health_check_grace_period if !health_check_grace_period.nil?
DesiredCount Ref('DesiredCount') if strategy != 'DAEMON'
DesiredCount FnIf('NoDesiredCount', Ref('AWS::NoValue'), Ref('DesiredCount')) if strategy != 'DAEMON'
DeploymentConfiguration ({
MinimumHealthyPercent: Ref('MinimumHealthyPercent'),
MaximumPercent: Ref('MaximumPercent')
Expand Down
2 changes: 1 addition & 1 deletion spec/extra_hosts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
end

it "to have property DesiredCount" do
expect(resource["Properties"]["DesiredCount"]).to eq({"Ref"=>"DesiredCount"})
expect(resource["Properties"]["DesiredCount"]).to eq({"Fn::If" => ["NoDesiredCount", {"Ref"=>"AWS::NoValue"}, {"Ref"=>"DesiredCount"}]})
end

it "to have property DeploymentConfiguration" do
Expand Down
2 changes: 1 addition & 1 deletion spec/fargate_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
end

it "to have property DesiredCount" do
expect(resource["Properties"]["DesiredCount"]).to eq({"Ref"=>"DesiredCount"})
expect(resource["Properties"]["DesiredCount"]).to eq({"Fn::If" => ["NoDesiredCount", {"Ref"=>"AWS::NoValue"}, {"Ref"=>"DesiredCount"}]})
end

it "to have property DeploymentConfiguration" do
Expand Down
2 changes: 1 addition & 1 deletion spec/linux_parameters_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
end

it "to have property DesiredCount" do
expect(resource["Properties"]["DesiredCount"]).to eq({"Ref"=>"DesiredCount"})
expect(resource["Properties"]["DesiredCount"]).to eq({"Fn::If" => ["NoDesiredCount", {"Ref"=>"AWS::NoValue"}, {"Ref"=>"DesiredCount"}]})
end

it "to have property DeploymentConfiguration" do
Expand Down
2 changes: 1 addition & 1 deletion spec/multiple_links_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
end

it "to have property DesiredCount" do
expect(resource["Properties"]["DesiredCount"]).to eq({"Ref"=>"DesiredCount"})
expect(resource["Properties"]["DesiredCount"]).to eq({"Fn::If" => ["NoDesiredCount", {"Ref"=>"AWS::NoValue"}, {"Ref"=>"DesiredCount"}]})
end

it "to have property DeploymentConfiguration" do
Expand Down
2 changes: 1 addition & 1 deletion spec/multiple_scaling_policies_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
end

it "to have property DesiredCount" do
expect(resource["Properties"]["DesiredCount"]).to eq({"Ref"=>"DesiredCount"})
expect(resource["Properties"]["DesiredCount"]).to eq({"Fn::If" => ["NoDesiredCount", {"Ref"=>"AWS::NoValue"}, {"Ref"=>"DesiredCount"}]})
end

it "to have property DeploymentConfiguration" do
Expand Down
2 changes: 1 addition & 1 deletion spec/multiple_target_groups_parameter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
end

it "to have property DesiredCount" do
expect(resource["Properties"]["DesiredCount"]).to eq({"Ref"=>"DesiredCount"})
expect(resource["Properties"]["DesiredCount"]).to eq({"Fn::If" => ["NoDesiredCount", {"Ref"=>"AWS::NoValue"}, {"Ref"=>"DesiredCount"}]})
end

it "to have property DeploymentConfiguration" do
Expand Down
2 changes: 1 addition & 1 deletion spec/multiple_target_groups_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
end

it "to have property DesiredCount" do
expect(resource["Properties"]["DesiredCount"]).to eq({"Ref"=>"DesiredCount"})
expect(resource["Properties"]["DesiredCount"]).to eq({"Fn::If" => ["NoDesiredCount", {"Ref"=>"AWS::NoValue"}, {"Ref"=>"DesiredCount"}]})
end

it "to have property DeploymentConfiguration" do
Expand Down
2 changes: 1 addition & 1 deletion spec/nginx_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
end

it "to have property DesiredCount" do
expect(resource["Properties"]["DesiredCount"]).to eq({"Ref"=>"DesiredCount"})
expect(resource["Properties"]["DesiredCount"]).to eq({"Fn::If" => ["NoDesiredCount", {"Ref"=>"AWS::NoValue"}, {"Ref"=>"DesiredCount"}]})
end

it "to have property DeploymentConfiguration" do
Expand Down
2 changes: 1 addition & 1 deletion spec/scheduling_strategy_replica_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
end

it "to have property DesiredCount" do
expect(resource["Properties"]["DesiredCount"]).to eq({"Ref"=>"DesiredCount"})
expect(resource["Properties"]["DesiredCount"]).to eq({"Fn::If" => ["NoDesiredCount", {"Ref"=>"AWS::NoValue"}, {"Ref"=>"DesiredCount"}]})
end

it "to have property DeploymentConfiguration" do
Expand Down
2 changes: 1 addition & 1 deletion spec/secrets_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
end

it "to have property DesiredCount" do
expect(resource["Properties"]["DesiredCount"]).to eq({"Ref"=>"DesiredCount"})
expect(resource["Properties"]["DesiredCount"]).to eq({"Fn::If" => ["NoDesiredCount", {"Ref"=>"AWS::NoValue"}, {"Ref"=>"DesiredCount"}]})
end

it "to have property DeploymentConfiguration" do
Expand Down
2 changes: 1 addition & 1 deletion spec/security_group_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
end

it "to have property DesiredCount" do
expect(resource["Properties"]["DesiredCount"]).to eq({"Ref"=>"DesiredCount"})
expect(resource["Properties"]["DesiredCount"]).to eq({"Fn::If" => ["NoDesiredCount", {"Ref"=>"AWS::NoValue"}, {"Ref"=>"DesiredCount"}]})
end

it "to have property DeploymentConfiguration" do
Expand Down
2 changes: 1 addition & 1 deletion spec/task_placement_constraint_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
end

it "to have property DesiredCount" do
expect(resource["Properties"]["DesiredCount"]).to eq({"Ref"=>"DesiredCount"})
expect(resource["Properties"]["DesiredCount"]).to eq({"Fn::If" => ["NoDesiredCount", {"Ref"=>"AWS::NoValue"}, {"Ref"=>"DesiredCount"}]})
end

it "to have property DeploymentConfiguration" do
Expand Down
2 changes: 1 addition & 1 deletion spec/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
end

it "to have property DesiredCount" do
expect(resource["Properties"]["DesiredCount"]).to eq({"Ref"=>"DesiredCount"})
expect(resource["Properties"]["DesiredCount"]).to eq({"Fn::If" => ["NoDesiredCount", {"Ref"=>"AWS::NoValue"}, {"Ref"=>"DesiredCount"}]})
end

it "to have property DeploymentConfiguration" do
Expand Down
2 changes: 1 addition & 1 deletion spec/volumes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
end

it "to have property DesiredCount" do
expect(resource["Properties"]["DesiredCount"]).to eq({"Ref"=>"DesiredCount"})
expect(resource["Properties"]["DesiredCount"]).to eq({"Fn::If" => ["NoDesiredCount", {"Ref"=>"AWS::NoValue"}, {"Ref"=>"DesiredCount"}]})
end

it "to have property DeploymentConfiguration" do
Expand Down

0 comments on commit 911958d

Please sign in to comment.