Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

variablesResolutionMode: 20210326 shouldn't enforce SSM variables #9460

Open
QAnders opened this issue May 11, 2021 · 3 comments
Open

variablesResolutionMode: 20210326 shouldn't enforce SSM variables #9460

QAnders opened this issue May 11, 2021 · 3 comments
Labels

Comments

@QAnders
Copy link

QAnders commented May 11, 2021

Use case description

The planned change in v3.0.0 for variablesResolutionMode shouldn't be enforced for AWS SSM variables

Proposed solution

When using Serverless Offline and SSM (which I believe is very common) there are a few solutions for using "offline" SSM, e.g. https://github.com/janders223/serverless-offline-ssm

We are developing locally and have different setups between developers, e.g. DB passwords, etc. which are stored in SSM and we are using the "SSM offline" plugin to help us with this.

In previous versions Serverless has showed a warning at run-time and/or deploy of missing variables in SSM "online" but from the next major an error will be thrown instead as when I tested with setting:

Set "variablesResolutionMode: 20210326" in your service config, to adapt to new behavior now

Today using the serverless-offline-ssm package we run it with a local stage which then reads the variables from a .env file or from the custom section in serverless.yml and this works fine now. However in v3.0.0 this will not work anymore as the SSM variables won't be available in AWS online and an error will be thrown.

I'd like to suggest to offer a possibility to bypass this check when running "offline" so that we can continue to use the serverless-offline-ssm package.

Any of the below would work IMO:

  1. Not to enforce using variablesResolutionMode when running in offline, i.e. IS_OFFLINE: 'true'
  2. Only check variablesResolutionMode at deploy and not when running locally
  3. Add a flag, e.g. --variablesresolutionmode off to allow using SSM var's not in AWS
@pgrzesik
Copy link
Contributor

Hello @QAnders, thanks a lot for reporting. The variablesResolutionMode is only temporary in v2 and that setting will be removed in v3 when we fully switch to the new variable resolver and drop support for the old one, so all the suggestions are not an option currently - the previous logic will be removed. After inspecting the serverless-offline-ssm plugin, it looks like it's "hacking" the Framework by overriding the ssm resolver - that is currently not possible, but will be after implementing #9311 - the plugin will have to be adjusted, but it should be able to work in a similar fashion. We'd be more than happy accept PR for implementing #9311

@QAnders
Copy link
Author

QAnders commented May 12, 2021

Thanks! I see... I don't fully understand how/what you are intending but I get the gist that we can continue using our local SSM var's (with some tweaks) so that is all I wanted to ensure!

Thanks for an awesome job and I'd love to help but TS stuff is not in my ballpark unfortunately... Too old for that modern stuff...

@pgrzesik
Copy link
Contributor

The extensions from #9311 do not have to specific to TS, but the idea came up from a TS-related use case. If we allow supporting such extensions, I believe that via such extension it will be possible to adjust the serverless-offline-ssm plugin/make it an extension that can override the ssm resolver.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants