Inconsistent result after apply hostnames[1]: was cty.StringVal("initial.example.com") now cty.StringVal("updated.example.com")

I’m encountering an issue with my custom provider with The provider framework.
when trying to apply changes to the custom_hostname attribute. After running terraform apply, I receive an error message stating that the provider produced an inconsistent result, with a specific discrepancy in the hostnames array.

The error received is as follows:

│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to example_tenant_configuration.tenant_configuration["example"], provider "provider[\"registry.terraform.io/example-oss/example-provider\"]" produced an unexpected new value: .hostnames[1]: was cty.StringVal("initial.example.com"), but now
│ cty.StringVal("updated.example.com").

Here is a high-level overview of the code:

// Struct representation of the tenantModel
type tenantModel struct {
	ID             types.String `tfsdk:"id"`
	Hostnames      types.List   `tfsdk:"hostnames"`
	CustomHostname types.String `tfsdk:"custom_hostname"`
}

// Schema defines the schema for the resource.
func (r *tenantResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
	resp.Schema = schema.Schema{
		Attributes: map[string]schema.Attribute{
			"id": schema.StringAttribute{
				Computed: true,
				PlanModifiers: []planmodifier.String{
					stringplanmodifier.UseStateForUnknown(),
				},
			},
			"hostnames": schema.ListAttribute{
				ElementType: types.StringType,
				Computed:    true,
				PlanModifiers: []planmodifier.List{
					listplanmodifier.UseStateForUnknown(),
				},
			"custom_hostname": schema.StringAttribute{
				Required: true,
			},
		},
	}
}


// Update function to change tenant's properties
func (r *tenantResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
	var plan, state tenantModel

	if !state.CustomHostname.Equal(plan.CustomHostname) {
                // Update logic
                ........
		// Attempting to set the updated hostnames list
		plan.Hostnames = conv.StringsToStringList([]string{tenantHostname, plan.CustomHostname.ValueString() + ".example.com"}, true)
}

	// Logic to set the state with the updated plan
	resp.Diagnostics.Append(resp.State.Set(ctx, &plan)...)
	// ...
}

// ...

Here’s the expected behavior when using the provider to manage the tenant resource:

  1. Initially, custom_hostname is set to "initial.example.com", resulting in hostnames like ["provider-default-url.com", "initial.example.com"].
  2. The custom_hostname attribute is then updated in the Terraform configuration to "updated.example.com".
  3. I would expect the hostnames after running terraform apply to read ["provider-default-url.com", "updated.example.com"].

Given this scenario, I am reaching out to the community for insights. Is there a specific approach or a common pitfall in list attribute management in Terraform providers that I might be missing?