@@ -209,11 +209,17 @@ func (r *databaseResource) Create(ctx context.Context, req resource.CreateReques
209209 })
210210 }
211211
212+ var port * int64
213+ if ! plan .Port .IsNull () {
214+ portValue := plan .Port .ValueInt64 ()
215+ port = & portValue
216+ }
217+
212218 input := devhub.Database {
213219 Name : plan .Name .ValueString (),
214220 Adapter : strings .ToLower (plan .Adapter .ValueString ()),
215221 Hostname : plan .Hostname .ValueString (),
216- Port : plan . Port . ValueInt64 () ,
222+ Port : port ,
217223 Database : plan .Database .ValueString (),
218224 Ssl : plan .Ssl .ValueBool (),
219225 Cacertfile : plan .Cacertfile .ValueString (),
@@ -293,8 +299,8 @@ func (r *databaseResource) Read(ctx context.Context, req resource.ReadRequest, r
293299 state .SlackChannel = types .StringNull ()
294300 state .AgentId = types .StringNull ()
295301
296- if database .Port != 0 {
297- state .Port = types .Int64Value (database .Port )
302+ if database .Port != nil {
303+ state .Port = types .Int64Value (* database .Port )
298304 }
299305
300306 if database .Group != "" {
@@ -361,11 +367,17 @@ func (r *databaseResource) Update(ctx context.Context, req resource.UpdateReques
361367 })
362368 }
363369
370+ var port * int64
371+ if ! plan .Port .IsNull () {
372+ portValue := plan .Port .ValueInt64 ()
373+ port = & portValue
374+ }
375+
364376 input := devhub.Database {
365377 Name : plan .Name .ValueString (),
366378 Adapter : strings .ToLower (plan .Adapter .ValueString ()),
367379 Hostname : plan .Hostname .ValueString (),
368- Port : plan . Port . ValueInt64 () ,
380+ Port : port ,
369381 Database : plan .Database .ValueString (),
370382 Ssl : plan .Ssl .ValueBool (),
371383 Cacertfile : plan .Cacertfile .ValueString (),
0 commit comments