无法解析 "serverless.yml":映射条目的错误缩进
Cannot parse "serverless.yml": bad indentation of a mapping entry
我包括了在外部文件中定义的各种资源,我在资源部分也有输出变量。
resources:
- ${file(resources/api-gateway-errors.yml)}
- ${file(resources/dynamodb-table.yml)}
- ${file(resources/cognito-user-pool.yml)}
- ${file(resources/cognito-identity-pool.yml)}
Outputs:
CampaignStateMachine:
Value: !Ref CreateCampaignStateFunction
ProspectStateMachine:
Value: !Ref ProspectCreateStateFunction
使用上面的代码,我得到以下错误:
Cannot parse "serverless.yml": bad indentation of a mapping entry in "/Users/user/serverless/outreachful-api/serverless.yml" (101:3)
98 | - ${file(resources/dynamodb-tab ...
99 | - ${file(resources/cognito-user ...
100 | - ${file(resources/cognito-iden ...
101 | Outputs:
---------^
102 | CampaignStateMachine:
103 | Value: !Ref CreateCampaignS ...
如果我删除所有外部文件并仅保留输出,则不会出现错误:
resources:
Outputs:
CampaignStateMachine:
Value: !Ref CreateCampaignStateFunction
ProspectStateMachine:
Value: !Ref ProspectCreateStateFunction
在通过外部文件包含资源以及具有输出变量时,我应该如何解决这个糟糕的缩进问题?
提前致谢。
实际上,我正在寻找配置资源部分的混合方法。我在 多个配置文件 部分找到了指南 here。
没有看到您尝试导入的示例文件有点困难,但通过查看您的配置,您似乎在 yaml 配置中混合了数组表示法和对象表示法。我相信 Outputs
也应该是数组的一项,所以像这样:
resources:
- ${file(resources/api-gateway-errors.yml)}
- ${file(resources/dynamodb-table.yml)}
- ${file(resources/cognito-user-pool.yml)}
- ${file(resources/cognito-identity-pool.yml)}
- Outputs:
CampaignStateMachine:
Value: !Ref CreateCampaignStateFunction
ProspectStateMachine:
Value: !Ref ProspectCreateStateFunction
我包括了在外部文件中定义的各种资源,我在资源部分也有输出变量。
resources:
- ${file(resources/api-gateway-errors.yml)}
- ${file(resources/dynamodb-table.yml)}
- ${file(resources/cognito-user-pool.yml)}
- ${file(resources/cognito-identity-pool.yml)}
Outputs:
CampaignStateMachine:
Value: !Ref CreateCampaignStateFunction
ProspectStateMachine:
Value: !Ref ProspectCreateStateFunction
使用上面的代码,我得到以下错误:
Cannot parse "serverless.yml": bad indentation of a mapping entry in "/Users/user/serverless/outreachful-api/serverless.yml" (101:3)
98 | - ${file(resources/dynamodb-tab ...
99 | - ${file(resources/cognito-user ...
100 | - ${file(resources/cognito-iden ...
101 | Outputs:
---------^
102 | CampaignStateMachine:
103 | Value: !Ref CreateCampaignS ...
如果我删除所有外部文件并仅保留输出,则不会出现错误:
resources:
Outputs:
CampaignStateMachine:
Value: !Ref CreateCampaignStateFunction
ProspectStateMachine:
Value: !Ref ProspectCreateStateFunction
在通过外部文件包含资源以及具有输出变量时,我应该如何解决这个糟糕的缩进问题?
提前致谢。
实际上,我正在寻找配置资源部分的混合方法。我在 多个配置文件 部分找到了指南 here。
没有看到您尝试导入的示例文件有点困难,但通过查看您的配置,您似乎在 yaml 配置中混合了数组表示法和对象表示法。我相信 Outputs
也应该是数组的一项,所以像这样:
resources:
- ${file(resources/api-gateway-errors.yml)}
- ${file(resources/dynamodb-table.yml)}
- ${file(resources/cognito-user-pool.yml)}
- ${file(resources/cognito-identity-pool.yml)}
- Outputs:
CampaignStateMachine:
Value: !Ref CreateCampaignStateFunction
ProspectStateMachine:
Value: !Ref ProspectCreateStateFunction