Skip to content

Commit

Permalink
feat: generate permission for dynamodb:Query and for GSIs
Browse files Browse the repository at this point in the history
  • Loading branch information
bahrmichael committed Dec 19, 2022
1 parent 5e81304 commit 0467b3c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/deploy/stepFunctions/compileIamRole.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,19 @@ function getDynamoDBPermissions(action, state) {
? '*'
: getDynamoDBArn(state.Parameters.TableName);

const indexName = state.Parameters['IndexName.$']
? '*'
: state.Parameters.IndexName;

let resource;
if (indexName) {
resource = `${tableArn}/index/${indexName}`;
} else {
resource = tableArn;
}
return [{
action,
resource: tableArn,
resource,
}];
}

Expand Down Expand Up @@ -466,6 +476,8 @@ function getIamPermissions(taskStates) {
return getDynamoDBPermissions('dynamodb:DeleteItem', state);
case 'arn:aws:states:::aws-sdk:dynamodb:updateTable':
return getDynamoDBPermissions('dynamodb:UpdateTable', state);
case 'arn:aws:states:::aws-sdk:dynamodb:query':
return getDynamoDBPermissions('dynamodb:Query', state);

case 'arn:aws:states:::aws-sdk:redshiftdata:executeStatement':
return getRedshiftDataPermissions('redshift-data:ExecuteStatement', state);
Expand Down

0 comments on commit 0467b3c

Please sign in to comment.