Check for file existence before verifying checksum
@@ -154,11 +154,15 @@ func dataSourceFileReader(ctx context.Context, d *schema.ResourceData, m interfa
return diag.FromErr(err)
}
+ chksMatches := false
fileExists := FileExists(outputPath)
- chksMatches, err := VerifySha256Checksum(outputPath, fileInfo.Checksums.Sha256)
+ if fileExists {
+ chksMatches, err = VerifySha256Checksum(outputPath, fileInfo.Checksums.Sha256)
if err != nil {
+ tflog.Error(ctx, fmt.Sprintf("Failed to verify checksum for %s", outputPath))
return diag.FromErr(err)
}
+ }
tflog.Debug(ctx, "File info fetched", map[string]interface{}{
"fileInfo": fileInfo,
