Repository: localstack/localstack

Issue:
Unable to change ContentBasedDeduplication attribute on existing queue
### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

If I create a queue and try to change its `ContentDeduplication` attribute, I see this error:

` An error occurred (InvalidAttributeName) when calling the SetQueueAttributes operation: Unknown Attribute ContentBasedDeduplication.`

### Expected Behavior

I should be able to set `ContentBasedDeduplication` from `true` to `false` on an existing queue.  It appears to work on AWS.

### How are you starting LocalStack?

With a docker-compose file

### Steps To Reproduce

#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)

    docker run localstack/localstack

#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

```
aws sqs create-queue --queue-name test1.fifo --endpoint-url http://localhost:4566/ --attributes FifoQueue=true,ContentBasedDeduplication=true
{
    "QueueUrl": "http://localhost:4566/000000000000/test1.fifo"
}


aws sqs get-queue-attributes --endpoint-url http://localhost:4566/ --queue-url http://localhost:4566/000000000000/test1.fifo --attribute-names '["ContentBasedDeduplication"]'
{
    "Attributes": {
        "FifoQueue": "true,
        "ContentBasedDeduplication": "true"
    }
}

aws sqs set-queue-attributes --endpoint-url http://localhost:4566/ --queue-url http://localhost:4566/000000000000/test1.fifo --attributes ContentBasedDeduplication=false

An error occurred (InvalidAttributeName) when calling the SetQueueAttributes operation: Unknown Attribute ContentBasedDeduplication.
```


### Environment

```markdown
- OS: MacOs Ventura 13.3.1 (a) 
- LocalStack: 2.1.0
```


### Anything else?

_No response_


