Lambda Authorizer - how to avoid hard coding table name?

Hi all

Thank you for your time.

I have a couple authorizers in my serverless.yml which are being triggered before an HTTP (api gateway) function is served.

Each of these authorizers in one way or another is just scanning dynamodb table (also created in the same serverless.yml) and checking for the validity of a token, sent as part of request’s event.

The project hierarchy is fairly simple:

Imgur

Now - the dynamodb table is hard coded inside authorizer1.py, the issue this cause is that I am dynamically (based on stage name) naming my tables, which is forcing me to go to authorizer1.py every build and change it, I’d like to avoid it.

Is there any clean way of getting this done? what would be the best practice here?

Thank you!