Giter VIP home page Giter VIP logo

Comments (3)

dominikschubert avatar dominikschubert commented on June 23, 2024 1

Hi @framilano! There's unfortunately an error in your provided YAML template which will also make this invalid against AWS. The TopicArn property in the AWS::SNS::Subscription needs to be an ARN, but in your sample you're passing in the name of the topic instead.

This is also an issue because the SNS subscription in your template has no dependency on the SNS Topic, so CloudFormation might try to first create the subscription to a topic that doesn't exist yet and thus fails. You can either add an explicit DependsOn or simply add a link via GetAtt or a Ref as shown below.

Here's the fix for your template which should then deploy correctly:

Parameters:

  Environment:
    Default: svts
    Description: Deployment environment
    Type: String

  AwsSt:
    Default: test
    Description: Project technical service
    Type: String

  AwsTeam:
    Default: fra
    Description: Team id
    Type: String

  Component:
    Default: relm-adapter
    Description: An identifier for the app
    Type: String

Resources:

  CreateAccountEventQueue:
    Type: AWS::SQS::Queue
    Properties:
      QueueName: !Sub "${AwsTeam}_${AwsSt}_${Environment}_sqs_create_account_event"
      RedrivePolicy:
        deadLetterTargetArn: !GetAtt CreateAccountEventDLQueue.Arn
        maxReceiveCount: 3

  CreateAccountEventDLQueue:
    Type: AWS::SQS::Queue
    Properties:
      QueueName: !Sub "${AwsTeam}_${AwsSt}_${Environment}_sqs_dlq_create_account_event"

  QueuePolicy:
    Type: AWS::SQS::QueuePolicy
    Properties:
      Queues:
        - !Ref CreateAccountEventQueue
      PolicyDocument:
        Statement:
          - Effect: Allow
            Principal:
              Service: sns.amazonaws.com
            Action:
              - sqs:SendMessage
            Resource: "*"
            Condition:
              ArnEquals:
                aws:SourceArn:
                  !Sub "${AwsTeam}_${AwsSt}_${Environment}_sns_create_account_event_topic"

  CreateAccountEventSubscription:
    Type: AWS::SNS::Subscription
    Properties:
      TopicArn: !Ref CreateAccountEventTopic
      Endpoint: !GetAtt CreateAccountEventQueue.Arn
      Protocol: sqs

  CreateAccountEventTopic:
    Type: AWS::SNS::Topic
    Properties:
      DisplayName: !Sub "${AwsTeam}_${AwsSt}_${Environment}_sns_create_account_event_topic"
      TopicName: !Sub "${AwsTeam}_${AwsSt}_${Environment}_sns_create_account_event_topic"

from localstack.

localstack-bot avatar localstack-bot commented on June 23, 2024

Welcome to LocalStack! Thanks for reporting your first issue and our team will be working towards fixing the issue for you or reach out for more background information. We recommend joining our Slack Community for real-time help and drop a message to LocalStack Pro Support if you are a Pro user! If you are willing to contribute towards fixing this issue, please have a look at our contributing guidelines and our contributing guide.

from localstack.

framilano avatar framilano commented on June 23, 2024

Yes, that was it, thank you!

from localstack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.