fix: handle required_version in CDKTF terraform_json parser#7467
Open
raajheshkannaa wants to merge 1 commit intobridgecrewio:mainfrom
Open
fix: handle required_version in CDKTF terraform_json parser#7467raajheshkannaa wants to merge 1 commit intobridgecrewio:mainfrom
raajheshkannaa wants to merge 1 commit intobridgecrewio:mainfrom
Conversation
The terraform_json parser crashed on CDKTF-generated cdk.tf.json files that contain terraform.required_version as a string value. The handle_block_type function assumed all values would be dicts, but required_version is a simple string like ">= 1.5.0". Skip hclify() for simple-type values and wrap them as list values instead, consistent with how HCL attributes are represented elsewhere. Fixes bridgecrewio#7454
Author
|
Hi, could a maintainer approve the CI workflow run? The security scan check appears to be waiting for approval since this is an external contributor PR. Thanks! |
Author
|
Friendly bump. CI workflow has been waiting for maintainer approval since March 17. Could someone approve the workflow run so CI can validate this? Happy to address any feedback once tests run. |
Author
|
Friendly bump. CI workflow approval is still pending. Could a maintainer approve the workflow run? Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #7454
Summary
terraform_jsonparser when CDKTF-generatedcdk.tf.jsoncontainsrequired_versionas a plain stringhclify()expects a dict, butrequired_versionis a string. Added type check to route simple types through_clean_simple_type_list()insteadRoot cause
In
handle_block_type(), all config values are passed tohclify(), which raisesException: this method receives only dictsfor non-dict values likerequired_version: ">= 1.5.0".Test plan
prepare_definition()with mixed dict/string values in terraform blockrequired_versionloads without crashterraform_jsontests pass