Discussion:
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](https://localstack.cloud/contact/) 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](https://github.com/localstack/.github/blob/main/CONTRIBUTING.md) and our [contributing guide](https://docs.localstack.cloud/contributing/).

Resolving patch:
diff --git a/localstack/services/sqs/constants.py b/localstack/services/sqs/constants.py
--- a/localstack/services/sqs/constants.py
+++ b/localstack/services/sqs/constants.py
@@ -26,7 +26,6 @@
     QueueAttributeName.ApproximateNumberOfMessages,
     QueueAttributeName.ApproximateNumberOfMessagesDelayed,
     QueueAttributeName.ApproximateNumberOfMessagesNotVisible,
-    QueueAttributeName.ContentBasedDeduplication,
     QueueAttributeName.CreatedTimestamp,
     QueueAttributeName.LastModifiedTimestamp,
     QueueAttributeName.QueueArn,


Test patch:
diff --git a/tests/integration/test_sqs.py b/tests/integration/test_sqs.py
--- a/tests/integration/test_sqs.py
+++ b/tests/integration/test_sqs.py
@@ -616,6 +616,21 @@ def test_create_fifo_queue_with_same_attributes_is_idempotent(self, sqs_create_q
         queue_url = sqs_create_queue(QueueName=queue_name, Attributes=attributes)
         assert sqs_create_queue(QueueName=queue_name, Attributes=attributes) == queue_url
 
+    @pytest.mark.aws_validated
+    def test_create_fifo_queue_with_different_attributes_raises_error(
+        self, sqs_create_queue, aws_client
+    ):
+        queue_name = f"queue-{short_uid()}.fifo"
+        sqs_create_queue(
+            QueueName=queue_name,
+            Attributes={"FifoQueue": "true", "ContentBasedDeduplication": "true"},
+        )
+        with pytest.raises(aws_client.sqs.exceptions.QueueNameExists):
+            sqs_create_queue(
+                QueueName=queue_name,
+                Attributes={"FifoQueue": "true", "ContentBasedDeduplication": "false"},
+            )
+
     @pytest.mark.aws_validated
     def test_send_message_with_delay_0_works_for_fifo(self, sqs_create_queue, aws_client):
         # see issue https://github.com/localstack/localstack/issues/6612
@@ -1713,6 +1728,32 @@ def test_fifo_delete_message_with_expired_receipt_handle(
 
         snapshot.match("error", e.value.response)
 
+    def test_fifo_set_content_based_deduplication_strategy(
+        self, sqs_create_queue, aws_client, snapshot
+    ):
+        queue_url = sqs_create_queue(
+            QueueName=f"queue-{short_uid()}.fifo",
+            Attributes={
+                "FifoQueue": "true",
+                "SqsManagedSseEnabled": "true",
+                "ContentBasedDeduplication": "true",
+            },
+        )
+
+        snapshot.match(
+            "before-update",
+            aws_client.sqs.get_queue_attributes(QueueUrl=queue_url, AttributeNames=["All"]),
+        )
+
+        aws_client.sqs.set_queue_attributes(
+            QueueUrl=queue_url, Attributes={"ContentBasedDeduplication": "false"}
+        )
+
+        snapshot.match(
+            "after-update",
+            aws_client.sqs.get_queue_attributes(QueueUrl=queue_url, AttributeNames=["All"]),
+        )
+
     @pytest.mark.aws_validated
     def test_list_queue_tags(self, sqs_create_queue, aws_client):
         queue_name = f"queue-{short_uid()}"
diff --git a/tests/integration/test_sqs.snapshot.json b/tests/integration/test_sqs.snapshot.json
--- a/tests/integration/test_sqs.snapshot.json
+++ b/tests/integration/test_sqs.snapshot.json
@@ -802,5 +802,58 @@
   "tests/integration/test_sqs.py::TestSqsProvider::test_list_queues": {
     "recorded-date": "06-05-2023, 04:43:47",
     "recorded-content": {}
+  },
+  "tests/integration/test_sqs.py::TestSqsProvider::test_fifo_set_content_based_deduplication_strategy": {
+    "recorded-date": "30-05-2023, 20:20:59",
+    "recorded-content": {
+      "before-update": {
+        "Attributes": {
+          "ApproximateNumberOfMessages": "0",
+          "ApproximateNumberOfMessagesDelayed": "0",
+          "ApproximateNumberOfMessagesNotVisible": "0",
+          "ContentBasedDeduplication": "true",
+          "CreatedTimestamp": "timestamp",
+          "DeduplicationScope": "queue",
+          "DelaySeconds": "0",
+          "FifoQueue": "true",
+          "FifoThroughputLimit": "perQueue",
+          "LastModifiedTimestamp": "timestamp",
+          "MaximumMessageSize": "262144",
+          "MessageRetentionPeriod": "345600",
+          "QueueArn": "arn:aws:sqs:<region>:111111111111:<resource:1>",
+          "ReceiveMessageWaitTimeSeconds": "0",
+          "SqsManagedSseEnabled": "true",
+          "VisibilityTimeout": "30"
+        },
+        "ResponseMetadata": {
+          "HTTPHeaders": {},
+          "HTTPStatusCode": 200
+        }
+      },
+      "after-update": {
+        "Attributes": {
+          "ApproximateNumberOfMessages": "0",
+          "ApproximateNumberOfMessagesDelayed": "0",
+          "ApproximateNumberOfMessagesNotVisible": "0",
+          "ContentBasedDeduplication": "false",
+          "CreatedTimestamp": "timestamp",
+          "DeduplicationScope": "queue",
+          "DelaySeconds": "0",
+          "FifoQueue": "true",
+          "FifoThroughputLimit": "perQueue",
+          "LastModifiedTimestamp": "timestamp",
+          "MaximumMessageSize": "262144",
+          "MessageRetentionPeriod": "345600",
+          "QueueArn": "arn:aws:sqs:<region>:111111111111:<resource:1>",
+          "ReceiveMessageWaitTimeSeconds": "0",
+          "SqsManagedSseEnabled": "true",
+          "VisibilityTimeout": "30"
+        },
+        "ResponseMetadata": {
+          "HTTPHeaders": {},
+          "HTTPStatusCode": 200
+        }
+      }
+    }
   }
 }