6
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

serverless.ymlテンプレートファイルを分割する

Posted at

リソースが増えてくるとマッチョなserverless.ymlが誕生し、可読性が悪くなるのでresourcesの部分を分割しました。

ディレクトリ構成

.
├── resource_configs
│   ├── dynamodb.yml
│   ├── s3.yml
│   └── ...
│
└── serverless.yml

各設定ファイル

serverless.yml

serverless.yml
service: example-service

custom:
  bucketName: testbucket01

provider:
  name: aws
  runtime: python3.6
  region: ap-northeast-1

functions:
  hello:
    handler: handler.hello
    events:
      - http:
          path: /hello
          method: get

resources:
  - ${file(./resource_configs/s3.yml)}
  - ${file(./resource_configs/dynamodb.yml)}
  ...

s3.yml

s3.yml
Resources:
  Bucket01:
    Type: AWS::S3::Bucket
    Properties:
      BucketName: ${self:custom.bucketName}

参考

6
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?