@@ -307,7 +307,7 @@ func (r *acmeCertificateResource) Create(
307307 }
308308
309309 // Update the state with certificate information
310- if err := r .updateModelFromCertificates (& plan , certificates ); err != nil {
310+ if err := r .updateModelFromCertificates (ctx , & plan , certificates ); err != nil {
311311 resp .Diagnostics .AddError (
312312 "Unable to process certificate information" ,
313313 fmt .Sprintf ("An error occurred while processing certificate information: %s" , err .Error ()),
@@ -350,7 +350,7 @@ func (r *acmeCertificateResource) Read(
350350 }
351351
352352 // Update the state with certificate information
353- if err := r .updateModelFromCertificates (& state , certificates ); err != nil {
353+ if err := r .updateModelFromCertificates (ctx , & state , certificates ); err != nil {
354354 resp .Diagnostics .AddError (
355355 "Unable to process certificate information" ,
356356 fmt .Sprintf ("An error occurred while processing certificate information: %s" , err .Error ()),
@@ -407,7 +407,6 @@ func (r *acmeCertificateResource) Update(
407407
408408 return
409409 }
410- }
411410
412411 // Wait for the task to complete
413412 if taskID != nil && * taskID != "" {
@@ -434,7 +433,7 @@ func (r *acmeCertificateResource) Update(
434433 }
435434
436435 // Update the state with certificate information
437- if err := r .updateModelFromCertificates (& plan , certificates ); err != nil {
436+ if err := r .updateModelFromCertificates (ctx , & plan , certificates ); err != nil {
438437 resp .Diagnostics .AddError (
439438 "Unable to process certificate information" ,
440439 fmt .Sprintf ("An error occurred while processing certificate information: %s" , err .Error ()),
@@ -670,6 +669,7 @@ func isProxmoxGeneratedCertificate(cert *nodes.CertificateListResponseData) bool
670669// over Proxmox-generated certificates. When multiple certificates match the configured domains,
671670// it returns the one with the most matching domains.
672671func (r * acmeCertificateResource ) findMatchingCertificate (
672+ ctx context.Context ,
673673 model * acmeCertificateModel ,
674674 certificates * []nodes.CertificateListResponseData ,
675675) (* nodes.CertificateListResponseData , error ) {
@@ -679,7 +679,7 @@ func (r *acmeCertificateResource) findMatchingCertificate(
679679
680680 // Extract domains from the model
681681 var configDomains []string
682- diag := model .Domains .ElementsAs (context . Background () , & configDomains , false )
682+ diag := model .Domains .ElementsAs (ctx , & configDomains , false )
683683 if diag .HasError () {
684684 // If we can't parse domains, try to find an ACME certificate (not Proxmox-generated)
685685 for i := range * certificates {
@@ -769,6 +769,7 @@ func (r *acmeCertificateResource) findMatchingCertificate(
769769
770770// updateModelFromCertificates updates the model with certificate information.
771771func (r * acmeCertificateResource ) updateModelFromCertificates (
772+ ctx context.Context ,
772773 model * acmeCertificateModel ,
773774 certificates * []nodes.CertificateListResponseData ,
774775) error {
@@ -777,7 +778,7 @@ func (r *acmeCertificateResource) updateModelFromCertificates(
777778 }
778779
779780 // Find the certificate that matches the configured domains
780- cert , err := r .findMatchingCertificate (model , certificates )
781+ cert , err := r .findMatchingCertificate (ctx , model , certificates )
781782 if err != nil {
782783 return err
783784 }
0 commit comments