aws / aws/aws-sam-cli

SAM policy template "DynamoDBStreamReadPolicy" generates IAM role with incorrect resource ARN

Open
#4,460 4 comments 0 reactions 0 assignees View on GitHub
stage/pm-review
Dominant language
Python
Stars
6.7k
Forks
1.2k
Avg merge
1d 10h
Merged PRs (30d)
52

Description

### Environment

aws-sam-cli v1.52.0

### Steps to reproduce

1. Create a SAM template containing a Function resource.
2. Attach to the "DynamoDBStreamReadPolicy" SAM Policy Template to the Function, specifying the Stream Name as an ISO 8601 date time string (as is used in the stream's corresponding ARN).
3. Deploy the SAM template.

[ExampleSAMTemplate.yml.txt](https://github.com/aws/aws-sam-cli/files/9403755/ExampleSAMTemplate.yml.txt)

### Expected

The SAM template generates an IAM role and attaches it to the deployed Lambda function. The IAM role contains an inline policy granting access to the DynamoDB stream.

### Actual

The SAM template generates an IAM role and attaches it to the deployed Lambda function. The IAM role contains an inline policy with an invalid ARN for the DynamoDB stream. Instead of ending with an ISO 8601 date time string like "2022-08-23T12:34:56.789", the policy ARN is like "2022-08-23 12:34:56.789000".

[GeneratedInlinePolicy.json.txt](https://github.com/aws/aws-sam-cli/files/9403754/GeneratedInlinePolicy.json.txt)

### Impact

Lambda functions deployed using a valid SAM template are unable to access DynamoDB streams.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.