iamRoleStatements yaml serverless 上的错误缩进

Bad indentation on iamRoleStatements yaml serverless

我正在 serverless.yml 文件中为我的 Lambda 函数创建角色声明,但我一直收到此错误

"bad indentation of a mapping entry"

文件是这样的:

iamRoleStatements: 
    - Effect: "Allow"
    Action:
        - "sns:Publish"
    Resource: "arn:aws:sns:*:*:*"
    - Effect: "Allow"
    Action:
        - "logs:CreateLogGroup"
    Resource: "arn:aws:logs:us-east-1:888186450240:*"
iamRoleStatements: 
    - Effect: "Allow"
      Action:
        - "sns:Publish"
      Resource: "arn:aws:sns:*:*:*"
    - Effect: "Allow"
      Action:
        - "logs:CreateLogGroup"
      Resource: "arn:aws:logs:us-east-1:888186450240:*"

iamRoleStatements 是对象数组