Terraform

Terraform

Made by DeepSource

Legacy dot index syntax TF-L0038

Bug risk
Major

Terraform v0.12 supports traditional square brackets for accessing list items by index. However, for backward compatibility 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.

It is therefore recommended to switch to the square bracket syntax when accessing items in list, including resources that use count.

Example:

locals {
  list  = ["a", "b", "c"]
  value = list.0
}