aws / jsii

jsii allows code in any language to naturally interact with JavaScript classes. It is the technology that enables the AWS Cloud Development Kit to deliver polyglot libraries from a single codebase!
https://aws.github.io/jsii
Apache License 2.0
2.66k stars 246 forks source link

(cdk migrate): While running `cdk migrate` with python, error received (NameError: name 'props_access_keys_rotated_param_max_access_key_age' is not defined.) #4652

Open nishikkr opened 1 month ago

nishikkr commented 1 month ago

Describe the bug

  1. Use the AWS Config Conformance Pack YAML file: https://github.com/awslabs/aws-config-rules/blob/master/aws-config-conformance-packs/Operational-Best-Practices-for-CMMC-2.0-Level-2.yaml

  2. Run the CDK migrate command:

    cdk migrate --stack-name Comformance --language python --from-path Operational-Best-Practices-for-CMMC-2.0-Level-2.yaml
  3. Attempt to synthesize the stack:

    cdk synth

Regression Issue

Last Known Working CDK Version

No response

Expected Behavior

Expected to synthezie

Current Behavior

Failes error stated above

Reproduction Steps

  1. Use the AWS Config Conformance Pack YAML file: https://github.com/awslabs/aws-config-rules/blob/master/aws-config-conformance-packs/Operational-Best-Practices-for-CMMC-2.0-Level-2.yaml

  2. Run the CDK migrate command:

    cdk migrate --stack-name Comformance --language python --from-path Operational-Best-Practices-for-CMMC-2.0-Level-2.yaml
  3. Attempt to synthesize the stack:

    cdk synth

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.160.0 (build 7a8ae02)

Framework Version

No response

Node.js Version

v18.20.4

OS

MacOS, confirmed it with Windows as well

Language

Python

Language Version

Python 3.12.5

Other information

No response

khushail commented 1 month ago

Hi @nishikkr , thanks for reaching out.

I downloaded this yaml file and was able to migrate this yaml to my stack in Python on Mac-

Screenshot 2024-10-02 at 11 10 43 AM

snippet of stack created successfully -

Screenshot 2024-10-02 at 11 12 52 AM

The directory structure created -

Screenshot 2024-10-02 at 11 18 43 AM

I did the same for Typescript language and it succedded with that as well -

Screenshot 2024-10-02 at 11 21 37 AM Screenshot 2024-10-02 at 11 20 40 AM

Here is a useful post published by CDK Team on CDK Migrate command. Might be helpful.

I would request you to try again and get back if the issue persists. Thanks.

nishikkr commented 1 month ago

Sorry I didn’t describe the issue clear enough cdk migrate does complete without the error for both language but for cdk synth fails on python but doesn’t for typescript

khushail commented 1 month ago

@nishikkr , thanks for clarifying. I will investigate it further and get back to you.

khushail commented 1 month ago

@nishikkr , I am able to repro this in Python (however it succeeds in Typescript)-

NameError: name 'props_access_keys_rotated_param_max_access_key_age' is not defined. Did you mean: 'access_keys_rotated_param_max_access_key_age'?
Screenshot 2024-10-02 at 2 08 39 PM

This is related to JSII Runtime so marking it as appropriate for JSII team and moving to JSII Repo for further investigation.