Skip to content

Commit

Permalink
fix(terraform): try/catch HCL parsing (#19792)
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Jan 11, 2023
1 parent a0cbd89 commit 58a6d64
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/modules/manager/terraform/hcl/index.ts
@@ -1,7 +1,11 @@
import * as hcl_parser from 'hcl2-parser';

export function parseHCL(content: string): any {
return hcl_parser.parseToObject(content)[0];
try {
return hcl_parser.parseToObject(content)[0];
} catch (err) /* istanbul ignore next */ {
return null;
}
}

export function parseJSON(content: string): any {
Expand Down

0 comments on commit 58a6d64

Please sign in to comment.