https://serverless-stack.com/ logo
#sst
Title
# sst
d

Daniel Jarrett

07/25/2021, 11:00 AM
It's a bit of a long shot. But I'm wondering if there's some way of using cloudformation-include to start with an existing cf template and then modify your lambda resources from there for local debugging? Something like....
Copy code
import * as sst from "@serverless-stack/resources";
import * as cdk from '@aws-cdk/core';
import * as cfninc from '@aws-cdk/cloudformation-include';
import * as sam from '@aws-cdk/aws-sam';

export default class MyStack extends sst.Stack {
  constructor(scope: <http://sst.App|sst.App>, id: string, props?: sst.StackProps) {
    super(scope, id, props);

        const cfnTemplate = new cfninc.CfnInclude(this, 'Template', { 
          templateFile: './test.yml',
        }
      );
    

    const cfnFunction = cfnTemplate.getResource('ApiLambdaGET') as sam.CfnFunction;
//do something here wth cfnFunction

  }
}
f

Frank

07/26/2021, 4:47 AM
Hey @Daniel Jarrett, interesting idea! I’m not sure if that’s possible. You’d need to create the Lambda functions in SST.
However, you can import an existing Api/Topic/etc (ie. created in SAM) into SST, and add new routes/subscribers/etc to it.
Does that work for you?
d

Daniel Jarrett

07/26/2021, 5:01 AM
Thanks @Frank. I'm guessing that when importing the existing api it would need to be created using CDK not from an imported CF template correct?