FormidableLabs / terraform-aws-serverless

Infrastructure support for Serverless framework apps, done the right way
https://registry.terraform.io/modules/FormidableLabs/serverless/aws
MIT License
144 stars 19 forks source link

how to use own serverless.yml? #71

Open Rudya93 opened 3 years ago

Rudya93 commented 3 years ago

Hello team, how I can use my own serverless.yml with your module? Or there is no such functionality, and you can use only your predefined yaml?

ryan-roemer commented 3 years ago

Hi @Rudya93

So you use your own serverless.yml and just make sure to bring in the Lambda role from this module (which is exported via CloudFormation). As the docs say, pretty much just:

provider:
  # ...
  role:
    # _or_ whatever the _actual_ exported name is from this module. You'll have to review your TF config and figure it out.
    Fn::ImportValue: tf-${self:custom.service}-${self:custom.stage}-LambdaExecutionRoleArn

Here are two examples of serverless configs that use this module:

Hope that helps!

Rudya93 commented 3 years ago

so in this case, I can't use only terraform tool, I also need to run serverless tool? something like: terraform apply serverless deploy

Rudya93 commented 3 years ago

For example I want to run https://www.serverless.com/examples/aws-python-rest-api this serverless framework

ryan-roemer commented 3 years ago

This terraform module is meant to give you limited IAM permissions to support a Serverless application deployment and lock it down in a single AWS account scenario. You don't need this module at all to deploy a serverless app, it just limits IAM permissions for humans and computers to access / develop / deploy that serverless app.

If, by contrast, you're in a multi-account setup where each application gets its own AWS account, you don't need this module.