From fb0fd9f53c67bb013032fa6e1d772de676652973 Mon Sep 17 00:00:00 2001 From: Kazuma Watanabe Date: Sat, 19 Nov 2022 18:20:48 +0900 Subject: [PATCH] Fix panic when file read fails (#1598) --- terraform/parser.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/terraform/parser.go b/terraform/parser.go index 6f5dc8e01..81f010dbf 100644 --- a/terraform/parser.go +++ b/terraform/parser.go @@ -66,6 +66,9 @@ func (p *Parser) LoadConfigDir(dir string) (*Module, hcl.Diagnostics) { for i, path := range primaries { f, loadDiags := p.loadHCLFile(path) diags = diags.Extend(loadDiags) + if loadDiags.HasErrors() { + continue + } mod.primaries[i] = f mod.Sources[path] = f.Bytes @@ -74,6 +77,9 @@ func (p *Parser) LoadConfigDir(dir string) (*Module, hcl.Diagnostics) { for i, path := range overrides { f, loadDiags := p.loadHCLFile(path) diags = diags.Extend(loadDiags) + if loadDiags.HasErrors() { + continue + } mod.overrides[i] = f mod.Sources[path] = f.Bytes