运行cloudformation模板后缺少某些ListenerRule

时间:2019-03-26 07:44:19

标签: amazon-cloudformation

我正在尝试添加多个侦听器规则,以将流量从RedirectionDomain重定向到RedirectionTargetDomain,但是在运行CF模板后,缺少某些规则。

我尝试更改名称和优先级,但这只会更改消失的项目

参数:

RedirectionTargetDomain-重定向目标

RedirectionDomain-要重定向的域

条件:

CreateAdditionalHttpRedirectRule-检查是否提供了2个参数

    PrimeGroupELBHttpListenerRuleNonWww:
        Type: AWS::ElasticLoadBalancingV2::ListenerRule
        Condition: CreateAdditionalHttpRedirectRule
        Properties:
            Actions:
            -
                Type: redirect
                RedirectConfig:
                    Host: !Ref RedirectionTargetDomain
                    Path: "/#{path}"
                    Port: 443
                    Protocol: HTTPS
                    StatusCode: HTTP_301
            Conditions:
            - 
                Field: host-header
                Values:
                    - !Ref RedirectionDomain
            ListenerArn: !Ref PrimeGroupELBHttpListener
            Priority: 1000

    PrimeGroupELBHttpListenerRuleWww:
        Type: AWS::ElasticLoadBalancingV2::ListenerRule
        Condition: CreateAdditionalHttpRedirectRule
        Properties:
            Actions:
            -
                Type: redirect
                RedirectConfig:
                    Host: !Join [ '', [ 'www.', !Ref RedirectionTargetDomain ] ]
                    Path: "/#{path}"
                    Port: 443
                    Protocol: HTTPS
                    StatusCode: HTTP_301
            Conditions:
            - 
                Field: host-header
                Values:
                    - !Join [ '', [ 'www.', !Ref RedirectionDomain ] ]
            ListenerArn: !Ref PrimeGroupELBHttpListener
            Priority: 900

    PrimeGroupELBHttpListenerRuleWildcards:
        Type: AWS::ElasticLoadBalancingV2::ListenerRule
        Condition: CreateAdditionalHttpRedirectRule
        Properties:
            Actions:
            -
                Type: redirect
                RedirectConfig:
                    Host: !Ref RedirectionTargetDomain
                    Path: "/#{path}"
                    Port: 443
                    Protocol: HTTPS
                    StatusCode: HTTP_301
            Conditions:
            - 
                Field: host-header
                Values:
                    - !Join [ '', [ '*.', !Ref RedirectionDomain ] ]
            ListenerArn: !Ref PrimeGroupELBHttpListener
            Priority: 950

    PrimeGroupELBHttpListenerRuleTesting:
        Type: AWS::ElasticLoadBalancingV2::ListenerRule
        Condition: CreateAdditionalHttpRedirectRule
        Properties:
            Actions:
            -
                Type: redirect
                RedirectConfig:
                    Host: !Join [ '', [ 'testing.', !Ref RedirectionTargetDomain ] ]
                    Path: "/#{path}"
                    Port: 443
                    Protocol: HTTPS
                    StatusCode: HTTP_301
            Conditions:
            - 
                Field: host-header
                Values:
                    - !Join [ '', [ 'testing.', !Ref RedirectionDomain ] ]
            ListenerArn: !Ref PrimeGroupELBHttpListener
            Priority: 800

    PrimeGroupELBHttpListenerRuleTestingApi:
        Type: AWS::ElasticLoadBalancingV2::ListenerRule
        Condition: CreateAdditionalHttpRedirectRule
        Properties:
            Actions:
            -
                Type: redirect
                RedirectConfig:
                    Host: !Join [ '', [ 'testing-api.', !Ref RedirectionTargetDomain ] ]
                    Path: "/#{path}"
                    Port: 443
                    Protocol: HTTPS
                    StatusCode: HTTP_301
            Conditions:
            - 
                Field: host-header
                Values:
                    - !Join [ '', [ 'testing-api.', !Ref RedirectionDomain ] ]
            ListenerArn: !Ref PrimeGroupELBHttpListener
            Priority: 700

我希望在运行构建后添加5条规则。但这只会导致3条规则。

0 个答案:

没有答案