title: Cannot create SQS subscription to an SNS topic through Cloudformation in LocalStack
body: <p>Using <code>localstack</code> I am trying to create a template that does the following:</p>
  
  <ol>
  <li>Create an SNS topic</li>
  <li>Create an SQS queue</li>
  <li>Create a subscription that subscribes the SQS queue to the SNS topic.</li>
  </ol>
  
  <p>My <code>docker-compose</code> file looks like this:</p>
  
  <pre><code>version: '3'
  
  services:
  
    localstack:
      image: localstack/localstack
      container_name: localstack
      environment:
        - SERVICES=sns,sqs,cloudformation
        - DEBUG=1
        - PORT_WEB_UI=${PORT_WEB_UI- }
        - HOSTNAME=localstack
        - AWS_DEFAULT_REGION=eu-west-2
        - AWS_ACCESS_KEY_ID=XX
        - AWS_SECRET_ACCESS_KEY=XX
      ports:
        - "4575:4575"
        - "4576:4576"
        - "4581:4581"
        - "8080:8080"
      volumes:
        - ./config/formation.yml:/usr/stuff/formation.yml
        - ./config/init.sh:/docker-entrypoint-initaws.d/init.sh
  </code></pre>
  
  <p>My <code>init.sh</code> file looks like this:</p>
  
  <pre><code>#!/bin/bash
  aws cloudformation create-stack --stack-name fincorestack --template-body file:///usr/stuff/formation.yml --endpoint-url=http://localstack:4581
  </code></pre>
  
  <p>And finally my Cloudformation file looks like this:</p>
  
  <pre><code>AWSTemplateFormatVersion: '2010-09-09'
  Description: 'Test'
  Resources:
    MySnsTopic:
      Type: AWS::SNS::Topic
      Properties:
        TopicName: MySnsTopic
    MySnsTopicSubscription:
      Type: AWS::SNS::Subscription
      Properties:
        Protocol: sqs
        TopicArn: !Ref MySnsTopic
        Endpoint: !GetAtt
          - MySqsQueue
          - QueueArn
    MySqsQueue:
      Type: AWS::SQS::Queue
      Properties:
        QueueName: MySqsQueue
  </code></pre>
  
  <p>This produces a very vague <strong>500 Internal Server Error</strong>. Since this is <code>localstack</code> and I know that the arns are quite static I tried replacing the contents of the <code>yml</code> file for the subscriptions <code>TopcArn</code> and <code>Endpoint</code> with the following:</p>
  
  <pre><code>TopicArn: arn:aws:sns:eu-west-2:123456789012:MySnsTopic
  Endpoint: arn:aws:sqs:elasticmq:000000000000:MySqsQueue
  </code></pre>
  
  <p>This time I am not getting an error but the subscription does not get created. From the debug output of <code>localstack</code> I can see this:</p>
  
  <p><a href="https://i.stack.imgur.com/6giwW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6giwW.png" alt="enter image description here"></a></p>
  
  <p>And the subscription is not created. Is this feature not supported in the <code>Cloudformation</code> implementation of <code>localstack</code> or am I doing something wrong? </p>