Closed jameshoward closed 1 year ago
Thanks, we'll take a look. While Partial will not work because it cannot be translated to the Java and Python versions of the constructs, we have handled this with | any
in other situations.
This has been completed (allowing | any since partial doesn't work with JSII). It will be in the next release, sometime this week.
buildWebacl
fromwaf-helper
usesconsolidateProps
to merge in the providedwebaclProps
with the defaults. However, if you want to override just one of the props when constructing aWafwebaclToCloudFront
, it results in a type error:Type '{ rules: RuleProperty[]; }' is missing the following properties from type 'CfnWebACLProps': defaultAction, scope, visibilityConfigts(2739)
The type only needs to be a partial, since it's merged with the defaults.
Use Case
It would make it easier to just override individual ACL props, such as the rules.
Proposed Solution
Change
WafwebaclToCloudFrontProps
sowebaclProps
becomes aPartial
ofwaf.CfnWebACLProps
:Other
As a side note, this doesn't actually seem to override the rules and triggers warnings about overriding properties of the existing rules. The docs suggest it should work:
Workaround
At the moment I've used the code below as a workaround but it means a redundant call to
DefaultWafwebaclProps
, which will be called again inbuildWebacl
. The other option would be a@ts-ignore
.This is a :rocket: Feature Request