Improve/Fix documentation to correctly set "table name" for the Idempotency DynamoDB table for Powertool for v2
Opened this issue · 1 comments
What were you searching in the docs?
In all examples for the v2 version (in preview) provided here Idempotency is configured like this:
Idempotency.config().withPersistenceStore(DynamoDBPersistenceStore.builder()
.withTableName(System.getenv("TABLE_NAME")).build()).configure();
where DynamoDB table name is retrieved from the environment variable with the name TABLE_NAME.
On the same documentation page, IaC example with AWS SAM to set this table name is defined in the environment variable IDEMPOTENCY_TABLE Lambda Function like this
IdempotencyFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: Function
Handler: helloworld.App::handleRequest
Policies:
- DynamoDBCrudPolicy:
TableName: !Ref IdempotencyTable
Environment:
Variables:
IDEMPOTENCY_TABLE: !Ref IdempotencyTable
Is this related to an existing documentation section?
https://docs.powertools.aws.dev/lambda/java/preview/utilities/idempotency
How can we improve?
use environment variable with the name TABLE_NAME instead like this:
Environment:
Variables:
TABLE_NAME: !Ref IdempotencyTable
Got a suggestion in mind?
use environment variable with the name TABLE_NAME instead like this:
Environment:
Variables:
TABLE_NAME: !Ref IdempotencyTable
Acknowledgment
- I understand the final update might be different from my proposed suggestion, or refused.
Thanks for spotting this. We should make the usage of env variables more consistent.