hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.85k stars 9.2k forks source link

r/chatbot: Fix SNS topic ARNs ordering in Slack channel configuration #40253

Closed max-ts0gt closed 1 minute ago

max-ts0gt commented 14 hours ago

Description

This PR fixes an inconsistency in the aws_chatbot_slack_channel_configuration resource where it unnecessarily triggers plan changes when SNS topics are returned in a different order from the AWS API.

The fix implements sorting of SNS topic ARNs before comparison in the slackChannelConfigurationHasChanges function, ensuring that the order of topics doesn't trigger unnecessary updates.

Before this fix: Plan would show changes when AWS returns topics in different order:

sns_topic_arns = [
    - "arn:aws:sns:us-west-2:123456789012:topic2"
    - "arn:aws:sns:us-west-2:123456789012:topic1"
    - "arn:aws:sns:us-west-2:123456789012:topic1"
    - "arn:aws:sns:us-west-2:123456789012:topic2"
]

After this fix: No changes shown when only order differs:

sns_topic_arns = [
    - "arn:aws:sns:us-west-2:123456789012:topic1"
    - "arn:aws:sns:us-west-2:123456789012:topic2"
]

Closes #39025 Closes #39870

github-actions[bot] commented 14 hours ago

Community Note

Voting for Prioritization

For Submitters

johnsonaj commented 18 minutes ago

@max-ts0gt thank you for the contribution! 🎉

I changed sns_topic_arns from a List to Set, which effectively ignores the order without needing to sort.