aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

The DatabaseInstanceProps TS api is missing 'securityGroups' that exists in docs

Open shurmanidze opened this issue 7 years ago • 7 comments

Docs: https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-rds.DatabaseInstanceProps.html#securitygroups-span-class-api-icon-api-icon-experimental-title-this-api-element-is-experimental-it-may-change-without-notice-span

But it's not accessible in TS when creating a DatabaseInstance.

shurmanidze avatar Nov 04 '19 10:11 shurmanidze

This change has been introduced in 1.15.0, are you using the latest version?

https://github.com/aws/aws-cdk/blob/v1.15.0/CHANGELOG.md

jogold avatar Nov 04 '19 10:11 jogold

Yes, I'm on 1.15.0.

I had to use this so far:

(dbInstanceProps as any).securityGroups = [ securityGroup ];

shurmanidze avatar Nov 05 '19 20:11 shurmanidze

Please double check that you are on 1.15.0, see the released instance.d.ts in 1.15.0 https://unpkg.com/browse/@aws-cdk/[email protected]/lib/instance.d.ts

jogold avatar Nov 06 '19 08:11 jogold

Yes, I've checked your link and the DatabaseInstanceProps interface doesn't have the securityGroups property. But I've found the DatabaseInstanceNewProps interface that is used in the ctor of the DatabaseInstanceNew class, but the latter is not in the docs.

shurmanidze avatar Nov 07 '19 18:11 shurmanidze

Ok, it seems that I got it. The DatabaseInstanceNewProps interface is supposed to be used with the new DatabaseInstance(...) statement. But it's impossible to realize it since in the docs I can see only:

new DatabaseInstance(scope: Construct, id: string, props: DatabaseInstanceProps)

UPD: It appears that it's impossible to use DatabaseInstanceNewProps with new DatabaseInstance(...).

shurmanidze avatar Nov 07 '19 18:11 shurmanidze

I don't get your problem... DatabaseInstanceProps extends DatabaseInstanceSourceProps which extends DatabaseInstanceNewProps.

You can clearly see in this test that it's possible to create a DatabaseInstance with the securityGroups prop: https://github.com/aws/aws-cdk/blob/bdbe3aad61ae6d239c113670d0ed1b1052abf417/packages/%40aws-cdk/aws-rds/test/test.instance.ts#L551-L567

jogold avatar Nov 07 '19 18:11 jogold

Feel like wasting your time. I tried it one more time and I don't see any TS errors now. I don't know what it was, probably some kind of cache in VSCode. Thanks for your help, I'm closing this issue.

shurmanidze avatar Nov 08 '19 17:11 shurmanidze