Skip to content

Commit

Permalink
fix error log message for terraform file (#914)
Browse files Browse the repository at this point in the history
  • Loading branch information
Devang Gaur committed Jul 5, 2021
1 parent 1721cde commit 80c00e0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/iac-providers/terraform/commons/load-file.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func LoadIacFile(absFilePath string) (allResourcesConfig output.AllResourceConfi
return allResourcesConfig, fmt.Errorf(errMessage)
}
if diags != nil {
errMessage := fmt.Sprintf("failed to load config file '%s'. error:\n%v\n", absFilePath, getErrorMessagesFromDiagnostics(diags))
errMessage := fmt.Sprintf("failed to load iac file '%s'. error:\n%v\n", absFilePath, getErrorMessagesFromDiagnostics(diags))
zap.S().Debug(errMessage)
return allResourcesConfig, fmt.Errorf(errMessage)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/iac-providers/terraform/v12/load-file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ func TestLoadIacFile(t *testing.T) {
testErrorString1 := `error occured while loading config file 'not-there'. error:
<nil>: Failed to read file; The file "not-there" could not be read.
`
testErrorString2 := fmt.Sprintf(`failed to load config file '%s'. error:
testErrorString2 := fmt.Sprintf(`failed to load iac file '%s'. error:
%s:1,21-2,1: Invalid block definition; A block definition must have block content delimited by "{" and "}", starting on the same line as the block header.
%s:1,1-5: Unsupported block type; Blocks of type "some" are not expected here.
`, emptyTfFilePath, emptyTfFilePath, emptyTfFilePath)

testErrorString3 := fmt.Sprintf(`failed to load config file '%s'. error:
testErrorString3 := fmt.Sprintf(`failed to load iac file '%s'. error:
%s:8,12-22: Invalid reference from destroy provisioner; Destroy-time provisioners and their connection configurations may only reference attributes of the related resource, via 'self', 'count.index', or 'each.key'.
References to other resources during the destroy phase can cause dependency cycles and interact poorly with create_before_destroy.
Expand Down
2 changes: 1 addition & 1 deletion pkg/iac-providers/terraform/v14/load-file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestLoadIacFile(t *testing.T) {
<nil>: Failed to read file; The file "not-there" could not be read.
`

testErrorString2 := fmt.Sprintf(`failed to load config file '%s'. error:
testErrorString2 := fmt.Sprintf(`failed to load iac file '%s'. error:
%s:1,21-2,1: Invalid block definition; A block definition must have block content delimited by "{" and "}", starting on the same line as the block header.
%s:1,1-5: Unsupported block type; Blocks of type "some" are not expected here.
`, emptyTfFilePath, emptyTfFilePath, emptyTfFilePath)
Expand Down

0 comments on commit 80c00e0

Please sign in to comment.