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

terraform_deprecated_index fails to parse nested interpolations in JSON #52

Closed
glindstedt opened this issue Dec 9, 2022 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@glindstedt
Copy link

Probably related to #42 #43

A minimal example based on our usage:

{
  "resource": {
    "google_storage_bucket_object": {
      "foo": {
        "bucket": "foo",
        "name": "foo.zip#${filemd5(\"${path.module}/foo.zip\")}",
        "source": "${path.module}/foo.zip"
      }
    }
  }
}

This fails with 0.2.1 with the following error:

Failed to check ruleset; Failed to check `terraform_deprecated_index` rule: foo.tf.json:10,36-37: Invalid character; This character is not used within the language., and 2 other diagnostic(s)

But if I force version 0.1.1 this error does not appear.

@bendrucker
Copy link
Member

Can you make this truly minimal by limiting to a single interpolated expression? If any expression will break this way, just source is a minimal reproduction. The static attribute is irrelevant, I'm mainly interested in whether source reproduces or whether there's something about the name expression.

@glindstedt
Copy link
Author

glindstedt commented Dec 9, 2022

Got it down to this:

{
  "resource": {
    "google_storage_bucket_object": {
      "foo": {
        "name": "${\"${x}\"}"
      }
    }
  }
}

@bendrucker bendrucker added the bug Something isn't working label Dec 9, 2022
@bendrucker bendrucker changed the title terraform_deprecated_index failed with "Invalid Character" when using interpolation in json syntax terraform_deprecated_index fails to parse nested interpolations in JSON Dec 9, 2022
@wata727
Copy link
Member

wata727 commented Apr 22, 2023

This issue doesn't seem to reproduce in v0.2.2. Also, this rule was rewritten in #90 and may no longer be fully reproducible.
For the reasons above, closing this issue. If the issue still reproduces, please open a new issue.

@wata727 wata727 closed this as completed Apr 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

3 participants