I need to add VPC endpoints to my Serverless projects. These endpoints will be setup once and used by each stage and all of my stages sit in the same VPC.
When I run
sls deploy on my first (dev) stage the VPC endpoint is created successfully. When I then run
sls deploy --stage staging I get the error below:
An error occurred: SqsVpcEndpoints - private-dns-enabled cannot be set because there is already a conflicting DNS domain for sqs.ap-southeast-2.amazonaws.com in the VPC vpc-xxxxxxx
The problem of course is because the VPC endpoint has already been created and can not be created again from a different CloudFormation script.
I am just wondering if there are any built in features of Serverless to handle this situation or what strategies people use to deploy infrastructure that is shared by stages and should only be created once.
Right now I think my best option is two yaml files, one for stage specific functions etc… and one for shared resources like VPC endpoints. I can then use the deploy --config option to specify which file to deploy.