Skip to content

Feature request: ability to set maxAge and decrypt via environment variables for Parameters #2041

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

Closed
1 of 2 tasks
dreamorosi opened this issue Mar 23, 2023 · 8 comments · Fixed by #2088
Closed
1 of 2 tasks
Assignees
Labels
feature-request feature request parameters Parameters utility

Comments

@dreamorosi
Copy link
Contributor

Use case

This is a cross-post from aws-powertools/powertools-lambda-typescript#1380 opened by mikebroberts, in turn generated by this Discord discussion.

Quoting:

I typically want to always set "decrypt" to true when getting parameters (since that works just fine whether an underlying SSM param is encrypted or not, and I'm accessing infrequently enough that costs and rate limiting is not a concern), and further I'd like to have a much longer default TTL for caching parameters so that I don't have to configure on every request.

Additional context:
At the moment customers have to specify maxAge and decrypt whenever they retrieve a parameter value. Some customer, like the OP, would instead like to set these settings at the function/environment level via env variable.

The original discussion/issue was requested for the SSMProvider specifically, but I believe that maxAge could apply to other providers as well.

Solution/User Experience

Be able to set env vars for default values for the parameters module, e.g. :

POWERTOOLS_PARAMETERS_TTL = 86400 # (1 day)
POWERTOOLS_PARAMETERS_DECRYPT = True

Alternative solutions

Creating custom wrappers around methods.

Acknowledgment

@dreamorosi dreamorosi added feature-request feature request triage Pending triage from maintainers labels Mar 23, 2023
@heitorlessa
Copy link
Contributor

thank you @dreamorosi !! As fast as lightning.. ⚡

@heitorlessa heitorlessa added parameters Parameters utility and removed triage Pending triage from maintainers labels Mar 24, 2023
@leandrodamascena
Copy link
Contributor

leandrodamascena commented Apr 4, 2023

Hey @dreamorosi! Thank you for opening this issue. I see that you suggested setting the environment variable as POWERTOOLS_PARAMETERS_TTL and POWERTOOLS_PARAMETERS_DECRYPT in this issue, but looking at the TS code, I see that you created these variable as POWERTOOLS_PARAMETERS_MAX_AGE and POWERTOOLS_PARAMETERS_SSM_DECRYPT. Reference: https://github.com/awslabs/aws-lambda-powertools-typescript/pull/1384/files#diff-b4d68dc855d0f9476d3f2ee343853bd21bf82ea9960d0cf06661baa244439dd6R308

I think it makes sense that we keep (when possible) the same configuration in all languages and will use the same name you used in Typescript.

Any objections @heitorlessa @rubenfonseca?

@leandrodamascena leandrodamascena self-assigned this Apr 4, 2023
@dreamorosi
Copy link
Contributor Author

Hi Leandro, I created this issue using an initial suggestion from the customer before implementing it in our repo.

Heitor has already reviewed the names in the PR, I think you should be good to go with POWERTOOLS_PARAMETERS_MAX_AGE and POWERTOOLS_PARAMETERS_SSM_DECRYPT :)

@leandrodamascena
Copy link
Contributor

Hi Leandro, I created this issue using an initial suggestion from the customer before implementing it in our repo.

Heitor has already reviewed the names in the PR, I think you should be good to go with POWERTOOLS_PARAMETERS_MAX_AGE and POWERTOOLS_PARAMETERS_SSM_DECRYPT :)

Thanks for the prompt reply @dreamorosi! You are unstoppable :)

@satishbpatil
Copy link

Easy it easier to understand POWERTOOLS_CACHE_TTL than POWERTOOLS_PARAMETERS_TTL

@leandrodamascena
Copy link
Contributor

Hi @satishbpatil thanks for this suggestion. I agree that the variable name POWERTOOLS_PARAMETERS_TTL is confusing to understand and we changed it to POWERTOOLS_PARAMETERS_MAX_AGE to go the same way that Powertools Typescript did.

@github-actions
Copy link
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

This issue is now closed. Please be mindful that future comments are hard for our team to see.

If you need more assistance, please either tag a team member or open a new issue that references this one.

If you wish to keep having a conversation with other community members under this issue feel free to do so.

@github-actions github-actions bot added the pending-release Fix or implementation already in dev waiting to be released label Apr 14, 2023
@github-actions
Copy link
Contributor

This is now released under 2.13.0 version!

@github-actions github-actions bot removed the pending-release Fix or implementation already in dev waiting to be released label Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request feature request parameters Parameters utility
Projects
None yet
4 participants