Dynamodb is defined using aws CDK and deployed to localstack:
new Table(this, 'idlist-staging', {
tableName: 'idlist-staging',
readCapacity: 1,
writeCapacity: 1,
partitionKey: { name: 'external_id', type: AttributeType.STRING },
pointInTimeRecovery: true,
removalPolicy: RemovalPolicy.DESTROY,
billingMode: BillingMode.PROVISIONED
});
State Machine on local stack has entries like:
"Deletion": {
"Type": "Task",
"Resource": "arn:aws:states:::dynamodb:deleteItem",
"Parameters": {
"TableName": "idlist-staging",
"Key": {
"external_id": {
"S.$": "$.exid"
}
}
},
"Next": "Confirmation",
"ResultPath": null
},
update as requested: cdk code that constructs the state machine:
const machine = new CfnStateMachine(this, smId, {
stateMachineName: 'sync-machine-staging',
// role already has Effect.Allow on dynamodb put/get/delet + db arn
roleArn: role.roleArn,
definitionString: JSON.stringify(
stateMachineDefinition,
),
});
What is the correct way to reference the dynamodb table? Do we still use arn:aws:states:::dynamodb:deleteItem
as the resource and idlist-staging
as the table because cdk will not deploy as soon as the the state machine is updated to reference dynamodb. CDK Deploys when the reference is removed from the step function.
Any help appreciated for how to either fix this or debug this.