fix: sqlserver return values mapping
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 6s
CI Workflow / CI (pull_request) Failing after 20m29s
CI Workflow / Code coverage report (pull_request) Has been skipped
CI Workflow / Test readiness for publishing provider (pull_request) Successful in 30m35s

This commit is contained in:
Marcel S. Henselin 2026-02-12 16:12:49 +01:00
parent 82c654f3ba
commit 198af95f43
4 changed files with 188 additions and 82 deletions

View file

@ -79,7 +79,10 @@ func mapResourceFields(source *sqlserverflexbeta.GetDatabaseResponse, model *res
model.ProjectId = types.StringValue(model.ProjectId.ValueString())
model.InstanceId = types.StringValue(model.InstanceId.ValueString())
model.Compatibility = types.Int64Value(source.GetCompatibilityLevel())
model.CompatibilityLevel = types.Int64Value(source.GetCompatibilityLevel())
model.Collation = types.StringValue(source.GetCollationName()) // it does not come back from api
model.CollationName = types.StringValue(source.GetCollationName())
return nil

View file

@ -174,13 +174,18 @@ func (r *databaseResource) Create(ctx context.Context, req resource.CreateReques
databaseName := data.Name.ValueString()
ctx = tflog.SetField(ctx, "database_name", databaseName)
payLoad := sqlserverflexbeta.CreateDatabaseRequestPayload{
Collation: data.Collation.ValueStringPointer(),
Compatibility: data.Compatibility.ValueInt64Pointer(),
Name: data.Name.ValueStringPointer(),
Owner: data.Owner.ValueStringPointer(),
payLoad := sqlserverflexbeta.CreateDatabaseRequestPayload{}
if !data.Collation.IsNull() && !data.Collation.IsUnknown() {
payLoad.Collation = data.Collation.ValueStringPointer()
}
if !data.Compatibility.IsNull() && !data.Compatibility.IsUnknown() {
payLoad.Compatibility = data.Compatibility.ValueInt64Pointer()
}
payLoad.Name = data.Name.ValueStringPointer()
payLoad.Owner = data.Owner.ValueStringPointer()
_, err := wait.WaitForUserWaitHandler(
ctx,
r.client,