diff --git a/internal/pkg/template/templates/workloads/partials/cf/autoscaling.yml b/internal/pkg/template/templates/workloads/partials/cf/autoscaling.yml index fca1f967c9c..57b07991fec 100644 --- a/internal/pkg/template/templates/workloads/partials/cf/autoscaling.yml +++ b/internal/pkg/template/templates/workloads/partials/cf/autoscaling.yml @@ -81,7 +81,7 @@ AutoScalingPolicyECSServiceAverageMemoryUtilization: ScaleOutCooldown: 60 TargetValue: {{.Autoscaling.Memory}} {{- end}} -{{- if (and .Subscribe .Autoscaling.QueueDelay) }} +{{- if .Autoscaling.QueueDelay }} BacklogPerTaskCalculatorLogGroup: Type: AWS::Logs::LogGroup Properties: @@ -117,11 +117,13 @@ BacklogPerTaskCalculatorFunction: Fn::Join: - ',' - - !GetAtt EventsQueue.QueueName + {{- if .Subscribe }} {{- range $topic := .Subscribe.Topics }} {{- if $topic.Queue }} - !GetAtt {{logicalIDSafe $topic.Service}}{{logicalIDSafe $topic.Name}}EventsQueue.QueueName {{- end }} {{- end }} + {{- end }} BacklogPerTaskCalculatorRole: Type: AWS::IAM::Role @@ -161,11 +163,13 @@ BacklogPerTaskCalculatorRole: - sqs:GetQueueUrl Resource: - !GetAtt EventsQueue.Arn + {{- if .Subscribe }} {{- range $topic := .Subscribe.Topics}} {{- if $topic.Queue}} - !GetAtt {{logicalIDSafe $topic.Service}}{{logicalIDSafe $topic.Name}}EventsQueue.Arn {{- end }} {{- end }} + {{- end }} ManagedPolicyArns: - !Sub arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole @@ -213,6 +217,7 @@ AutoScalingPolicyEventsQueue: Unit: Count TargetValue: {{$acceptableBacklog}} +{{- if .Subscribe }} {{- range $topic := .Subscribe.Topics}} {{- if $topic.Queue}} AutoScalingPolicy{{logicalIDSafe $topic.Service}}{{logicalIDSafe $topic.Name}}EventsQueue: @@ -235,7 +240,8 @@ AutoScalingPolicy{{logicalIDSafe $topic.Service}}{{logicalIDSafe $topic.Name}}Ev Value: !GetAtt {{logicalIDSafe $topic.Service}}{{logicalIDSafe $topic.Name}}EventsQueue.QueueName Unit: Count TargetValue: {{$acceptableBacklog}} -{{- end }}{{/* range $topic := .Subscribe.Topics */}} {{- end }}{{/* if $topic.Queue */}} +{{- end }}{{/* range $topic := .Subscribe.Topics */}} +{{- end }}{{/* if .Subscribe */}} -{{- end }}{{/* if (and .Subscribe .Autoscaling.QueueDelay) */}} \ No newline at end of file +{{- end }}{{/* if .Autoscaling.QueueDelay */}} \ No newline at end of file