This repository has been archived on 2023-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
github-issue-sns-topic/top.yaml
2020-11-26 00:48:55 -05:00

61 lines
1.5 KiB
YAML

AWSTemplateFormatVersion: '2010-09-09'
Description: SNS Topic to create GitHub Issues
Parameters:
TopicName:
Type: String
GithubRepository:
Type: String
GenerateOwnerName:
Type: String
GitHubTokenSecret:
Type: String
IamRoleArn:
Type: String
Resources:
SnsTopic:
Type: AWS::SNS::Topic
Properties:
TopicName: !Ref TopicName
CreateIssueLambda:
Type: AWS::Lambda::Function
Properties:
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
Properties:
Action: lambda:InvokeFunction
Principal: sns.amazonaws.com
SourceArn: !Ref SnsTopic
FunctionName: !GetAtt CreateIssueLambda.Arn
SnsLambdaSubscription:
Type: AWS::SNS::Subscription
Properties:
Endpoint: !GetAtt CreateIssueLambda.Arn
Protocol: lambda
TopicArn: !Ref SnsTopic
Outputs:
TopicArn:
Description: Anr of the SNS topic
Value: !Ref SnsTopic
TopicName:
Description: Name of the SNS topic
Value: !GetAtt SnsTopic.TopicName