Skip to content

(sns): fifo topic construct doesn't append .fifo to the topic name #12386

@skyrpex

Description

@skyrpex

The SNS FIFO topics are failing to deploy because the topic name is missing .fifo at the end.

Reproduction Steps

Create a minimal cdk app with the following SNS FIFO topic and deploy it:

import * as sns from "@aws-cdk/aws-sns";
import * as cdk from "@aws-cdk/core";

class MyStack extends cdk.Stack {
  constructor(scope: cdk.Construct, id: string, properties?: cdk.StackProps) {
    super(scope, id, properties);

    new sns.Topic(this, "MyTopic", {
      fifo: true,
    });
  }
}

const app = new cdk.App();

new MyStack(app, "MyStack");

What did you expect to happen?

The SNS topic should append .fifo to the topic name if topic: true and .fifo is not present already.

What actually happened?

The deploy failed:

9:48:48 PM | CREATE_FAILED        | AWS::SNS::Topic                 | FanOutTopic
Invalid parameter: Topic Name (Service: AmazonSNS; Status Code: 400; Error Code: InvalidParameter; Request ID: xxxxx-xxxx-xxxx-xxxxx; Proxy: null)

Environment

  • CDK CLI Version : v1.83.0
  • Framework Version: v1.83.0
  • Node.js Version: v12.20.0
  • OS : Ubuntu 20
  • Language (Version): TypeScript (4.1)

Other

It works if you manually set the topicName to include .fifo at the end, like this:

new sns.Topic(this, "MyTopic", {
    fifo: true,
    topicName: "MyTopic.fifo",
});

This is 🐛 Bug Report

Metadata

Metadata

Labels

@aws-cdk/aws-snsRelated to Amazon Simple Notification ServicebugThis issue is a bug.effort/smallSmall work item – less than a day of effortp1

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions