AWSTemplateFormatVersion: '2010-09-09'
Description: The Base Stack containing shared resources between all environments.
Resources:
  # Creates a role that allows Cognito to send SNS messages
  CognitoSNSRole:
    Type: "AWS::IAM::Role"
    Properties:
      AssumeRolePolicyDocument: 
        Version: "2012-10-17"
        Statement:
          - Effect: "Allow"
            Principal: 
              Service: 
                - "cognito-idp.amazonaws.com"
            Action: 
              - "sts:AssumeRole"
      Policies:
        - PolicyName: "CognitoSNSPolicy"
          PolicyDocument: 
            Version: "2012-10-17"
            Statement: 
              - Effect: "Allow"
                Action: "sns:publish"
                Resource: "*"

Outputs:
  CognitoSNSRoleARN:
    Description: A reference to the CognitoSNSRole ARN.
    Value: !GetAtt CognitoSNSRole.Arn
    Export:
      Name: "CognitoSNSRoleARN"