Skip to content

If a backend is specified, an error in the preCheck during deletion will result in the backend becoming null #372

Open
@wujiuye

Description

@wujiuye

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions