使用!包括格式错误的结果

问题描述 投票:0回答:1

我有一个如下所示的cloudformation模板:

AWSTemplateFormatVersion: '2010-09-09'
Description: Static RSS Stack
Parameters:
  AuthName:
    Type: String
    Description: Unique Auth Name for Cognito Resources

Transform: AWS::Include
Resources:
  - !Include 's3://paulweilerv2-cf-ymls/cognito.yml'
  - !Include 's3://paulweilerv2-cf-ymls/s3bucket.yml'

Outputs:
  UserPoolId:
    Value: !Ref UserPool
    Export:
      Name: "UserPool::Id"
  UserPoolClientId:
    Value: !Ref UserPoolClient
    Export:
      Name: "UserPoolClient::Id"
  IdentityPoolId:
    Value: !Ref IdentityPool
    Export:
      Name: "IdentityPool::Id"

我已验证每个孩子都是有效的,但每次我尝试使用

aws cloudformation validate-template
进行验证时都会收到错误

An error occurred (ValidationError) when calling the CreateStack operation: Template format error: YAML not well-formed. (line 17, column 5)

指的是第一个

!Include
。我的格式有什么问题吗?引用的 YML 已链接:

https://paulweilerv2-cf-ymls.s3.amazonaws.com/cognito.yml

https://paulweilerv2-cf-ymls.s3.amazonaws.com/s3bucket.yml

templates aws-cloudformation
1个回答
0
投票

您可以尝试使用下面的模板吗?

AWSTemplateFormatVersion: '2010-09-09'
Description: Static RSS Stack
Parameters:
  AuthName:
    Type: String
    Description: Unique Auth Name for Cognito Resources

Transform:
  Name: 'AWS::Include'
  Parameters:
    Location: 
      - 's3://paulweilerv2-cf-ymls/cognito.yml'
      - 's3://paulweilerv2-cf-ymls/s3bucket.yml'

Outputs:
  UserPoolId:
    Value: !Ref UserPool
    Export:
      Name: "UserPool::Id"
  UserPoolClientId:
    Value: !Ref UserPoolClient
    Export:
      Name: "UserPoolClient::Id"
  IdentityPoolId:
    Value: !Ref IdentityPool
    Export:
      Name: "IdentityPool::Id"

© www.soinside.com 2019 - 2024. All rights reserved.