-
Notifications
You must be signed in to change notification settings - Fork 1
/
template.yml
72 lines (65 loc) · 2.25 KB
/
template.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Description: Amazon Connect with BankID integration
Parameters:
ConnectArn:
Type: String
Description: The Arn for your existing connect instance. This instance can be in any region.
Globals:
Function:
Timeout: 8
Resources:
#### BankID Authenticator ####
BankIDAuthFunction:
Type: AWS::Serverless::Function
Properties:
FunctionName: bankid-auth
Description: Triggers a BankID authentication order and polls for status.
CodeUri: ./code/bankid-auth/
Handler: lambda_function.lambda_handler
Runtime: python3.9
ReservedConcurrentExecutions: 3
BankIDAuthPermission:
Type: AWS::Lambda::Permission
Properties:
Action: lambda:InvokeFunction
FunctionName: !GetAtt BankIDAuthFunction.Arn
Principal: connect.amazonaws.com
SourceArn: !Ref ConnectArn
#### Deploy Contact Flow ####
DeployContactFlowFunction:
Type: AWS::Serverless::Function
Properties:
FunctionName: deploy-contact-flow
Description: Custom resource step to deploy contact flow to Amazon Connect instance
CodeUri: ./code/deploy-contact-flow/
Handler: lambda_function.lambda_handler
Runtime: python3.9
ReservedConcurrentExecutions: 1
Policies:
- Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- connect:ListQueues
- connect:ListContactFlows
- connect:CreateContactFlow
- connect:UpdateContactFlowContent
Resource: !Sub "${ConnectArn}/*"
Environment:
Variables:
AUTH_ARN: !GetAtt BankIDAuthFunction.Arn
INSTANCE_ID: !Select [1, !Split ["/", !Ref ConnectArn]]
CONNECT_REGION: !Select [3, !Split [":", !Ref ConnectArn]]
ContactFlowDeployment:
Type: Custom::ContactFlowDeployment
Properties:
ServiceToken: !GetAtt DeployContactFlowFunction.Arn
DeletionPolicy: Retain
Outputs:
BankIDAuthArn:
Description: The Arn of the Lambda Function BankIDAuth
Value: !GetAtt BankIDAuthFunction.Arn
ContactFlow:
Description: Response from the custom resource contact flow deployment
Value: !GetAtt ContactFlowDeployment.Arn