Test

 avatar
unknown
yaml
2 years ago
1.0 kB
13
Indexable
Parameters:
  CodeBuildProjectName:
    Type: String
    Description: "Name of the CodeBuild project to use as the event source"

Resources:
  SnsTopic:
    Type: "AWS::SNS::Topic"
    Properties:
      DisplayName: "CodeBuild Notifications Topic"

  CodeBuildEventRule:
    Type: "AWS::Events::Rule"
    Properties:
      Description: "Trigger notifications on CodeBuild project events"
      EventPattern:
        source:
          - "aws.codebuild"
        detail-type:
          - "CodeBuild Build State Change"
        detail:
          project-name:
            - !Ref CodeBuildProjectName
          build-status:
            - "SUCCEEDED"
            - "FAILED"
      Targets:
        - Arn: !Ref SnsTopic
          Id: "CodeBuildNotification"

  EmailSubscription:
    Type: "AWS::SNS::Subscription"
    Properties:
      Protocol: "email"
      TopicArn: !Ref SnsTopic
      Endpoint: "fabriziorocco99@gmail.com"

Outputs:
  SnsTopicArn:
    Description: "ARN of the SNS topic for CodeBuild notifications"
    Value: !Ref SnsTopic
Editor is loading...