getlift / lift

Expanding Serverless Framework beyond functions using the AWS CDK
MIT License
920 stars 112 forks source link

Configuring Stage-Based Domain Names for server-side-website #401

Closed renereed1 closed 3 months ago

renereed1 commented 3 months ago

Hi maintainers,

First, I want to thank you for the excellent work on the serverless-lift plugin. It has significantly streamlined our serverless deployments.

I have a question regarding the configuration of stage-based domain names using the server-side-website construct. Specifically, I'm looking to set up different domains based on the deployment stage. Here's the scenario I'm trying to achieve:

Stage: prod Domain: example.com

Stage: dev Domain: dev.example.com

Stage: abc Doamin: abc.example.com

Here is an example of my current serverless.yml configuration:

service: my-service

provider: name: aws region: us-west-2 stage: ${opt:stage, 'dev'} runtime: provided.al2

plugins:

custom: baseDomain: example.com domain: 'Fn::If':

constructs: website: type: server-side-website assets: '/assets/*': public/assets domain: ${self:custom.domain} certificate: arn:aws:acm:region:account-id:certificate/certificate-id

resources: Conditions: IsProd: Fn::Equals:

Unfortunately, this configuration results in an invalid format error. Is there a recommended approach to dynamically set domain names based on the stage using the server-side-website construct in serverless-lift?

I appreciate any guidance or examples you can provide. Thanks in advance for your assistance!

Best regards,