Set the appropriate SNS subject when sending CloudFormation stack events (#4479)

This commit is contained in:
Paul Roberts 2021-10-27 01:15:51 -07:00 committed by GitHub
parent 7e3db1ecac
commit 6c9f959b94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 1 deletions

View File

@ -477,7 +477,9 @@ ClientRequestToken='{client_request_token}'""".format(
)
for sns_topic_arn in sns_topic_arns:
sns_backends[region].publish(message, arn=sns_topic_arn)
sns_backends[region].publish(
message, subject="AWS CloudFormation Notification", arn=sns_topic_arn
)
def filter_stacks(all_stacks, status_filter):

View File

@ -209,6 +209,7 @@ def test_create_stack_with_notification_arn():
message = queue.read(1)
msg = json.loads(message.get_body())
msg["Subject"].should.equal("AWS CloudFormation Notification")
msg["Message"].should.contain("StackId='{}'\n".format(stack.stack_id))
msg["Message"].should.contain("Timestamp='2015-01-01T12:00:00.000Z'\n")
msg["Message"].should.contain("LogicalResourceId='test_stack_with_notifications'\n")

View File

@ -1047,6 +1047,7 @@ def test_create_stack_with_notification_arn():
messages = queue.receive_messages()
messages.should.have.length_of(1)
msg = json.loads(messages[0].body)
msg["Subject"].should.equal("AWS CloudFormation Notification")
msg["Message"].should.contain("StackId='{}'\n".format(stack.stack_id))
msg["Message"].should.contain("LogicalResourceId='test_stack_with_notifications'\n")
msg["Message"].should.contain("ResourceStatus='CREATE_IN_PROGRESS'\n")