You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
packer/hcl2template/utils.go

24 lines
513 B

package hcl2template
import "github.com/hashicorp/hcl/v2"
func warningErrorsToDiags(block *hcl.Block, warnings []string, err error) hcl.Diagnostics {
var diags hcl.Diagnostics
for _, warning := range warnings {
diags = append(diags, &hcl.Diagnostic{
Summary: warning,
Subject: &block.DefRange,
Severity: hcl.DiagWarning,
})
}
if err != nil {
diags = append(diags, &hcl.Diagnostic{
Summary: err.Error(),
Subject: &block.DefRange,
Severity: hcl.DiagError,
})
}
return diags
}