Skip to content
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

aws_config: Unable to create rules #20106

Closed
bearrito opened this issue Apr 27, 2022 · 4 comments
Closed

aws_config: Unable to create rules #20106

bearrito opened this issue Apr 27, 2022 · 4 comments
Labels
@aws-cdk/aws-config Related to AWS Config bug This issue is a bug. effort/small Small work item – less than a day of effort needs-reproduction This issue needs reproduction. p2

Comments

@bearrito
Copy link

bearrito commented Apr 27, 2022

Describe the bug

Running CDK synth on a aws_config rule fails.

Expected Behavior

For the cdk synth to work.

Current Behavior

CDK synth failed with the following stack trace.

Traceback (most recent call last):
  File "app.py", line 25, in <module>
    compliance = SecurityStack(app, "SecurityStack", security_config)
  File "/home/bstrausser/.virtualenvs/cloud-formation/lib/python3.8/site-packages/jsii/_runtime.py", line 86, in __call__
    inst = super().__call__(*args, **kwargs)
  File "/home/bstrausser/Git/platform-cloud-infrastructure/sd-wan/sd_wan_stack/security_stack.py", line 61, in __init__
    compliance.ManagedRule(
  File "/home/bstrausser/.virtualenvs/cloud-formation/lib/python3.8/site-packages/jsii/_runtime.py", line 86, in __call__
    inst = super().__call__(*args, **kwargs)
  File "/home/bstrausser/.virtualenvs/cloud-formation/lib/python3.8/site-packages/aws_cdk/aws_config/__init__.py", line 5623, in __init__
    jsii.create(self.__class__, self, [scope, id, props])
  File "/home/bstrausser/.virtualenvs/cloud-formation/lib/python3.8/site-packages/jsii/_kernel/__init__.py", line 290, in create
    response = self.provider.create(
  File "/home/bstrausser/.virtualenvs/cloud-formation/lib/python3.8/site-packages/jsii/_kernel/providers/process.py", line 344, in create
    return self._process.send(request, CreateResponse)
  File "/home/bstrausser/.virtualenvs/cloud-formation/lib/python3.8/site-packages/jsii/_kernel/providers/process.py", line 311, in send
    data = json.dumps(req_dict, default=jdefault).encode("utf8")
  File "/usr/lib/python3.8/json/__init__.py", line 234, in dumps
    return cls(
  File "/usr/lib/python3.8/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.8/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/home/bstrausser/.virtualenvs/cloud-formation/lib/python3.8/site-packages/jsii/_kernel/providers/process.py", line 151, in jdefault
    raise TypeError("Don't know how to convert object to JSON: %r" % obj)
TypeError: Don't know how to convert object to JSON: <sd_wan_stack.security_stack.SecurityStack object at 0x7f8b128246a0>

Reproduction Steps

from aws_cdk import aws_config as compliance
from aws_cdk import  Stack,

class ComplianceStack(Stack):
    def __init__(
        self,
        scope: Construct,
        construct_id: str,
        **kwargs,
    ) -> None:
       

        compliance.ManagedRule(
            self,
            "VPC FLOW LOGS",
            identifier=compliance.ManagedRuleIdentifiers.VPC_FLOW_LOGS_ENABLED,
            maximum_execution_frequency=compliance.MaximumExecutionFrequency.TWELVE_HOURS,
        )

Possible Solution

No response

Additional Information/Context

Might be related to this issue -

aws/jsii#3372
hashicorp/terraform-cdk#1541 seems related as well

CDK CLI Version

2.21.1 (build a6ee543)

Framework Version

No response

Node.js Version

6.14.16

OS

Ubuntu 20

Language

Python

Language Version

No response

Other information

No response

@bearrito bearrito added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Apr 27, 2022
@github-actions github-actions bot added the @aws-cdk/aws-config Related to AWS Config label Apr 27, 2022
@bearrito bearrito changed the title (aws_config): (Unable to create rules) aws_config: Unable to create rules Apr 27, 2022
@ryparker ryparker added the p1 label Apr 28, 2022
@rix0rrr
Copy link
Contributor

rix0rrr commented May 9, 2022

The code you gave does not reproduce the issue for me. The stack synths fine.

@rix0rrr rix0rrr added needs-reproduction This issue needs reproduction. effort/small Small work item – less than a day of effort p2 and removed p1 needs-triage This issue or PR still needs to be triaged. labels May 9, 2022
@rix0rrr rix0rrr removed their assignment May 9, 2022
@bearrito
Copy link
Author

bearrito commented May 9, 2022

That's a slightly reduced version than what I using in production. I'll see if I can create smaller stack that reproduces it.

@bearrito
Copy link
Author

bearrito commented May 9, 2022

I can't reproduce this either now. I'll say that I updated CDK versions after filing this ticket, perhaps there was a fix in there.
This is probably okay to close.

@bearrito bearrito closed this as completed May 9, 2022
@github-actions
Copy link

github-actions bot commented May 9, 2022

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-config Related to AWS Config bug This issue is a bug. effort/small Small work item – less than a day of effort needs-reproduction This issue needs reproduction. p2
Projects
None yet
Development

No branches or pull requests

3 participants