Description:
Unable to create stack with example generated during "init" command
sam --version
SAM CLI, version 1.2.0
Steps to reproduce the issue:
Observed result:
Uploading to 3f4c15d7488e699c3fa25c0e11ffadb9 6535 / 6535.0 (100.00%)
Deploying with following values
===============================
Stack name : sam-test
Region : eu-west-1
Confirm changeset : False
Deployment s3 bucket : <blah-blah>
Capabilities : ["CAPABILITY_IAM"]
Parameter overrides : {}
Initiating deployment
=====================
Uploading to 4aafdb944a682601b1c232b6459dc28f.template 717 / 717.0 (100.00%)
Waiting for changeset to be created..
CloudFormation stack changeset
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Operation LogicalResourceId ResourceType
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ Add SQSPayloadLoggerRole AWS::IAM::Role
+ Add SQSPayloadLoggerSQSQueueEvent AWS::Lambda::EventSourceMapping
+ Add SQSPayloadLogger AWS::Lambda::Function
+ Add SimpleQueue AWS::SQS::Queue
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Changeset created successfully. arn:aws:cloudformation:eu-west-1:174036874613:changeSet/samcli-deploy1599221902/475d136d-e501-4476-a000-00c8b4487263
2020-09-04 13:18:28 - Waiting for stack create/update to complete
CloudFormation events from changeset
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ResourceStatus ResourceType LogicalResourceId ResourceStatusReason
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CREATE_IN_PROGRESS AWS::IAM::Role SQSPayloadLoggerRole -
CREATE_IN_PROGRESS AWS::SQS::Queue SimpleQueue -
CREATE_IN_PROGRESS AWS::IAM::Role SQSPayloadLoggerRole Resource creation Initiated
CREATE_IN_PROGRESS AWS::SQS::Queue SimpleQueue Resource creation Initiated
CREATE_COMPLETE AWS::SQS::Queue SimpleQueue -
CREATE_COMPLETE AWS::IAM::Role SQSPayloadLoggerRole -
CREATE_IN_PROGRESS AWS::Lambda::Function SQSPayloadLogger -
CREATE_IN_PROGRESS AWS::Lambda::Function SQSPayloadLogger Resource creation Initiated
CREATE_COMPLETE AWS::Lambda::Function SQSPayloadLogger -
CREATE_IN_PROGRESS AWS::Lambda::EventSourceMapping SQSPayloadLoggerSQSQueueEvent -
CREATE_FAILED AWS::Lambda::EventSourceMapping SQSPayloadLoggerSQSQueueEvent Model validation failed (#/EventSourceArn:
failed validation constraint for keyword
[pattern])
ROLLBACK_IN_PROGRESS AWS::CloudFormation::Stack sam-test The following resource(s) failed to create:
[SQSPayloadLoggerSQSQueueEvent]. . Rollback
requested by user.
DELETE_COMPLETE AWS::Lambda::EventSourceMapping SQSPayloadLoggerSQSQueueEvent -
DELETE_IN_PROGRESS AWS::SQS::Queue SimpleQueue -
DELETE_IN_PROGRESS AWS::Lambda::Function SQSPayloadLogger -
DELETE_COMPLETE AWS::Lambda::Function SQSPayloadLogger -
DELETE_IN_PROGRESS AWS::IAM::Role SQSPayloadLoggerRole -
DELETE_COMPLETE AWS::IAM::Role SQSPayloadLoggerRole -
DELETE_COMPLETE AWS::SQS::Queue SimpleQueue -
ROLLBACK_COMPLETE AWS::CloudFormation::Stack sam-test -
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Error: Failed to create/update the stack: sam-test, Waiter StackCreateComplete failed: Waiter encountered a terminal failure state
Expected result:
working example
Ran into this issue as well, was able to fix it by using !GetAtt instead of Fn::GetAtt in the template as mentioned in similar issue here: https://github.com/aws/aws-sam-cli-app-templates/pull/42
Faced it too. Changing Fn::GetAtt to !GetAtt and executing sam build before deploy helped me (thanks for sharing!). Also I had to delete failed CloudFromation stack manually via AWS web console
Most helpful comment
Ran into this issue as well, was able to fix it by using
!GetAttinstead ofFn::GetAttin the template as mentioned in similar issue here: https://github.com/aws/aws-sam-cli-app-templates/pull/42