But I can’t quite figure out how to implement my specific scenario.
It’s pretty straight forward, I think:
In prod, the bucket name should be foobar.example.com.
But in all other environments, it should be foobar-XXX.example.com, where XXX is the name of the stage.
I was thinking of passing it in as a command line arg, where the default is the name of the stage:
custom:
# Command line args to serverless:
bucket_prefix: ${opt:bucket_prefix, ${self:provider.stage}}
stage: ${opt:stage, self:provider.stage}
But it seems weird referring to one command line arg to another.
I was also thinking of doing a mappings under “resources”, but not sure how to do “wildcards”:
Yup. You should still be able to do what you want without that merge syntax… but it was next level when I first discovered it. It’s important to know though that it only merges first level things. It’s not a deepmerge.