#11222·trivy

bug(misconf): numbers in Terraform list attributes are not converted to strings

Author: nikpivkinCreated Sep 10, 2026Updated Sep 10, 2026
Labelskind/bugscan/misconfiguration

Discussed in https://github.com/aquasecurity/trivy/discussions/11195

Trivy reports GCP-0072 for a firewall rule that has explicit ports, if the ports are written as numbers.

hcl
resource "google_compute_firewall" "example" {
  network       = "test"
  source_ranges = ["1.2.3.4/32"]
  allow {
    protocol = "tcp"
    ports    = [111, 343]
  }
}

The google provider declares ports as a list of strings, and its own schema description gives [22] and [80, 443] as example inputs, because Terraform converts a value to the type from the provider schema. The SDK turns the declared type into a cty type, and hcldec converts the decoded value to it, so the numbers become strings.

When an adapter reads a list of strings, it keeps only the values that are already strings and turns everything else into an unresolvable value. The rule ends up with an empty port list, and the check reads an empty list as a rule without ports, so it reports that all ports are open.

The other checks that read firewall ports are affected the same way, and so is any attribute that an adapter reads as a list of strings.