Skip to content

Commit

Permalink
terraform_deprecated_index: add example of fix (#96)
Browse files Browse the repository at this point in the history
Co-authored-by: Ben Drucker <bvdrucker@gmail.com>
  • Loading branch information
ashishbista and bendrucker authored May 10, 2023
1 parent 599e680 commit 7ca30d9
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/rules/terraform_deprecated_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
```

0 comments on commit 7ca30d9

Please sign in to comment.