提供的请求无效:AWS::ElasticLoadBalancingV2::ListenerRule 验证异常

Igo*_*aes 6 amazon-web-services aws-cloudformation

我需要使用 CloudFormation 创建 TargetGroup 和 ListenerRule,但收到错误。

我的云形成:

TargetGroup:
    Type: AWS::ElasticLoadBalancingV2::TargetGroup
    Properties:
      Name: !Sub ${StackName}-alb
      VpcId: !Ref VpcId
      Port: !Ref ContainerPort
      Protocol: HTTP
      Matcher:
        HttpCode: 200
      HealthCheckIntervalSeconds: 10
      HealthCheckPath: !Ref HealthCheckPath
      HealthCheckProtocol: HTTP
      HealthCheckTimeoutSeconds: 5
      HealthyThresholdCount: 2
      TargetType: ip
      TargetGroupAttributes:
        - Key: deregistration_delay.timeout_seconds
          Value: 30

  ListenerRule:
    Type: AWS::ElasticLoadBalancingV2::ListenerRule
    DependsOn: 
      - TargetGroup
    Properties:
      Actions:
        - Type: forward
          TargetGroupArn: !Ref TargetGroup
      Conditions:
        - Field: host-header
          Values:
            - "www.mydominian.*"
      ListenerArn: !Ref ListenerArn
      Priority: 164
Run Code Online (Sandbox Code Playgroud)

提供的请求无效 所以,错误是图像

Pat*_*ron 0

AWS::StackName看起来好像缺少AWS::前缀


建议在VSCode中尝试使用CloudFormation Linter,在创作模板以及自动完成和文档链接时查看其中的一些内联错误:

Visual Studio 代码扩展

[cfn-lint] E1019: Parameter StackName for Fn::Sub not found at Resources/TargetGroup/Properties/Name/Fn::Sub
Run Code Online (Sandbox Code Playgroud)