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.34k stars 3.76k forks source link

aws_cdk_s3: enforce_ssl typo #24915

Open poladinesh opened 1 year ago

poladinesh commented 1 year ago

Describe the issue

enforce_ssl parameter has a typo in python documentation under aws_cdk_s3 module

Currently the documentation says:

bucket = s3.Bucket(self, "Bucket", enforce_sSL=True )

Correct Version:

bucket = s3.Bucket(self, "Bucket", enforce_ssl=True )

Links

https://docs.aws.amazon.com/cdk/api/v1/python/aws_cdk.aws_s3/README.html

pahud commented 1 year ago

Yes that should be fixed. While aws-cdk v1 will reach the end-of-support on June 1st I strongly recommend you check out the v2 document here instead https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_s3/Bucket.html

poladinesh commented 1 year ago

Hello @pahud,

Even the below links from v2 version have references to enforce_sSL (typo) in few places:

https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_s3/Bucket.html https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_s3/README.html

stefanfreitag commented 1 year ago

Hi, let me add the relevant line in the source code:

https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-s3/lib/bucket.ts#L1617

 * new Bucket(scope, 'Bucket', {
 *   blockPublicAccess: BlockPublicAccess.BLOCK_ALL,
 *   encryption: BucketEncryption.S3_MANAGED,
 *   enforceSSL: true,
 *   versioned: true,
 *   removalPolicy: RemovalPolicy.RETAIN,
 * });

The example in the source code seems to be correct. When transforming this example to Python code, keys change to snake_case: removalPolicy to removal_policy and also blockPublicAccess to block_public_access. For enforceSSL it is enforce_sSL - unfortunately not enforce_ssl as one would expect.

Not sure where this snake_case magic happens though.