Repository: aws/amazon-ecs-cli-v2
Pull request #480 (2019-11-25 22:58:07)

Remove unused RulePriority template parameter
Removes unused functionality.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.



Patch:
diff --git a/internal/pkg/deploy/cloudformation/stack/lb_fargate_app.go b/internal/pkg/deploy/cloudformation/stack/lb_fargate_app.go
index 42363ba9..b9513ab0 100644
--- a/internal/pkg/deploy/cloudformation/stack/lb_fargate_app.go
+++ b/internal/pkg/deploy/cloudformation/stack/lb_fargate_app.go
@@ -30,7 +30,6 @@ const (
 	lbFargateParamAppNameKey        = "AppName"
 	lbFargateParamContainerImageKey = "ContainerImage"
 	lbFargateParamContainerPortKey  = "ContainerPort"
-	lbFargateRulePriorityKey        = "RulePriority"
 	lbFargateRulePathKey            = "RulePath"
 	lbFargateTaskCPUKey             = "TaskCPU"
 	lbFargateTaskMemoryKey          = "TaskMemory"
@@ -133,10 +132,6 @@ func (c *LBFargateStackConfig) Parameters() []*cloudformation.Parameter {
 			ParameterKey:   aws.String(lbFargateParamContainerPortKey),
 			ParameterValue: aws.String(strconv.Itoa(templateParams.Image.Port)),
 		},
-		{
-			ParameterKey:   aws.String(lbFargateRulePriorityKey),
-			ParameterValue: aws.String(strconv.Itoa(templateParams.Priority)),
-		},
 		{
 			ParameterKey:   aws.String(lbFargateRulePathKey),
 			ParameterValue: aws.String(templateParams.App.Path),
@@ -200,9 +195,6 @@ func (c *LBFargateStackConfig) Tags() []*cloudformation.Tag {
 type lbFargateTemplateParams struct {
 	*deploy.CreateLBFargateAppInput
 
-	// Additional fields needed to render the CloudFormation stack.
-	Priority int // Listener's rule priority https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-listeners.html#listener-rules
-
 	HTTPSEnabled string
 	// Field types to override.
 	Image struct {
@@ -222,7 +214,6 @@ func (c *LBFargateStackConfig) toTemplateParams() *lbFargateTemplateParams {
 			Env: c.Env,
 		},
 		HTTPSEnabled: strconv.FormatBool(c.httpsEnabled),
-		Priority:     1, // TODO assign a unique path priority given a path.
 		Image: struct {
 			URL  string
 			Port int
diff --git a/templates/lb-fargate-service/cf.yml b/templates/lb-fargate-service/cf.yml
index bca8bdd7..ccff0ec4 100644
--- a/templates/lb-fargate-service/cf.yml
+++ b/templates/lb-fargate-service/cf.yml
@@ -18,9 +18,6 @@ Parameters:
   ContainerPort:
     Type: Number
     Default: {{.Image.Port}}
-  RulePriority:
-    Type: Number
-    Default: {{.Priority}} # This number must be unique between rules.
   RulePath:
     Type: String
     Default: '{{.App.Path}}'
diff --git a/templates/lb-fargate-service/params.json b/templates/lb-fargate-service/params.json
index 34283e48..e432b9af 100644
--- a/templates/lb-fargate-service/params.json
+++ b/templates/lb-fargate-service/params.json
@@ -5,7 +5,6 @@
     "AppName": "{{.App.Name}}",
     "ContainerImage": "{{.Image.URL}}",
     "ContainerPort": "{{.Image.Port}}",
-    "RulePriority": "{{.Priority}}",
     "RulePath": "{{.App.Path}}",
     "TaskCPU": "{{.App.CPU}}",
     "TaskMemory": "{{.App.Memory}}",


Test patch:
diff --git a/internal/pkg/deploy/cloudformation/stack/lb_fargate_app_test.go b/internal/pkg/deploy/cloudformation/stack/lb_fargate_app_test.go
index a88cc41a..13de369f 100644
--- a/internal/pkg/deploy/cloudformation/stack/lb_fargate_app_test.go
+++ b/internal/pkg/deploy/cloudformation/stack/lb_fargate_app_test.go
@@ -116,7 +116,6 @@ func TestLBFargateStackConfig_Template(t *testing.T) {
   AppName: {{.App.Name}}
   ContainerImage: {{.Image.URL}}
   ContainerPort: {{.Image.Port}}
-  RulePriority: {{.Priority}}
   RulePath: '{{.App.Path}}'
   TaskCPU: '{{.App.CPU}}'
   TaskMemory: '{{.App.Memory}}'
@@ -129,7 +128,6 @@ func TestLBFargateStackConfig_Template(t *testing.T) {
   AppName: frontend
   ContainerImage: 12345.dkr.ecr.us-west-2.amazonaws.com/phonetool/frontend:manual-bf3678c
   ContainerPort: 80
-  RulePriority: 1
   RulePath: '*'
   TaskCPU: '256'
   TaskMemory: '512'
@@ -217,10 +215,6 @@ func TestLBFargateStackConfig_Parameters(t *testing.T) {
 					ParameterKey:   aws.String(lbFargateParamContainerPortKey),
 					ParameterValue: aws.String("80"),
 				},
-				{
-					ParameterKey:   aws.String(lbFargateRulePriorityKey),
-					ParameterValue: aws.String("1"),
-				},
 				{
 					ParameterKey:   aws.String(lbFargateRulePathKey),
 					ParameterValue: aws.String("*"),
@@ -289,7 +283,6 @@ func TestLBFargateStackConfig_SerializedParameters(t *testing.T) {
     "AppName": "{{.App.Name}}",
     "ContainerImage": "{{.Image.URL}}",
     "ContainerPort": "{{.Image.Port}}",
-    "RulePriority": "{{.Priority}}",
     "RulePath": "{{.App.Path}}",
     "TaskCPU": "{{.App.CPU}}",
     "TaskMemory": "{{.App.Memory}}",
@@ -305,7 +298,6 @@ func TestLBFargateStackConfig_SerializedParameters(t *testing.T) {
     "AppName": "frontend",
     "ContainerImage": "12345.dkr.ecr.us-west-2.amazonaws.com/phonetool/frontend:manual-bf3678c",
     "ContainerPort": "80",
-    "RulePriority": "1",
     "RulePath": "*",
     "TaskCPU": "256",
     "TaskMemory": "512",
@@ -338,7 +330,6 @@ func TestLBFargateStackConfig_SerializedParameters(t *testing.T) {
     "AppName": "{{.App.Name}}",
     "ContainerImage": "{{.Image.URL}}",
     "ContainerPort": "{{.Image.Port}}",
-    "RulePriority": "{{.Priority}}",
     "RulePath": "{{.App.Path}}",
     "TaskCPU": "{{.App.CPU}}",
     "TaskMemory": "{{.App.Memory}}",
@@ -354,7 +345,6 @@ func TestLBFargateStackConfig_SerializedParameters(t *testing.T) {
     "AppName": "frontend",
     "ContainerImage": "12345.dkr.ecr.us-west-2.amazonaws.com/phonetool/frontend:manual-bf3678c",
     "ContainerPort": "80",
-    "RulePriority": "1",
     "RulePath": "*",
     "TaskCPU": "256",
     "TaskMemory": "512",