Overwriting Variables on the fly with plugin

I want to write a plugin that automatically encrypts lamda environment variables before a cloudformation package is created. Any ideas on how this can be done ? I cannot figure how to get variables in my plugin after serverless has loaded them.

Not really an answer to your original question, but perhaps an alternative approach: https://hackernoon.com/you-should-use-ssm-parameter-store-over-lambda-env-variables-5197fc6ea45b

Thanks Rowanu. Actually I already figured out what I was doing wrong and was able to solve my problem. But SSM parameter could be very useful in my project as I am sharing same environment variables across multiple Lamda functions.