chore(kinesisfirehose): add validation for customTimeZone in S3BucketProps. #36089
+63
−12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue # (if applicable)
Closes #
Reason for this change
When delivering from Data Firehose to S3, there is a feature that allows you to specify the time zone for the S3 prefix.
The following conditions apply to time zone specification:
Rule 1: Regular Expression Pattern
Looking at the CLI's create-delivery-stream command, you can see regular expressions.
^$|[a-zA-Z/_]+
https://docs.aws.amazon.com/cli/latest/reference/firehose/create-delivery-stream.html
Rule 2: Time Zone Format
If you try to create it by specifying a 3-letter time zone such as EST, it will fail with the following message:
Rule 3: Supported Time Zones
There is a list of supported time zones, and anything else cannot be used.
https://docs.aws.amazon.com/firehose/latest/dev/s3-object-name.html
We will add these validations to detect errors before deploying resources.
Description of changes
Validation of regular expression pattern
^$|[a-zA-Z/_]+
Validation that it is not 3 characters
Blacklist of patterns considered extensions of 3 characters
e.g.
I would like to discuss the implementation policy for these.
If only items 1 and 2 are used, patterns considered extensions of 3 characters, such as "Etc/UTC", cannot be prevented. In fact, I also experienced a deployment failure when specifying "Etc/UTC" for CustomTimeZone.
It seems that adding item 3 could solve this, but deciding which patterns to exclude involves subjectivity.
The time zones I am currently considering including in the pattern are as follows:
Alternatively, there is another method where a list of time zones available in Data Firehose is registered as an enum-like class, and a whitelist is operated.
https://docs.aws.amazon.com/firehose/latest/dev/s3-object-name.html
This method requires making changes to the CDK every time the page is updated.
What do you think is the best approach?
Describe any new or updated permissions being added
Description of how you validated changes
Add both unit test.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license