Skip to content

Commit

Permalink
Fix panic when file read fails (#1598)
Browse files Browse the repository at this point in the history
  • Loading branch information
wata727 authored Nov 19, 2022
1 parent 3588e3c commit fb0fd9f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions terraform/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit fb0fd9f

Please sign in to comment.