@@ -409,6 +409,12 @@ func (d *instanceDataSource) Read(ctx context.Context, req datasource.ReadReques
409409 return
410410 }
411411
412+ metricsRetentionResp , err := d .client .GetMetricsStorageRetention (ctx , instanceId , projectId ).Execute ()
413+ if err != nil {
414+ core .LogAndAddError (ctx , & resp .Diagnostics , "Error reading instance" , fmt .Sprintf ("Calling API to get metrics retention: %v" , err ))
415+ return
416+ }
417+
412418 alertConfigResp , err := d .client .GetAlertConfigs (ctx , instanceId , projectId ).Execute ()
413419 if err != nil {
414420 core .LogAndAddError (ctx , & resp .Diagnostics , "Error reading instance" , fmt .Sprintf ("Calling API to get alert config: %v" , err ))
@@ -421,18 +427,49 @@ func (d *instanceDataSource) Read(ctx context.Context, req datasource.ReadReques
421427 core .LogAndAddError (ctx , & resp .Diagnostics , "Error reading instance" , fmt .Sprintf ("Processing API payload: %v" , err ))
422428 return
423429 }
430+
431+ // Set state to instance populated data
432+ diags = resp .State .Set (ctx , model )
433+ resp .Diagnostics .Append (diags ... )
434+ if resp .Diagnostics .HasError () {
435+ return
436+ }
437+
424438 err = mapACLField (aclListResp , & model )
425439 if err != nil {
426440 core .LogAndAddError (ctx , & resp .Diagnostics , "Error reading instance" , fmt .Sprintf ("Processing API response for the ACL: %v" , err ))
427441 return
428442 }
443+
444+ // Set state to fully populated data
445+ diags = setACL (ctx , & resp .State , & model )
446+ resp .Diagnostics .Append (diags ... )
447+ if resp .Diagnostics .HasError () {
448+ return
449+ }
450+
451+ // Map response body to schema
452+ err = mapMetricsRetentionField (metricsRetentionResp , & model )
453+ if err != nil {
454+ core .LogAndAddError (ctx , & resp .Diagnostics , "Error reading instance" , fmt .Sprintf ("Processing API response for the metrics retention: %v" , err ))
455+ return
456+ }
457+
458+ // Set state to fully populated data
459+ diags = setMetricsRetentions (ctx , & resp .State , & model )
460+ resp .Diagnostics .Append (diags ... )
461+ if resp .Diagnostics .HasError () {
462+ return
463+ }
464+
429465 err = mapAlertConfigField (ctx , alertConfigResp , & model )
430466 if err != nil {
431467 core .LogAndAddError (ctx , & resp .Diagnostics , "Error creating instance" , fmt .Sprintf ("Processing API response for the alert config: %v" , err ))
432468 return
433469 }
434470
435- diags = resp .State .Set (ctx , model )
471+ // Set state to fully populated data
472+ diags = setAlertConfig (ctx , & resp .State , & model )
436473 resp .Diagnostics .Append (diags ... )
437474 if resp .Diagnostics .HasError () {
438475 return
0 commit comments