การดีบั๊ก CloudFormation การตรวจสอบปัญหา

0

คำถาม

ผมกำลังใช้ linter และฉันต้นแบบเหมือนว่าถูกต้องของฉัน deployment คือล้มเหลวกับ"AWS::ElasticLoadBalancingV2::ListenerRule การตรวจสอบยกเว้น". นั่นดูเหมือนว่าจะเป็นอะไรที่ต้องการซ้อมลงนี้ยกเว้นในคลาวด์เตรียมตัวเดินแถวต่อของคอนโซล. ยังไงผมวางแผนทำไมของฉัน deployment ไม่ถูกต้อ?


เตรียมตัวเดินแถวต่อคลาวด์ต้นแบบ

Parameters:
  Env:
    Type: String

Mappings:
  EnvMap:
    sandbox:
      ...

Resources:
  HttpsListener:
    Type: AWS::ElasticLoadBalancingV2::Listener
    Properties:
      Certificates:
        - CertificateArn: !FindInMap [EnvMap, !Ref Env, CertificateArn]
      DefaultActions:
        - Type: forward
          ForwardConfig:
            # TODO: read all this stuff off HTTP listener
            TargetGroupStickinessConfig:
              Enabled: false
            TargetGroups:
              - TargetGroupArn:
                  !FindInMap [EnvMap, !Ref Env, LoadBalancerDefaultTargetArn]
                Weight: 1
          TargetGroupArn:
            !FindInMap [EnvMap, !Ref Env, LoadBalancerDefaultTargetArn]
      LoadBalancerArn: !FindInMap [EnvMap, !Ref Env, LoadBalancerArn]
      Port: 443
      Protocol: HTTPS

  HttpsListenerRule:
    Type: AWS::ElasticLoadBalancingV2::ListenerRule
    Properties:
      Actions:
        - Type: forward
          ForwardConfig:
            TargetGroupStickinessConfig:
              Enabled: false
            TargetGroups:
              - TargetGroupArn:
                  !FindInMap [EnvMap, !Ref Env, LoadBalancerRouteTargetArn]
                Weight: 1
          TargetGroupArn:
            !FindInMap [EnvMap, !Ref Env, LoadBalancerRouteTargetArn]
      Conditions:
        - Field: path-pattern
          PathPatternConfig:
            Values:
              - /*
          Values:
            - /*
      ListenerArn: !Ref HttpsListener
      Priority: 50000

เกิดข้อผิดพลาด

"สถานะของเหตุผล"จากเหตุการณ์.

Resource handler returned message: "Invalid request provided: AWS::ElasticLoadBalancingV2::ListenerRule Validation exception" (RequestToken: 16bd4239-0d41-b16f-2963-b0a774009dfd, HandlerErrorCode: InvalidRequest)
1

คำตอบที่ดีที่สุด

0

พยายามลบ PathConfigPattern จาก Conditions กุญแจ:

HttpsListenerRule:
  Type: AWS::ElasticLoadBalancingV2::ListenerRule
  Properties:
    Actions:
      - Type: "forward"
        ForwardConfig:
          TargetGroupStickinessConfig:
            Enabled: false
          TargetGroups:
            - TargetGroupArn: !FindInMap [ EnvMap, !Ref Env, LoadBalancerRouteTargetArn ]
              Weight: 1
        TargetGroupArn: !FindInMap [ EnvMap, !Ref Env, LoadBalancerRouteTargetArn ]
        Order: 1
    Conditions:
      - Field: path-pattern
        Values:
          - "/*"
    ListenerArn: !Ref HttpsListener
    Priority: 50000

แล้วก็ให้แน่ใจว่าของคุณ EnvMap แผนที่ดูเหมือนนี้:

Parameters:
  Env:
    Type: String
    Default: sandbox

Mappings:
  EnvMap:
    sandbox:
      LoadBalancerRouteTargetArn: "arn:aws:elasticloadbalancing:eu-west-1:111111111111:targetgroup/my-tg-1/222222222222"
    prod:
      LoadBalancerRouteTargetArn: "arn:aws:elasticloadbalancing:eu-west-1:333333333333:targetgroup/my-tg-2/444444444444"
2021-11-20 09:19:27

ในภาษาอื่นๆ

หน้านี้อยู่ในภาษาอื่นๆ

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................

ดังอยู่ในนี้หมวดหมู่

ดังคำถามอยู่ในนี้หมวดหมู่