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 [-1] #212

Open
eimantas-gecas-axomic opened this issue Sep 11, 2020 · 1 comment
Open

panic: runtime error: Index out of range [-1] #212

eimantas-gecas-axomic opened this issue Sep 11, 2020 · 1 comment

Comments

@eimantas-gecas-axomic
Copy link

eimantas-gecas-axomic commented Sep 11, 2020

---
version: 1
description: Lint terraform config
type: Terraform12
files:
  - "env/aws/dev/main.tf"
rules:

  - id: root_resource_naming_convention
    message: "Root resource name must end with the region name"
    category: resource
    severity: FAILURE
    assertions:
      - key: __name__
        op: regex
        value: ".*(us_east_1|us_east_2|us_west_1|us_west_2|af_south_1|ap_east_1|ap_south_1|ap_northeast_1|ap_northeast_2|ap_southeast_1|ap_southeast_2|ca_central_1|eu_central_1|eu_west_1|eu_west_2|eu_west_3|eu_south_1|eu_north_1|me_south_1|sa_east_1)$"
config-lint -debug -rules .configlint/root.yml env/aws/dev
Exclude patterns: []
Filenames to scan: [env/aws/dev/backend.tf env/aws/dev/data.tf env/aws/dev/main.tf env/aws/dev/providers.tf env/aws/dev/terragrunt.hcl env/aws/dev/variables.tf env/aws/dev/versions.tf]
panic: runtime error: index out of range [-1]

goroutine 1 [running]:
github.com/stelligent/config-lint/linter/tf12parser.(*Parser).ParseMany(0xc0001e8b68, 0x0, 0x0, 0x0, 0xc0001e8b00, 0x1009de3, 0x1640140, 0x1612c20, 0x108a301)
	/home/runner/work/config-lint/config-lint/linter/tf12parser/parser.go:48 +0x3eb
github.com/stelligent/config-lint/linter.loadHCLv2(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/home/runner/work/config-lint/config-lint/linter/terraform_v12.go:88 +0x172
github.com/stelligent/config-lint/linter.Terraform12ResourceLoader.LoadMany(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/home/runner/work/config-lint/config-lint/linter/terraform_v12.go:68 +0x9f
github.com/stelligent/config-lint/linter.FileLinter.Validate(0xc0000fec00, 0x7, 0x8, 0x1923de0, 0xc000209ec0, 0x192b260, 0x1d0b4e8, 0xc000370ea0, 0xb, 0xc0000c1a40, ...)
	/home/runner/work/config-lint/config-lint/linter/file_linter.go:50 +0x1d4
main.applyRules(0xc000364140, 0x1, 0x1, 0xc0000ac040, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, ...)
	/home/runner/work/config-lint/config-lint/cli/app.go:340 +0x555
main.main()
	/home/runner/work/config-lint/config-lint/cli/app.go:157 +0x67e

This only happens if I set the files to a path

@eimantas-gecas-axomic
Copy link
Author

Also seems to happen if you point config-lint at a directory without any .tf files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant