Skip to content

sns.Topic.fromTopicArn: importinig topic forces contentBasedDeduplication = false #29532

@Onolisk

Description

@Onolisk

Describe the bug

When importing a topic by Arn, the constructor sets contentBasedDeduplication = false.

This means that when we call the resource method getContentBasedDeduplication(), it returns false always.

Expected Behavior

I would expect that when the resource is imported, the ARN is checked to determine whether or not contentBasedDeduplication is enabled on the Topic, then return a result that contains this.

Current Behavior

Currently .getContentBasedDeduplication() always returns false, regardless of the configuration of the actual Topic imported. This is only for imported Topics. Newly created topics return the actual value of the property.

Reproduction Steps

JAVA code:

    // Existing Topic with ContentBasedDeduplication enabled
    final ITopic assetTopic = Topic.fromTopicArn(this, "asset topic","arn:aws:sns:us-east-1:123456789012:myTopic.fifo");
    // returns false
    System.out.println(assetTopic.getContentBasedDeduplication());
    // New Topic created with ContentBasedDeduplication enabled
    Topic newTopic = Topic.Builder.create(this,"new topic")
            .contentBasedDeduplication(true)
            .displayName("my new topic")
            .fifo(true)
            .build();
    //Returns true, correctly
    System.out.println(newTopic.getContentBasedDeduplication());    

Possible Solution

No response

Additional Information/Context

See linked commit for when the property was set. Not sure if there is possibly an underlying reason why this value needs to be false for imports, if so please let me know.

CDK CLI Version

2.131.0

Framework Version

No response

Node.js Version

NA

OS

Win11

Language

Java

Language Version

openjdk version "21.0.2" 2024-01-16 LTS

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-snsRelated to Amazon Simple Notification ServicebugThis issue is a bug.effort/mediumMedium work item – several days of effortp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions