AWS cloudformation error: Template validation error: Template error: resource NotificationsTopic does not support attribute type Arn in Fn::GetAtt : <p>I am trying to create an AWS cloudformation stack using a yaml template.
The goal is to create a sns topic for some notifications.
I want to output the topic arn, to be able to subscribe multiple functions to that topic by just specifying the topic arn.</p>

<p>However I am getting an error when I try to create the stack from the aws console: </p>

<p>"Template validation error: Template error: resource NotificationsTopic does not support attribute type Arn in Fn::GetAtt"</p>

<p>I have done exactly the same for s3 buckets, dynamodb tables, and all working good, but for some reason, with SNS topic I cannot get the ARN.</p>

<p>I want to avoid hardcoding the topic arn in all functions that are subscribed. Because if one day the the ARN topic changes, I'll need to change all functions, instead I want to import the topic arn in all functions and use it. This way I will have to modify nothing if for any reason I have a new arn topic in the future.</p>

<p>This is the template:</p>

<pre><code>    Parameters:
  stage:
    Type: String
    Default: dev
    AllowedValues:
      - dev
      - int
      - uat
      - prod

Resources:
   NotificationsTopic:
        Type: AWS::SNS::Topic
        Properties:
          DisplayName: !Sub 'notifications-${stage}'
          Subscription:
            - SNS Subscription
          TopicName: !Sub 'notifications-${stage}'
Outputs:
  NotificationsTopicArn:
    Description: The notifications topic Arn.
    Value: !GetAtt NotificationsTopic.Arn
    Export:
      Name: !Sub '${AWS::StackName}-NotificationsTopicArn'
  NotificationsTopicName:
    Description: Notifications topic name.
    Value: !Sub 'notifications-${stage}'
    Export:
      Name: !Sub '${AWS::StackName}-NotificationsTopicName'
</code></pre>
