AWS::SNS::Subscription not created by moto by CloudFormation.create_stack

20 Views Asked by At

I have following CloufFormation template

AWSTemplateFormatVersion: '2010-09-09'
Parameters:
  ServiceName:
    Default: test
    Type: String
Resources:
  DynamoDBTable:
    Properties:
      AttributeDefinitions:
      - AttributeName: id
        AttributeType: S
      BillingMode: PAY_PER_REQUEST
      KeySchema:
      - AttributeName: id
        KeyType: HASH
      StreamSpecification:
        StreamViewType: NEW_AND_OLD_IMAGES
      TableName:
        Fn::Sub:
        - ${prefix}-table
        - prefix:
            Ref: ServiceName
    Type: AWS::DynamoDB::Table
  SNSTopic:
    Properties:
      TopicName:
        Fn::Sub:
        - ${prefix}-topic
        - prefix:
            Ref: ServiceName
    Type: AWS::SNS::Topic
  SQSQueue:
    Properties:
      QueueName:
        Fn::Sub:
        - ${prefix}-queue
        - prefix:
            Ref: ServiceName
    Type: AWS::SQS::Queue
  SQSToSNSSubscription:
    Properties:
      Endpoint:
        Fn::GetAtt: SQSQueue.Arn
      Protocol: sqs
      RawMessageDelivery: true
      TopicArn:
        Fn::GetAtt: SNSTopic.TopicArn
    Type: AWS::SNS::Subscription
Transform:
- AWS::Serverless-2016-10-31

and I am using moto to mock CloudFormation, SQS, DynamoDB and SNS

When I call create_stack on CFN client, I see that DynamoDB table, SQS queue and SNS topic were properly created, but list_subscriptions does not return any subscriptions.

I have not found any article about AWS::SNS::Subscription being not supported by moto and CloudFormation assembly.

Am I doing something wrong?

The code that constructs CFN stack is here

 with open("template.yaml", mode="r") as f:
   template = f.read()

 import boto3
    cfn = boto3.client('cloudformation')
    cfn.create_stack(
        StackName="test-stack-1",
        TemplateBody=template,
    )
0

There are 0 best solutions below