aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.52k stars 3.86k forks source link

glue: CfnDatabase can't update if name is not provided #31158

Open grzegorzewald opened 1 month ago

grzegorzewald commented 1 month ago

Describe the bug

When once Cretes instance of CfnDatabase without name property set, it has name generated automatically based on construct ID. This is expected behaviour. But when construct is updated, CloudFormation errors with "no name provided error"

Regression Issue

Last Known Working CDK Version

2.152

Expected Behavior

When CfnDatabase is updated without name property set up, it would use previously generated database name

Current Behavior

When CfnDatabase is updated without name property set up it errors with: Database name cannot be equal to null or empty (Service: AWSGlue; Status Code: 400; Error Code: InvalidInputException; Request ID:00000000-0000-4000-0000-000000000000; Proxy: null)

Reproduction Steps

Create Database construct:

    const glueDatabase = new CfnDatabase(this, "MyDatabase", {
      catalogId: this.account,
      databaseInput: {
        description: "My Database",
      },
    });

deploy, update code to:

    const glueDatabase = new CfnDatabase(this, "MyDatabase", {
      catalogId: this.account,
      databaseInput: {
        description: "My Database",
        locationUri: `s3://${bucket.bucketName}/path/`,
      },
    });

and deploy once again

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.152.0 (build faa7d79)

Framework Version

No response

Node.js Version

v18.12.1

OS

MacOs 14.6

Language

TypeScript

Language Version

No response

Other information

No response

pahud commented 1 month ago

This seems to be a CFN bug to me as the Name is not required.

I will report to the internal team for verifying.

grzegorzewald commented 1 month ago

Exactly @pahud, name is not required, but feels to be required on update for reason...

pahud commented 1 month ago

internal tracking: V1491264517