-
Notifications
You must be signed in to change notification settings - Fork 4k
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
fix(cfn-include): correctly handle the 'AWS::CloudFormation::CustomResource' resource type #10415
Merged
mergify
merged 2 commits into
aws:master
from
skinny85:fix/cfn-include-custom-cfn-resource
Sep 21, 2020
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
So one option is what you've done here -- mapping a custom resource to a CfnResource. Would the other be to fix the "useless" CfnCustomResource class? Could we add extensions to that class via the cfnspec additions? If so, it seems like that would solve this issue for more than just this one use case.
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.
One advantage of this escape hatch to
CfnResource
is thatAWS::CloudFormation::CustomResource
is handled the same asCustom::MyCoolResource
instead of one beingCfnResource
and the other beingCfnCustomResource
.Indeed it might be better to elaborate the
CfnCustomResource
interface, but I definitely think it is important to make sure that the 2 Type namings for Custom Resources result in the same construct.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.
Unfortunately,
CfnCustomResource
is auto-generated, so there's not much we can do there 😕. There's simply not a concept of "accept an arbitrary collection of properties" in the CloudFormation resource specification, and so it can't really be translated to our generated L1s.We can try to hack something on top of the resource specification (we've done that before, for example in #10316), but I'm not sure it's worth it in this case - like @DV8FromTheWorld said, it's actually more consistent in some sense to always return custom resources, regardless of the resource type they use, as instances of the
CfnResource
class.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 know, maybe I spoke too soon. I see that the resource specification for
AWS::CloudFormation::Resource
contains an"AdditionalProperties": true
field:Not sure if it's possible to express that easily in TypeScript, but I can investigate.
Let me know what you think @njlynch.
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.
Thanks for the deeper investigation. I think the context I was missing was that we return the other custom resource types as
CfnResource
as well. For the sake of consistency, I think we can stick with this approach.