AWSTemplateFormatVersion: '2010-09-09'
Description: SNS Topic to create GitHub Issues
Parameters:
TopicName:
Type: String
GithubRepository:
GenerateOwnerName:
GitHubTokenSecret:
IamRoleArn:
Resources:
SnsTopic:
Type: AWS::SNS::Topic
Properties:
TopicName: !Ref TopicName
CreateIssueLambda:
Type: AWS::Lambda::Function
Handler: lambda_function.lambda_handler
Runtime: python3.8
Code:
S3Bucket: "sumu-stacks"
S3Key: !Sub "github-issues/create_issue.zip"
FunctionName: "Github-CreateIssue"
Description: Lambda that creates a issue in Github
MemorySize: 128
Timeout: 10
Role: !Ref IamRoleArn
Environment:
Variables:
GENERATED_OWNER: !Ref GenerateOwnerName
REPOSITORY: !Ref GithubRepository
GITHUB_TOKEN_SECRET: !Ref GitHubTokenSecret
SnsLambdaPermission:
Type: AWS::Lambda::Permission
Action: lambda:InvokeFunction
Principal: sns.amazonaws.com
SourceArn: !Ref SnsTopic
FunctionName: !GetAtt CreateIssueLambda.Arn
SnsLambdaSubscription:
Type: AWS::SNS::Subscription
Endpoint: !GetAtt CreateIssueLambda.Arn
Protocol: lambda
TopicArn: !Ref SnsTopic
Outputs:
TopicArn:
Description: Anr of the SNS topic
Value: !Ref SnsTopic
Description: Name of the SNS topic
Value: !GetAtt SnsTopic.TopicName