diff --git a/moto/cloudformation/responses.py b/moto/cloudformation/responses.py index c7ced018..4c8ad36d 100644 --- a/moto/cloudformation/responses.py +++ b/moto/cloudformation/responses.py @@ -729,7 +729,7 @@ DESCRIBE_STACKS_TEMPLATE = """ {% if stack.change_set_id %} {{ stack.change_set_id }} {% endif %} - {{ stack.description }} + {{ stack.creation_time_iso_8601 }} {{ stack.status }} {% if stack.notification_arns %} diff --git a/tests/test_cloudformation/test_cloudformation_stack_crud_boto3.py b/tests/test_cloudformation/test_cloudformation_stack_crud_boto3.py index 86b6f1a9..600a727f 100644 --- a/tests/test_cloudformation/test_cloudformation_stack_crud_boto3.py +++ b/tests/test_cloudformation/test_cloudformation_stack_crud_boto3.py @@ -170,7 +170,29 @@ dummy_redrive_template = { }, } +dummy_template_special_chars_in_description = { + "AWSTemplateFormatVersion": "2010-09-09", + "Description": "Stack 1 ", + "Resources": { + "EC2Instance1": { + "Type": "AWS::EC2::Instance", + "Properties": { + "ImageId": "ami-d3adb33f", + "KeyName": "dummy", + "InstanceType": "t2.micro", + "Tags": [ + {"Key": "Description", "Value": "Test tag"}, + {"Key": "Name", "Value": "Name tag for tests"}, + ], + }, + } + }, +} + dummy_template_json = json.dumps(dummy_template) +dummy_template_special_chars_in_description_json = json.dumps( + dummy_template_special_chars_in_description +) dummy_update_template_json = json.dumps(dummy_update_template) dummy_output_template_json = json.dumps(dummy_output_template) dummy_import_template_json = json.dumps(dummy_import_template) @@ -1149,6 +1171,19 @@ def test_describe_deleted_stack(): stack_by_id["StackStatus"].should.equal("DELETE_COMPLETE") +@mock_cloudformation +def test_describe_stack_with_special_chars(): + cf_conn = boto3.client("cloudformation", region_name="us-east-1") + cf_conn.create_stack( + StackName="test_stack_spl", + TemplateBody=dummy_template_special_chars_in_description_json, + ) + + stack = cf_conn.describe_stacks(StackName="test_stack_spl")["Stacks"][0] + assert stack.get("StackName") == "test_stack_spl" + assert stack.get("Description") == "Stack 1 " + + @mock_cloudformation @mock_ec2 def test_describe_updated_stack():