Closed zopa-daniel-kitchen closed 3 years ago
The issue is with 5.7.
Hi guys,
apologies for this issue. We've already merged the fix into our repo, but you can fix this yourself by adding the kms:generatedatakey
action to the KMSManagedPolicy
managed policy.
I upgraded our deployment of the ServerLess Repo CTI Adapter to 5.7.3 but Lambdas are now failing with errors.
On investigation it seems code was added to salesforce.py to write an OAuth token to SecretsManager:
https://github.com/amazon-connect/amazon-connect-salesforce-lambda/blob/3a926720ee1ae550a2829f8976cdfea2bd985f69/sam-app/lambda_functions/salesforce.py#L88
However, the CloudFormation policy document for the Lambda functions has not been updated to include permissions to Encrypt with the SecretsManager KMS key as provided by the parameter:
SalesforceCredentialsKMSKeyARN
In the template the resource KMSManagedPolicy only attaches permissions for kms:Decrypt:
https://github.com/amazon-connect/amazon-connect-salesforce-lambda/blob/3a926720ee1ae550a2829f8976cdfea2bd985f69/sam-app/lambda_functions/template.yaml#L226
This causes the following error when the Lambda runs:
Steps to reproduce
Launch
AWS::Serverless::Application
resource via Cloudformation passingSemanticVersion: 5.7.3
. Fill in all required parameters as desired, they won't effect the behaviour.