-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Fix: CFn: support tags with ESMs #11787
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
6d4a754
to
eee5e84
Compare
ba81b9c
to
55577fe
Compare
58a6cc0
to
839ff1e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Think just fix that EventSourceArn
assignment and I'll approve 👍
localstack-core/localstack/services/lambda_/resource_providers/aws_lambda_eventsourcemapping.py
Outdated
Show resolved
Hide resolved
localstack-core/localstack/services/lambda_/resource_providers/aws_lambda_eventsourcemapping.py
Show resolved
Hide resolved
…/aws_lambda_eventsourcemapping.py Co-authored-by: Greg Furman <31275503+gregfurman@users.noreply.github.com>
model["Id"] = response["UUID"] | ||
model["EventSourceArn"] = response["EventSourceArn"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just want to clarify that this value needs to be set? I see the CFn docs show us just being able to get the Id
and EventSourceMappingArn
attributes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, thanks 🙏 . I have just tested against AWS (never trust the docs, especially for CFn!). On the other hand, there is a discrepancy between the specs we use to generate the resource providers and the CFn implementation. The specs do not mention EventSourceMappingArn
as a property that can be accessed on the resource, however it is clearly there in the docs.
Again: never NEVER trust the docs! (or the specs in this case... 😂 )
This is not in the list of available properties on the resource, however `EventSourceMappingArn` is not present in the spec so 🤷
# check the mapping works | ||
queue_url = stack.outputs["QueueUrl"] | ||
aws_client.sqs.send_message( | ||
QueueUrl=queue_url, | ||
MessageBody=json.dumps({"body": "something"}), | ||
) | ||
|
||
retry( | ||
lambda: aws_client.s3.head_object(Bucket=stack.outputs["OutputBucketName"], Key=output_key), | ||
retries=10, | ||
sleep=5.0, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe overkill for this case where we technically only care about CRUD functionality
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, but I always like to test the resources created actually work.
Co-authored-by: Greg Furman <31275503+gregfurman@users.noreply.github.com>
Motivation
Event Source Mappings are supported via CloudFormation, however two things are currently broken:
This means that the tag format supported by CloudFormation is not directly compatible with the tag format used by
boto3
.!GetAtt <ESM>.EventSourceMappingArn
the value returned isNone
Changes
EventSourceMappingArn
property to handle theGetAtt
case