Reference supplied region variable in serverless.yml

if I deploy using --region eu-west-1 then self:provider.region still uses the one inside the file and not the one supplied on the command line.

If i leave it blank in the file and just supply on command line then using self:provider.region inside serverless.yml is empty

anyone know how to get around this ?

I do something similar with stage in my CICD example you can find on Github. Specifically, in my serverless.yml:

${opt:stage, self:provider.stage}

That’ll try the runtime option first, then the local variable reference.

2 Likes

stage works but region doesnt