Repository navigation
AWS: ${ssm} resolve vairbale as JSON if it is stored as JSON in Secrets Manager - #5842
Conversation
dschep
left a comment
There was a problem hiding this comment.
Added a question, but I think this is great! ![]()
| name: hello | ||
| handler: handler.hello | ||
| custom: | ||
| supersecret: |
There was a problem hiding this comment.
How hard would it be to add ${ssm:/aws/reference/secretsmanager/secret_ID_in_Secrets_Manager~true:hello}
Tho you can always work around it: ${self:custom.supersecret.hello}
😁
There was a problem hiding this comment.
I think it would involve some "caching" so it's not requesting SSM every time this line is references. Using custom seems more elegant!
|
I know this is closed, but thanks @exoego.. This was almost driving me mad in v1.36 😝 |
|
As per it is possible to access Parameter Store items. And I try to access them as written here. But currently, the parameters set in Would it be possible to extend this merge to not only support Secret Manager variables containing |
|
@exoego is there a way not to resolve variable as JSON and treat it as a string? |
|
As shown in comments to #5869, using |
What did you implement:
Closes #5838
How did you implement it:
After this PR,
${ssm}resolves variable as JSON only if referencing to a secret stored in AWS Secrets Manager and returned value is valid JSON.Otherwise it returns plain text.
It do not throw an error if invalid JSON, since AWS Secrets Manager can store any text including invalid JSON.
How can we verify it:
npm install -g exoego/serverless#ssm-should-failfooin AWS Secrets Manager.{ "num": 1, "str": "secret" }serverless.ymlsls printand confirmsupersecretis likeTodos:
Is this ready for review?: YES
Is it a breaking change?: NO
This could be breaking change if existing users expect getting JSON as plaintext