-
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
refactor(glue): change physical name to optional #23221
refactor(glue): change physical name to optional #23221
Conversation
Lazy.string({ | ||
produce: () => Names.uniqueResourceName(this, {}).toLowerCase(), | ||
}), |
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.
why use a Lazy
here?
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.
Do we have to use toLowerCase()
?
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.
why use a
Lazy
here?
Because physicalName
should set in the super
. However, when we call the super
, we can't use this
for Names
so we should use a Lazy
. Also we can looks this pattern in a other packages (e.g aws-stepfunctions/Activity
)
constructor(scope: Construct, id: string, props: ActivityProps = {}) {
super(scope, id, {
physicalName: props.activityName ||
Lazy.string({ produce: () => this.generateName() }),
});
Do we have to use
toLowerCase()
?
Yes, AWS::Glue::Database
.DatabaseInput.Name
and AWS::Glue::Table
.TableInput.Name
must be lowercase.
Pull request has been modified.
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.
Nice work!
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
@Mergifyio requeue |
☑️ This pull request is already queued |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Currently, we must set the physical name in the Glue L2 Constructs. This is not abide by the [CDK Best Practices](https://docs.aws.amazon.com/cdk/v2/guide/best-practices.html#best-practices-apps-names). So, this mean also customer can not abide by the best practices too. example ```ts const myDatabase = new glue.Database(this, "MyDatabase", { databaseName: "my-database", // need }) new glue.Table(this, "MyTable", { tableName: "my-tabel", // need database: myDatabase, columns: [...] }) ``` This PR fix physicalName in props to optonal and when not privided physicalName then generate physicalName by CDK. Then customers can abide by the best practices and no more coding while worrying about physical name conflicts. example after fixed ```ts const myDatabase = new glue.Database(this, "MyDatabase") new glue.Table(this, "MyTable", { database: myDatabase, columns: [...] }) ``` Also fixd the documents. ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Construct Runtime Dependencies: * [ ] This PR adds new construct runtime dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-construct-runtime-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Currently, we must set the physical name in the Glue L2 Constructs. This is not abide by the [CDK Best Practices](https://docs.aws.amazon.com/cdk/v2/guide/best-practices.html#best-practices-apps-names). So, this mean also customer can not abide by the best practices too. example ```ts const myDatabase = new glue.Database(this, "MyDatabase", { databaseName: "my-database", // need }) new glue.Table(this, "MyTable", { tableName: "my-tabel", // need database: myDatabase, columns: [...] }) ``` This PR fix physicalName in props to optonal and when not privided physicalName then generate physicalName by CDK. Then customers can abide by the best practices and no more coding while worrying about physical name conflicts. example after fixed ```ts const myDatabase = new glue.Database(this, "MyDatabase") new glue.Table(this, "MyTable", { database: myDatabase, columns: [...] }) ``` Also fixd the documents. ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Construct Runtime Dependencies: * [ ] This PR adds new construct runtime dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-construct-runtime-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Currently, we must set the physical name in the Glue L2 Constructs. This is not abide by the [CDK Best Practices](https://docs.aws.amazon.com/cdk/v2/guide/best-practices.html#best-practices-apps-names). So, this mean also customer can not abide by the best practices too. example ```ts const myDatabase = new glue.Database(this, "MyDatabase", { databaseName: "my-database", // need }) new glue.Table(this, "MyTable", { tableName: "my-tabel", // need database: myDatabase, columns: [...] }) ``` This PR fix physicalName in props to optonal and when not privided physicalName then generate physicalName by CDK. Then customers can abide by the best practices and no more coding while worrying about physical name conflicts. example after fixed ```ts const myDatabase = new glue.Database(this, "MyDatabase") new glue.Table(this, "MyTable", { database: myDatabase, columns: [...] }) ``` Also fixd the documents. ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Construct Runtime Dependencies: * [ ] This PR adds new construct runtime dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-construct-runtime-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Currently, we must set the physical name in the Glue L2 Constructs. This is not abide by the CDK Best Practices.
So, this mean also customer can not abide by the best practices too.
example
This PR fix physicalName in props to optonal and when not privided physicalName then generate physicalName by CDK.
Then customers can abide by the best practices and no more coding while worrying about physical name conflicts.
example after fixed
Also fixd the documents.
All Submissions:
Adding new Construct Runtime Dependencies:
New Features
yarn integ
to deploy the infrastructure and generate the snapshot (i.e.yarn integ
without--dry-run
)?By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license