Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion internal/elasticsearch/index/indices/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,20 @@ func setSettingsFromAPI(ctx context.Context, model *indexTfModel, apiModel model
}
tfValue = basetypes.NewStringValue(settingStr)
case types.Bool:
if settingStr, ok := settingsValue.(string); ok {
settingBool, err := strconv.ParseBool(settingStr)
if err != nil {
return diag.Diagnostics{
diag.NewErrorDiagnostic(
"failed to convert setting to bool",
fmt.Sprintf("expected setting to be a bool but it was a string. Attempted to parse it but got %s", err.Error()),
),
}
}

settingsValue = bool(settingBool)
}

settingBool, ok := settingsValue.(bool)
if !ok {
return diag.Diagnostics{
Expand All @@ -300,7 +314,7 @@ func setSettingsFromAPI(ctx context.Context, model *indexTfModel, apiModel model
return diag.Diagnostics{
diag.NewErrorDiagnostic(
"failed to convert setting to int",
fmt.Sprintf("expected setting to be an in but it was a string. Attempted to parse it but got %s", err.Error()),
fmt.Sprintf("expected setting to be an int but it was a string. Attempted to parse it but got %s", err.Error()),
),
}
}
Expand Down
Loading