Skip to content

Commit a4b2a2c

Browse files
committed
fix(read): implement read_response_codes and avoid post-creationg drift
ReadResponseCodes was never actually used Also, improve the situation when oldSanitized is null (aka: we just created the object) Signed-off-by: Alexandre Bruyelles <git@jack.fr.eu.org>
1 parent 7e0fd48 commit a4b2a2c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

internal/provider/curl_resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ func (r *CurlResource) Read(ctx context.Context, req resource.ReadRequest, resp
721721
}
722722

723723
// Drift detection
724-
if oldSanitized != sanitizedResponse {
724+
if !responseCodeChecker(data.ReadResponseCodes, httpResp.StatusCode) || (oldSanitized != "null" && oldSanitized != sanitizedResponse) {
725725
tflog.Warn(ctx, "Drift detected: Response has changed, marking for recreation.")
726726
data.DriftMarker = types.StringValue(time.Now().Format(time.RFC3339Nano))
727727
} else {

0 commit comments

Comments
 (0)