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

Is it possible to use SSM Parameter Store alongside with this component? #15

Open
Agezao opened this issue Jun 3, 2020 · 2 comments
Open

Comments

@Agezao
Copy link

Agezao commented Jun 3, 2020

I'm trying to setup env vars from ssm parameter store following this guide, but it didn't worked as expected.

Using this plugin did not work as well.

The end result is serverless deploying the ${ssm:XPTO} as string instead of fetching the parameter value from ssm.
image

The parameter exist on ssm:
image

And the --debug did not indicate a failed attempt to fetch the ssm parameter:
image

Is this a bug?
Should this be a feature request?
Is this an intentional missing feature?
.. Or, am I doing something wrong?

Thanks! :)

@Agezao
Copy link
Author

Agezao commented Jun 5, 2020

In case anyone else came here with the same problem:

As this goes by unresolved, I've built a makefile script to deploy and added one envsubst strategy to fill-in the SSM parameters from a templated serverless.yml.

It's not ideal but did the trick for now.

It goes by like this:

  1. Remove from repo and git-ignore serverless.yml (because he will be injected with sensitive ssm data from now on)
  2. Create a copy of serverless.yml as serverless.template.yml
  3. Create one pre-build step on makefile that will reach to AWS-SSM-API, fetch the parameter and assign it to a temp env-var on make shell
  4. Use envsubst to create a serverless.yml from template injecting the ssm parameters from the temp env-var
  5. Run actual serverless deploy, now using the injected and generated serverless.yml

Snippet from makefile:
image

Snippet from serverless.template.yml:
image

So, although it's not ideal, running make deploy now do trick :)

@eahefnawy
Copy link
Member

Unfortunately you can't use serverless plugins with serverless components. Also, most serverless variables don't work with serverless components. This is all because serverless components is a completely different implementation of the Serverless Framework (spoiler alert, it'll likely be the next major version of the framework 😉 ).

In the components world, we'll likely have an SSM component in the future that you can reference. If you're up to it, you could create it yourself and we'll be super grateful 🙏

https://github.com/serverless/components#building-components

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

No branches or pull requests

2 participants