Skip to content

error parsing multiline comment #96

Closed
@julian7

Description

I'm trying to use checkov, which uses python-hcl2 as terraform file parser, and I have issues with parsing multiline comments as mentioned in bridgecrewio/checkov#2933. Here's my test with checkov:

❯ seq 1 4 | xargs -I, sh -c 'echo Example ,; cat ,.tf; checkov --quiet -f ,.tf'
Example 1
resource "null_resource" "nothing" {
    triggers = [
        /* "a",
        "b" */
    ]
}
terraform scan results:

Passed checks: 0, Failed checks: 0, Skipped checks: 0, Parsing errors: 1


Example 2
resource "null_resource" "nothing" {
    triggers = [
        /* "a", "b" */ ]
}

Example 3
resource "null_resource" "nothing" {
    triggers = [
        /* "a", "b" */
    ]
}
terraform scan results:

Passed checks: 0, Failed checks: 0, Skipped checks: 0, Parsing errors: 1


Example 4
resource "null_resource" "nothing" {
    triggers = [ /* "a", "b" */
    ]
}

I've also tested triggers = [ /* "a", "b" */ ] off camera, and it was rendering well.

I'm not sure, but probably this issue is more likely about handling lists rather than comments.

Activity

htorianik

htorianik commented on Jan 10, 2023

@htorianik
Contributor

Hi @julian7! Try to upgrade to v4.2.0. In #118 I added tests for multiline comments inside a tuple and the lib passes them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      error parsing multiline comment · Issue #96 · amplify-education/python-hcl2