terraform-linters / tflint

A Pluggable Terraform Linter
Mozilla Public License 2.0
4.98k stars 357 forks source link

String interpolation passed as a list #2008

Closed AlexcFrench closed 8 months ago

AlexcFrench commented 8 months ago

Summary

When a module receives a single-item list, I believe the correct syntax is :- private_endpoint_subresource_type = ["${var.private_endpoint_subresource_type}"]

However, this fails with deprecated string interpolation error : Warning: [Fixable] Interpolation-only expressions are deprecated in Terraform v0.12.14 (terraform_deprecated_interpolation)

Reference: https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.5.0/docs/rules/terraform_deprecated_interpolation.md

Command

tflint

Terraform Configuration

passing a variable to a module that expects a list(string) type.

TFLint Configuration

default

Output

Warning: [Fixable] Interpolation-only expressions are deprecated in Terraform v0.12.14 (terraform_deprecated_interpolation)

Reference: https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.5.0/docs/rules/terraform_deprecated_interpolation.md

TFLint Version

0.50.3

Terraform Version

1.7.5

Operating System

bendrucker commented 8 months ago

Interpolation-only expressions

Which is this: "${foo}". You are doing that in your config—the list wrapping has no impact. Each string in the list is itself an expression.

private_endpoint_subresource_type = [var.private_endpoint_subresource_type]