Skip to content

Commit

Permalink
tfexec: Improve error message for incompatible version
Browse files Browse the repository at this point in the history
  • Loading branch information
radeksimko committed Jun 17, 2021
1 parent 8ef6202 commit 800cdb4
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tfexec/exit_errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,5 +243,16 @@ type ErrTFVersionMismatch struct {
}

func (e *ErrTFVersionMismatch) Error() string {
return "terraform core version not supported by configuration"
version := "version"
if e.TFVersion != "" {
version = e.TFVersion
}

requirement := ""
if e.Constraint != "" {
requirement = fmt.Sprintf(" (%s required)", e.Constraint)
}

return fmt.Sprintf("terraform %s not supported by configuration%s",
version, requirement)
}

0 comments on commit 800cdb4

Please sign in to comment.