Skip to content
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

[core] Prefix mutable L1 properties with prop #11667

Open
rix0rrr opened this issue Nov 24, 2020 · 0 comments
Open

[core] Prefix mutable L1 properties with prop #11667

rix0rrr opened this issue Nov 24, 2020 · 0 comments
Labels
@aws-cdk/core Related to core CDK functionality cause/l1-name-instead-of-ref Caused by users using CfnSomething.somethingName instead of CfnSomething.ref effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 package/cfn Related to the CFN layer (L1) wontfix We have determined that we will not resolve the issue.

Comments

@rix0rrr
Copy link
Contributor

rix0rrr commented Nov 24, 2020

It's quite common for people to be using L1s, and then try to refer to the name of the recently-generated resource by using the name property.

For example:

const dashboard = new CfnDashboard(...);

new Something(..., {
  dashboardName: dashboard.dashboardName,    // <---- wrooooong
});

This looks seductive and sane, but is actually wrong. dashboardName is a mutable version of the (input) property, and typically undefined, NOT a reference generated/calculated name of the resource ({ Ref }), which also implies a dependency.

The correct usage would have been:

dashboard.attrDashboardName
dashboard.ref

Depending on the use case.

People get this wrong all the time, because it's a CFN quirk that we expect people to be familiar with, but they're not.

Bug reports caused by this design mistake:

https://github.com/aws/aws-cdk/issues?q=is%3Aissue+label%3Acause%2Fl1-name-instead-of-ref+is%3Aclosed

A good solution would probably be to deprecate the old property names and properly prefix them with prop (propDashboardName).

Hopefully that will give people a fighting chance figuring out what they're looking for.

Probably needs to be prioritized for v2 because after V2 the deprecation (but availability) of the old property names means people will continue making the same mistakes.


This is a 🚀 Feature Request

@rix0rrr rix0rrr added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Nov 24, 2020
@rix0rrr rix0rrr self-assigned this Nov 24, 2020
@github-actions github-actions bot added the @aws-cdk/core Related to core CDK functionality label Nov 24, 2020
@rix0rrr rix0rrr added cause/l1-name-instead-of-ref Caused by users using CfnSomething.somethingName instead of CfnSomething.ref package/cfn Related to the CFN layer (L1) effort/small Small work item – less than a day of effort p1 effort/medium Medium work item – several days of effort and removed effort/small Small work item – less than a day of effort labels Nov 24, 2020
@SomayaB SomayaB removed the needs-triage This issue or PR still needs to be triaged. label Nov 25, 2020
@rix0rrr rix0rrr added the wontfix We have determined that we will not resolve the issue. label Feb 8, 2022
@comcalvi comcalvi reopened this Jan 25, 2023
@aws aws deleted a comment from github-actions bot Jan 25, 2023
@comcalvi comcalvi added p2 and removed p1 labels Jan 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/core Related to core CDK functionality cause/l1-name-instead-of-ref Caused by users using CfnSomething.somethingName instead of CfnSomething.ref effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 package/cfn Related to the CFN layer (L1) wontfix We have determined that we will not resolve the issue.
Projects
None yet
Development

No branches or pull requests

3 participants