Repository: localstack/localstack

Issue:
bug: sqs creation breaks with 0.14.1
### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

Having the following cdk definition for a sqs queue
const queue = new sqs.Queue(scope, `foo-queue`, {
    fifo: true,
    visibilityTimeout: Duration.seconds(300),
    contentBasedDeduplication: true
})
deploy works normally with localstack 0.14.0 using https://github.com/localstack/aws-cdk-local
But after upgrading to 0.14.1 we see the following error
2022-03-17T11:34:23.851:WARNING:localstack.utils.cloudformation.template_deployer: Error calling <bound method ClientCreator._create_api_method.<locals>._api_call of <botocore.client.SQS object at 0x7f11db7346d0>> with params: {'QueueName': 'FooStack-fooqueueB0475DE4-8bf04fb7', 'Attributes': {'ContentBasedDeduplication': 'True', 'FifoQueue': 'True', 'VisibilityTimeout': '300'}, 'tags': {}} for resource: {'Type': 'AWS::SQS::Queue', 'UpdateReplacePolicy': 'Delete', 'DeletionPolicy': 'Delete', 'Metadata': {'aws:cdk:path': 'FooStack/foo-queue/Resource'}, 'LogicalResourceId': 'fooqueueB0475DE4', 'Properties': {'ContentBasedDeduplication': True, 'FifoQueue': True, 'VisibilityTimeout': 300, 'QueueName': 'FooStack-fooqueueB0475DE4-8bf04fb7'}, '_state_': {}}
Only difference being the localstack upgrade, downgrading back to 0.14.0 fixes the problem.


### Expected Behavior

Sqs queue is created successfully like with 0.14.0

### How are you starting LocalStack?

With a docker-compose file

### Steps To Reproduce

cdklocal deploy

### Environment

```markdown
- LocalStack: 0.14.1
```


### Anything else?

_No response_


Discussion:
Same thing with SSM parameters with [cdklocal](https://github.com/localstack/aws-cdk-local):

```2022-03-17T12:23:50.004:WARNING:localstack.utils.cloudformation.template_deployer: Error calling <bound method ClientCreator._create_api_method.<locals>._api_call of <botocore.client.SSM object at 0x7f737bf9d5b0>> with params: {'Tags': [], 'Type': 'String', 'Value': '', 'Name': 'teste'} for resource: {'Type': 'AWS::SSM::Parameter', 'Metadata': {'aws:cdk:path': 'LocalstackPodSecretsStack/SchedulerProductionHost/Resource'}, 'LogicalResourceId': 'SchedulerProductionHost938C7B60', 'Properties': {'Type': 'String', 'Value': '', 'Name': 'teste'}, '_state_': {}, 'PhysicalResourceId': None}```

Resolving patch:
diff --git a/localstack/services/cloudformation/models/sqs.py b/localstack/services/cloudformation/models/sqs.py
--- a/localstack/services/cloudformation/models/sqs.py
+++ b/localstack/services/cloudformation/models/sqs.py
@@ -107,10 +107,13 @@ def fetch_state(self, stack_name, resources):
     @staticmethod
     def add_defaults(resource, stack_name: str):
         role_name = resource.get("Properties", {}).get("QueueName")
+
         if not role_name:
             resource["Properties"]["QueueName"] = generate_default_name(
                 stack_name, resource["LogicalResourceId"]
             )
+            if resource["Properties"].get("FifoQueue"):
+                resource["Properties"]["QueueName"] += ".fifo"
 
     @classmethod
     def get_deploy_templates(cls):


Test patch:
diff --git a/tests/integration/cloudformation/test_cloudformation_sqs.py b/tests/integration/cloudformation/test_cloudformation_sqs.py
--- a/tests/integration/cloudformation/test_cloudformation_sqs.py
+++ b/tests/integration/cloudformation/test_cloudformation_sqs.py
@@ -1,41 +1,21 @@
-from localstack.utils.common import short_uid
-from localstack.utils.generic.wait_utils import wait_until
-from tests.integration.cloudformation.test_cloudformation_changesets import load_template_raw
+def test_sqs_queue_policy(sqs_client, deploy_cfn_template):
+    result = deploy_cfn_template(template_file_name="sqs_with_queuepolicy.yaml")
+    queue_url = result.outputs["QueueUrlOutput"]
+    resp = sqs_client.get_queue_attributes(QueueUrl=queue_url, AttributeNames=["Policy"])
+    assert (
+        "Statement" in resp["Attributes"]["Policy"]
+    )  # just kind of a smoke test to see if its set
 
 
-def test_sqs_queue_policy(
-    cfn_client,
-    sqs_client,
-    cleanup_stacks,
-    cleanup_changesets,
-    is_change_set_created_and_available,
-    is_stack_created,
-):
-    stack_name = f"stack-{short_uid()}"
-    change_set_name = f"change-set-{short_uid()}"
-
-    template_rendered = load_template_raw("sqs_with_queuepolicy.yaml")
-    response = cfn_client.create_change_set(
-        StackName=stack_name,
-        ChangeSetName=change_set_name,
-        TemplateBody=template_rendered,
-        ChangeSetType="CREATE",
+def test_sqs_fifo_queue_generates_valid_name(deploy_cfn_template):
+    result = deploy_cfn_template(
+        template_file_name="sqs_fifo_autogenerate_name.yaml", template_mapping={"is_fifo": "true"}
     )
-    change_set_id = response["Id"]
-    stack_id = response["StackId"]
+    assert ".fifo" in result.outputs["FooQueueName"]
 
-    try:
-        wait_until(is_change_set_created_and_available(change_set_id))
-        cfn_client.execute_change_set(ChangeSetName=change_set_id)
-        wait_until(is_stack_created(stack_id))
-        outputs = cfn_client.describe_stacks(StackName=stack_id)["Stacks"][0]["Outputs"]
-        assert len(outputs) == 1
-        queue_url = outputs[0]["OutputValue"]
-        resp = sqs_client.get_queue_attributes(QueueUrl=queue_url, AttributeNames=["Policy"])
-        assert (
-            "Statement" in resp["Attributes"]["Policy"]
-        )  # just kind of a smoke test to see if its set
 
-    finally:
-        cleanup_changesets([change_set_id])
-        cleanup_stacks([stack_id])
+def test_sqs_non_fifo_queue_generates_valid_name(deploy_cfn_template):
+    result = deploy_cfn_template(
+        template_file_name="sqs_fifo_autogenerate_name.yaml", template_mapping={"is_fifo": "false"}
+    )
+    assert ".fifo" not in result.outputs["FooQueueName"]
diff --git a/tests/integration/templates/sqs_fifo_autogenerate_name.yaml b/tests/integration/templates/sqs_fifo_autogenerate_name.yaml
new file mode 100644
--- /dev/null
+++ b/tests/integration/templates/sqs_fifo_autogenerate_name.yaml
@@ -0,0 +1,15 @@
+Resources:
+  FooQueueA2A23E59:
+    Type: AWS::SQS::Queue
+    Properties:
+      ContentBasedDeduplication: true
+      FifoQueue: {{ is_fifo }}
+      VisibilityTimeout: 300
+    UpdateReplacePolicy: Delete
+    DeletionPolicy: Delete
+Outputs:
+  FooQueueName:
+    Value:
+      Fn::GetAtt:
+        - FooQueueA2A23E59
+        - QueueName