aws / jsii

jsii allows code in any language to naturally interact with JavaScript classes. It is the technology that enables the AWS Cloud Development Kit to deliver polyglot libraries from a single codebase!
https://aws.github.io/jsii
Apache License 2.0
2.63k stars 244 forks source link

OpenSearch: EBSOptions.Iops and EBSOptions.VolumeSize type should be `int` #4504

Open JCKortlang opened 4 months ago

JCKortlang commented 4 months ago

Describe the bug

EBSOptions models Iops and VolumeSize as double but the cloud formation template defines them as int. Deployments fail when these values are set to none integer values.

Properties validation failed for resource OpenSearchDomain464FB114 with message: [#/EBSOptions/Iops: expected type: Integer, found: Double, #/EBSOptions/VolumeSize: expected type: Integer, found: Double

Expected Behavior

EBSOptions.Iops and EBSOptions.VolumeSize type should be int

https://docs.aws.amazon.com/opensearch-service/latest/APIReference/API_EBSOptions.html

Current Behavior

EBSOptions.Iops and EBSOptions.VolumeSize are double

Reproduction Steps

//From https://docs.aws.amazon.com/cdk/api/v2/dotnet/api/Amazon.CDK.AWS.OpenSearchService.Domain.html
var domain = new Domain(this, "Domain", new DomainProps {
    Version = EngineVersion.OPENSEARCH_1_0,
    Ebs = new EbsOptions {
        VolumeSize = 100.1,
        Iops = 3000.1,
        VolumeType = EbsDeviceVolumeType.GENERAL_PURPOSE_SSD
    },
    NodeToNodeEncryption = true,
    EncryptionAtRest = new EncryptionAtRestOptions {
        Enabled = true
    }
});

Possible Solution

Change EBSOptions.Iops and EBSOptions.VolumeSize to int

Additional Information/Context

No response

CDK CLI Version

2.136.1 (build 6f21c1d)

Framework Version

2.139.0

Node.js Version

v21.7.2

OS

MacOS 13.6.6 (22G630)

Language

.NET

Language Version

8.0.101

Other information

No response

khushail commented 4 months ago

Hi @JCKortlang , thanks for reaching out.

I see the cloudformation implementation and CDK typescript implementation specifies both props as Int. This is code level implementation which also declares these as int -https://github.com/aws/aws-cdk/blob/491434e19ea4566ef90ff137efe62e694bb03cca/packages/aws-cdk-lib/aws-opensearchservice/lib/domain.ts#L155

but this is incorrectly interpreted to .NET docs as double. Wonder why that happened. Please see that the documentation is auto generated from the cloudformation docs. However I will reach out to team for the insights how this can be corrected.

JCKortlang commented 4 months ago

@khushail it is not just the documentation. The cdk library in .NET models it as a double. Which allows the invalid values to be set.