serverless-aws-nested-stacks无法创建嵌套堆栈

时间:2020-06-08 22:07:29

标签: amazon-web-services yaml amazon-cloudformation serverless

我正在使用“ serverless-aws-nested-stacks”插件与父堆栈一起创建嵌套堆栈。

但是我不能同时创建两个堆栈。

这是我的yml文件:

serverless.yml

service: test-nested

provider:
  name: aws
  runtime: python3.8

functions:
  helloNestedMain:
    handler: handler.hello

resources:
 Resources:
    NewBucketXXXTestMain:
      Type: AWS::S3::Bucket
      Properties:
        BucketName: xxx-new-bucket-main

plugins:
  - serverless-aws-nested-stacks

custom:
  nested-stacks:
    location: "nestedstack"
    stacks:
      - id: Testnested
        template: testnested.yml

testnested.yml

service: testnested

provider:
  name: aws
  runtime: python3.8

functions:
  hellonested:
    handler: nested-handler.hello

resources:
 Resources:
    NewBucketXXXTestNested:
      Type: AWS::S3::Bucket
      Properties:
        BucketName: xxx-new-bucket-nested

当我执行“ sls deploy -v”时,它显示:

Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Creating nested stacks in Cloudformation...
Serverless: Stack: testnested.yml
Serverless: Creating Stack...
Serverless: Checking Stack create progress...
CloudFormation - CREATE_IN_PROGRESS - AWS::CloudFormation::Stack - test-nested-dev
CloudFormation - CREATE_IN_PROGRESS - AWS::S3::Bucket - ServerlessDeploymentBucket
CloudFormation - CREATE_IN_PROGRESS - AWS::S3::Bucket - ServerlessDeploymentBucket
CloudFormation - CREATE_COMPLETE - AWS::S3::Bucket - ServerlessDeploymentBucket
CloudFormation - CREATE_IN_PROGRESS - AWS::S3::BucketPolicy - ServerlessDeploymentBucketPolicy
CloudFormation - CREATE_IN_PROGRESS - AWS::S3::BucketPolicy - ServerlessDeploymentBucketPolicy
CloudFormation - CREATE_COMPLETE - AWS::S3::BucketPolicy - ServerlessDeploymentBucketPolicy
CloudFormation - CREATE_COMPLETE - AWS::CloudFormation::Stack - test-nested-dev
Serverless: Stack create finished...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service test-nested.zip file to S3 (1.16 KB)...
Serverless: Validating template...
Serverless: Uploading nested stacks to S3...
Serverless: Stack: testnested.yml
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - HelloNestedMain2LogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::S3::Bucket - NewBucketXXXTestMain
CloudFormation - CREATE_IN_PROGRESS - AWS::CloudFormation::Stack - Testnested
CloudFormation - CREATE_IN_PROGRESS - AWS::IAM::Role - IamRoleLambdaExecution
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - HelloNestedMain2LogGroup
CloudFormation - CREATE_FAILED - AWS::CloudFormation::Stack - Testnested
CloudFormation - CREATE_IN_PROGRESS - AWS::IAM::Role - IamRoleLambdaExecution
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - HelloNestedMain2LogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::S3::Bucket - NewBucketXXXTestMain
CloudFormation - CREATE_FAILED - AWS::S3::Bucket - NewBucketXXXTestMain
CloudFormation - CREATE_FAILED - AWS::IAM::Role - IamRoleLambdaExecution
CloudFormation - UPDATE_ROLLBACK_IN_PROGRESS - AWS::CloudFormation::Stack - test-nested-dev
CloudFormation - UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS - AWS::CloudFormation::Stack - test-nested-dev
CloudFormation - DELETE_COMPLETE - AWS::CloudFormation::Stack - Testnested
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - HelloNestedMain2LogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::S3::Bucket - NewBucketXXXTestMain
CloudFormation - DELETE_IN_PROGRESS - AWS::IAM::Role - IamRoleLambdaExecution
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - HelloNestedMain2LogGroup
CloudFormation - DELETE_COMPLETE - AWS::S3::Bucket - NewBucketXXXTestMain
CloudFormation - DELETE_COMPLETE - AWS::IAM::Role - IamRoleLambdaExecution
CloudFormation - UPDATE_ROLLBACK_COMPLETE - AWS::CloudFormation::Stack - test-nested-dev
Serverless: Operation failed!
Serverless: View the full error output: https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stack/detail?

  Serverless Error ---------------------------------------

  An error occurred: Testnested - Template format error: At least one Resources member must be defined..

我单独部署这两个堆栈没有问题,这可能表明我定义资源的方式没有问题,但是当我想使用嵌套堆栈时会发生此问题。

0 个答案:

没有答案
相关问题