github.com/jpreese/tflint@v0.19.2-0.20200908152133-b01686250fb6/docs/rules/terraform_deprecated_index.md (about) 1 # terraform_deprecated_index 2 3 Disallow legacy dot index syntax. 4 5 ## Example 6 7 ```hcl 8 locals { 9 list = ["a", "b", "c"] 10 value = list.0 11 } 12 ``` 13 14 ``` 15 $ tflint 16 1 issue(s) found: 17 18 Warning: List items should be accessed using square brackets (terraform_deprecated_index) 19 20 on example.tf line 3: 21 3: value = list.0 22 23 Reference: https://github.com/terraform-linters/tflint/blob/v0.16.1/docs/rules/terraform_deprecated_index.md 24 ``` 25 26 ## Why 27 28 Terraform v0.12 supports traditional square brackets for accessing list items by index. However, for backward compatability with v0.11, Terraform continues to support accessing list items with the dot syntax normally used for attributes. While Terraform does not print warnings for this syntax, it is no longer documented and its use is discouraged. 29 30 ## How To Fix 31 32 Switch to the square bracket syntax when accessing items in list, including resources that use `count`.