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

panic: runtime error: index out of range terraform crashes #25709

Closed
hkamat opened this issue Jul 30, 2020 · 4 comments
Closed

panic: runtime error: index out of range terraform crashes #25709

hkamat opened this issue Jul 30, 2020 · 4 comments
Labels
bug crash v0.12 Issues (primarily bugs) reported against v0.12 releases

Comments

@hkamat
Copy link

hkamat commented Jul 30, 2020

Terraform version:
Terraform v0.12.29

Issue Description
Running terraform to create a simple resource group results in terraform crashing.

Terraform actual output
crash.log

Probable Cause
I had copied some of the variable information in the json file from microsoft one note. This caused some special characters to appear which were not directly visible.
As I kept using json terraform kept crashing. Once I moved to tfvars file I got errors saying unrecognised
characters [it did not show which character though] properly from terraform.
terraformtfvarsmsg

Expected Output
Similar to tfvars as input i should get an error message for json file also and terraform should not crash.
terraformvscodecharsjson

JSON File
terraform.tfvars.log

@alisdair
Copy link
Contributor

Thanks for reporting this crash. Could you upload the exact JSON file which causes the panic (after removing any sensitive data)?

@alisdair alisdair added bug crash v0.12 Issues (primarily bugs) reported against v0.12 releases waiting-response An issue/pull request is waiting for a response from the community labels Jul 30, 2020
@hkamat
Copy link
Author

hkamat commented Jul 31, 2020

Done. Edited in the original comment for future reference.
Missed to do this before. Couldn't upload as .json so changed to .log

@ghost ghost removed the waiting-response An issue/pull request is waiting for a response from the community label Jul 31, 2020
@alisdair
Copy link
Contributor

This crash has been fixed as of 0.13.0-rc1, which now displays a more useful error diagnostic. The upstream pull request fixing this is hashicorp/hcl#358. Here's the result:

image

I think this is a pretty reasonable diagnostic, which would hopefully have been more helpful in identifying this invalid whitespace.

Closing out. Thanks again for reporting!

@ghost
Copy link

ghost commented Aug 31, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Aug 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug crash v0.12 Issues (primarily bugs) reported against v0.12 releases
Projects
None yet
Development

No branches or pull requests

2 participants