aws-powertools / powertools-lambda-python

A developer toolkit to implement Serverless best practices and increase developer velocity.
https://docs.powertools.aws.dev/lambda/python/latest/
MIT No Attribution
2.85k stars 392 forks source link

Docs: Improving examples for fetching secrets #5442

Open chubzor opened 4 hours ago

chubzor commented 4 hours ago

What were you searching in the docs?

I wanted to set up pulling secrets for my project and replacing my custom code with lambda power tools parameters functionality.

Is this related to an existing documentation section?

https://docs.powertools.aws.dev/lambda/python/latest/utilities/parameters/#fetching-secrets

How can we improve?

The example has api_key: Any = parameters.get_secret("/lambda-powertools/api-key") headers: dict = {"X-API-Key": api_key}

This reads as pulling a value for an api-key key But the value of api-key can be a mapping of keys and values and produce a dict.

In my code I've set up secrets where I've got project-name/staging

Under that I have key value mapping of: DB_CONNECTION_STRING API_KEY

And wanted to do: parameters.get_secret("project-name/staging/DB_CONNECTION_STRING") to pull the value under a key within a secret.

Got a suggestion in mind?

Adding another nested example to show the difference between a plain string and key/value results.

Acknowledgment

boring-cyborg[bot] commented 4 hours ago

Thanks for opening your first issue here! We'll come back to you as soon as we can. In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link