Currently *.hcl is detected as terraform. Packer files are however *.pkr.hcl (or *.pkr.json). So currently they are incorrectly detected as terraform when they should be detected as packer. So they have the terraform grammar and terraform lsp applied, both of which give spurious errors. See https://developer.hashicorp.com/packer/docs/templates/hcl_templates#builds
Currently *.hcl is detected as terraform. Packer files are however *.pkr.hcl (or *.pkr.json). So currently they are incorrectly detected as terraform when they should be detected as packer. So they have the terraform grammar and terraform lsp applied, both of which give spurious errors. See https://developer.hashicorp.com/packer/docs/templates/hcl_templates#builds