Description
Due to the fact that the errors returned by preCheck
during deletion are ignored, the processing logic for deletion is executed directly.
// pre-check Configuration
if err := r.preCheck(ctx, &configuration, meta); err != nil && !isDeleting {
return ctrl.Result{}, err
}
The initialization of the backend occurs in the preCheck
method. If an error occurs in preCheck
before calling the RenderConfiguration
method to initialize the backend, the backend will not be initialized, resulting in the deletion processing logic using the default backend.
During the CheckProvider step, calling the meta.getCredentials
method triggers the tfcfg.SetRegion method. If the configuration.Spec.Region
is not specified, the tfcfg.SetRegion
method will update the configuration. At this point, an error may occur with the message "the object has been modified."
I don't understand the code either, and it's unclear why configuration.Spec.Region
is being updated here, as there are no other references to it elsewhere.