-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
python aws_config.CfnCustomRule.scope property conflict #4302
Comments
As a workaround, can you try with the |
@jofoid, I demonstrated the problem in this issue using a managed rule because the code was simpler than a custom rule. I actually need to define a custom rule with the lambda hosted in a remote account. I would use the aws_config.CustomRule construct, which works using the method you mentioned. But it requires an ILambda object for the lambda= parameter. In my case, the lambda is in a remote account and I need to provide an arn to the lambda rather than a lambda object... So I was forced to use the CfnConfigRule construct and ran into this bug with the scope= parameter. The workaround I'm currently using is the core.CfnResource construct. |
@peterb154 you should be able to use the |
That works! Thanks! For others looking for an example of how to do this.
|
In the implementation of kernel calls, the positional argument list did not use the slugified argument name (in case where such an argument had a name conflict with a lifted kwarg), resulting in an incorrect argument list to be passed to `jsii-kernel`. This typically resulted in a type check error in the `jsii-kernel`, but could also have silently succeeded at making an incorrect call. Fixes aws/aws-cdk#4302
In the implementation of kernel calls, the positional argument list did not use the slugified argument name (in case where such an argument had a name conflict with a lifted kwarg), resulting in an incorrect argument list to be passed to `jsii-kernel`. This typically resulted in a type check error in the `jsii-kernel`, but could also have silently succeeded at making an incorrect call. Fixes aws/aws-cdk#4302
description of the bug
The python aws_config.CfnCustomRule construct's init() method improperly passes the construct's "scope" property to the jsii.create() method. It should be pass the property "scope_".
Reproduction Steps
scratch.py
Error Log
Environment
Synopsis
Most Construct classes take a positional argument called "scope" which represents the parent core.Construct object.
But in the in the CfnConfigRule class (
lib/python3.6/site-packages/aws_cdk/aws_config/__init__.py
), the positional argument "scope" is smartly changed to "scope_". It is likely because this class also has a named parameter "scope".The problem is that on line 153 we call
jsii.create(CfnConfigRule, self, [scope, id, props])
and pass the "scope" parameter (which is an IResolveable or a ScopeProperty object type) when we should be passing thescope_
parameter (which is a core.Construct) like thisjsii.create(CfnConfigRule, self, [scope_, id, props])
.As such, it throws the error.
The class definition for CfnConfigRule is below;
lib/python3.6/site-packages/aws_cdk/aws_config/init.py
starting at line 130:
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: