diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7268ff8..00d8250 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: check-json - id: end-of-file-fixer @@ -10,13 +10,13 @@ repos: - id: detect-private-key - repo: https://github.com/awslabs/cfn-python-lint - rev: v1.15.2 # The version of cfn-lint to use + rev: v1.22.3 # The version of cfn-lint to use hooks: - id: cfn-python-lint files: .template\.yaml$ - repo: https://github.com/bridgecrewio/checkov.git - rev: "3.2.256" + rev: "3.2.350" hooks: - id: checkov verbose: true diff --git a/.secrets.baseline b/.secrets.baseline index 7784379..08df025 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -26,6 +26,9 @@ { "name": "GitHubTokenDetector" }, + { + "name": "GitLabTokenDetector" + }, { "name": "HexHighEntropyString", "limit": 3.0 @@ -36,6 +39,9 @@ { "name": "IbmCosHmacDetector" }, + { + "name": "IPPublicDetector" + }, { "name": "JwtTokenDetector" }, @@ -49,9 +55,15 @@ { "name": "NpmDetector" }, + { + "name": "OpenAIDetector" + }, { "name": "PrivateKeyDetector" }, + { + "name": "PypiTokenDetector" + }, { "name": "SendGridDetector" }, @@ -67,6 +79,9 @@ { "name": "StripeDetector" }, + { + "name": "TelegramBotTokenDetector" + }, { "name": "TwilioKeyDetector" } @@ -75,10 +90,6 @@ { "path": "detect_secrets.filters.allowlist.is_line_allowlisted" }, - { - "path": "detect_secrets.filters.common.is_baseline_file", - "filename": ".secrets.baseline" - }, { "path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies", "min_level": 2 @@ -281,37 +292,37 @@ "filename": "deploy/template.yaml", "hashed_secret": "b811ac90fe7fab03f6144a17aaebc38dcf3e007b", "is_verified": false, - "line_number": 72 + "line_number": 69 }, { "type": "Secret Keyword", "filename": "deploy/template.yaml", "hashed_secret": "690de9fd42add772818ae392cb68a4f81d1511e3", "is_verified": false, - "line_number": 109 + "line_number": 114 }, { "type": "Secret Keyword", "filename": "deploy/template.yaml", "hashed_secret": "b63bf00edb07af6ffba7f7ceb7ed573a913271f7", "is_verified": false, - "line_number": 636 + "line_number": 643 }, { "type": "Secret Keyword", "filename": "deploy/template.yaml", "hashed_secret": "42af5cf9fcf4f09147c032a0fb4877f5cf626bbc", "is_verified": false, - "line_number": 637 + "line_number": 644 }, { "type": "Secret Keyword", "filename": "deploy/template.yaml", "hashed_secret": "7584a31168b8e8f62d9b84b7b95d239b99fad815", "is_verified": false, - "line_number": 639 + "line_number": 646 } ] }, - "generated_at": "2025-01-07T17:50:34Z" + "generated_at": "2025-01-17T13:13:51Z" } diff --git a/deploy/template.yaml b/deploy/template.yaml index 5396999..5e29341 100644 --- a/deploy/template.yaml +++ b/deploy/template.yaml @@ -52,9 +52,6 @@ Conditions: - !Equals [!Ref Environment, integration] - !Equals [!Ref Environment, production] IsProduction: !Equals [!Ref Environment, production] - IsPerformance: !Or - - !Equals [!Ref Environment, build] - - !Equals [!Ref Environment, production] DeployAlarms: !Or - Condition: IsNotDevelopment - !Equals [!Ref DeployAlarmsInDev, true] @@ -76,6 +73,8 @@ Mappings: uaEnabled: "true" languageToggleDisabled: "false" authSourceEnabled: "true" + minECSCount: 1 + maxECSCount: 4 build: logLevel: "info" dynatraceSecretArn: arn:aws:secretsmanager:eu-west-2:216552277552:secret:DynatraceNonProductionVariables @@ -85,6 +84,8 @@ Mappings: uaEnabled: "true" languageToggleDisabled: "false" authSourceEnabled: "true" + minECSCount: 6 + maxECSCount: 60 staging: logLevel: "warn" dynatraceSecretArn: arn:aws:secretsmanager:eu-west-2:216552277552:secret:DynatraceNonProductionVariables @@ -95,6 +96,8 @@ Mappings: uaEnabled: "true" languageToggleDisabled: "false" authSourceEnabled: "true" + minECSCount: 2 + maxECSCount: 4 integration: logLevel: "warn" dynatraceSecretArn: arn:aws:secretsmanager:eu-west-2:216552277552:secret:DynatraceNonProductionVariables @@ -104,6 +107,8 @@ Mappings: uaEnabled: "true" languageToggleDisabled: "false" authSourceEnabled: "false" + minECSCount: 2 + maxECSCount: 4 production: logLevel: "warn" dynatraceSecretArn: arn:aws:secretsmanager:eu-west-2:216552277552:secret:DynatraceProductionVariables @@ -113,6 +118,8 @@ Mappings: uaEnabled: "true" languageToggleDisabled: "false" authSourceEnabled: "false" + minECSCount: 6 + maxECSCount: 60 # see https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-access-logs.html ElasticLoadBalancerAccountIds: @@ -810,22 +817,36 @@ Resources: # ECS Autoscaling ECSAutoScalingTarget: - Condition: IsPerformance Type: AWS::ApplicationAutoScaling::ScalableTarget Properties: - MinCapacity: 6 - MaxCapacity: 60 - ResourceId: !Join - - "/" - - - "service" - - !Ref DrivingPermitFrontEcsCluster - - !GetAtt DrivingPermitFrontEcsService.Name + MaxCapacity: + !FindInMap [EnvironmentConfiguration, !Ref Environment, maxECSCount] + MinCapacity: + !FindInMap [EnvironmentConfiguration, !Ref Environment, minECSCount] + ResourceId: !Sub service/${DrivingPermitFrontEcsCluster}/${DrivingPermitFrontEcsService.Name} RoleARN: !Sub "arn:aws:iam::${AWS::AccountId}:role/aws-service-role/ecs.application-autoscaling.amazonaws.com/AWSServiceRoleForApplicationAutoScaling_ECSService" ScalableDimension: ecs:service:DesiredCount ServiceNamespace: ecs + ECSPredictiveScalingPolicy: + DependsOn: ECSAutoScalingTarget + Type: AWS::ApplicationAutoScaling::ScalingPolicy + Properties: + PolicyName: ECSPredictiveScalingPolicy + PolicyType: PredictiveScaling + ResourceId: !Sub service/${DrivingPermitFrontEcsCluster}/${DrivingPermitFrontEcsService.Name} + ScalableDimension: ecs:service:DesiredCount + ServiceNamespace: ecs + PredictiveScalingPolicyConfiguration: + MaxCapacityBreachBehavior: HonorMaxCapacity + MetricSpecifications: + - PredefinedMetricPairSpecification: + PredefinedMetricType: ECSServiceCPUUtilization + TargetValue: 60 + Mode: ForecastOnly + SchedulingBufferTime: 600 + EcsStepScaleOutPolicy: - Condition: IsPerformance DependsOn: ECSAutoScalingTarget Type: AWS::ApplicationAutoScaling::ScalingPolicy Properties: @@ -867,7 +888,6 @@ Resources: # on Fargate, so leave the upper bound open EcsStepScaleInPolicy: - Condition: IsPerformance DependsOn: ECSAutoScalingTarget Type: AWS::ApplicationAutoScaling::ScalingPolicy Properties: @@ -898,7 +918,6 @@ Resources: # with <20% utilisation EcsStepScaleOutAlarm: - Condition: IsPerformance DependsOn: ECSAutoScalingTarget Type: AWS::CloudWatch::Alarm Properties: @@ -922,7 +941,6 @@ Resources: Threshold: "60" EcsStepScaleInAlarm: - Condition: IsPerformance DependsOn: ECSAutoScalingTarget Type: AWS::CloudWatch::Alarm Properties: