Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't accept url of file as serverless resources does #13

Open
josersleal opened this issue Sep 17, 2018 · 5 comments
Open

Doesn't accept url of file as serverless resources does #13

josersleal opened this issue Sep 17, 2018 · 5 comments

Comments

@josersleal
Copy link

josersleal commented Sep 17, 2018

serverless accepts:

resources:

  • ${file(resources/s3-bucket.yml)}

This fails with
ServerlessError: Template format error: Any Resources member must be an object.

Its unpractical to have all definitions in one file

@ghost
Copy link

ghost commented Mar 29, 2019

Yes you can. The structure would be like this

custom:
  additionalStacks:
    Bucket: ${file(resources/s3-bucket.yml)}

and you can add DeployParameters within that template

@rpgreen
Copy link

rpgreen commented Jun 17, 2019

Is there a way to include multiple files in this way?

i.e. this does not seem to work:

custom:
  additionalStacks:
    Datastores: 
        -${file(resources/s3.yml)}
        -${file(resources/dynamodb.yml)}

This would be much better for composing templates.

@EliteMasterEric
Copy link
Contributor

As of today this issue is still not resolved.

In the full Serverless library, the resources and functions elements can be defined as arrays, allowing them to be defined in multiple separate files, like so:

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

This functionality is powered by the following code:

https://github.com/serverless/serverless/blob/73107822945a878abbdebe2309e8e9d87cc2858a/lib/classes/Service.js#L157

I'm going to look into making a pull request possibly soon.

@kennu
Copy link
Contributor

kennu commented Apr 23, 2020

Sounds like a good idea to merge the arrays into one object in the same way as Serverless Core does.

@EliteMasterEric
Copy link
Contributor

@kennu I have implemented this feature into pull request #26. A review would be greatly appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants