Hello,
We are currently managing AWS resources through terraform and I am hoping I can deploy the serverless function to the Lambda, gate way api that is created by terraform. Here is the current file with serverless deploying the resources, but need to convert this to use the existing lambda, gateway and dynamo db. Is this possible ? thanks!
service: serverless
frameworkVersion: "3"
plugins:
- serverless-offline
provider:
name: aws
stage: beta
region: us-west-2
runtime: nodejs18.x
environment:
TABLE_NAME: subscriptionTable
APPLE_KEY: ${ssm:/apple/privateKey}
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:DescribeTable
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource:
- "Fn::GetAtt": [subscriptionTable, Arn]
functions:
googleNotification:
handler: google.subscribe
events:
- httpApi:
path: /google/sub
method: post
googleNewOrder:
handler: google.order
events:
- httpApi:
path: /google/order
method: post
appleNotification:
handler: apple.subscribe
events:
- httpApi:
path: /apple/sub
method: post
appleNewOrder:
handler: apple.order
events:
- httpApi:
path: /apple/order
method: post
resources: # CloudFormation template syntax from here on.
Resources:
subscriptionTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: subscriptionTable
AttributeDefinitions:
- AttributeName: email
AttributeType: S
KeySchema:
- AttributeName: email
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1