From 7ca30d98b8a4372684800a3bdd276a2c28a4310b Mon Sep 17 00:00:00 2001 From: Ashish Bista Date: Wed, 10 May 2023 17:32:25 -0500 Subject: [PATCH] `terraform_deprecated_index`: add example of fix (#96) Co-authored-by: Ben Drucker --- docs/rules/terraform_deprecated_index.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/rules/terraform_deprecated_index.md b/docs/rules/terraform_deprecated_index.md index 8561509..fda5640 100644 --- a/docs/rules/terraform_deprecated_index.md +++ b/docs/rules/terraform_deprecated_index.md @@ -53,3 +53,21 @@ Terraform v0.12 supports traditional square brackets for accessing list items by ## How To Fix Switch to the square bracket syntax when accessing items in list, including resources that use `count`. + +Example: + +```hcl +locals { + list = [{a = "b}, {a = "c"}] + value = list.*.a +} +``` + +Change this to: + +```hcl +locals { + list = [{a = "b}, {a = "c"}] + value = list[*].a +} +```