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

61 lines
1.5 KiB
YAML
Raw Normal View History

2020-08-13 07:06:25 +02:00
AWSTemplateFormatVersion: '2010-09-09'
Description: SNS Topic to create GitHub Issues
Parameters:
TopicName:
Type: String
GithubRepository:
Type: String
GenerateOwnerName:
Type: String
2020-11-17 01:19:29 +01:00
GitHubTokenSecret:
Type: String
2020-11-17 01:35:40 +01:00
IamRoleArn:
Type: String
2020-08-13 07:06:25 +02:00
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
2020-11-17 01:35:40 +01:00
Role: !Ref IamRoleArn
2020-08-13 07:06:25 +02:00
Environment:
Variables:
GENERATED_OWNER: !Ref GenerateOwnerName
REPOSITORY: !Ref GithubRepository
2020-11-17 01:19:29 +01:00
GITHUB_TOKEN_SECRET: !Ref GitHubTokenSecret
2020-08-13 07:06:25 +02:00
SnsLambdaPermission:
Type: AWS::Lambda::Permission
Properties:
Action: lambda:InvokeFunction
Principal: sns.amazonaws.com
SourceArn: !Ref SnsTopic
2020-11-17 01:19:29 +01:00
FunctionName: !GetAtt CreateIssueLambda.Arn
2020-11-26 05:54:37 +01:00
SnsLambdaSubscription:
Type: AWS::SNS::Subscription
Properties:
Endpoint: !GetAtt CreateIssueLambda.Arn
Protocol: lambda
TopicArn: !Ref SnsTopic
2020-11-26 06:48:55 +01:00
Outputs:
TopicArn:
Description: Anr of the SNS topic
Value: !Ref SnsTopic
TopicName:
Description: Name of the SNS topic
Value: !GetAtt SnsTopic.TopicName