jsii icon indicating copy to clipboard operation
jsii copied to clipboard

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

Open JCKortlang opened this issue 1 year ago • 2 comments

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

JCKortlang avatar May 03 '24 19:05 JCKortlang

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.

khushail avatar May 03 '24 20:05 khushail

@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.

JCKortlang avatar May 06 '24 06:05 JCKortlang