@@ -448,6 +448,11 @@ func resourceComputeTargetHttpsProxyUpdate(d *schema.ResourceData, meta interfac
448
448
obj ["quicOverride" ] = quicOverrideProp
449
449
}
450
450
451
+ obj , err = resourceComputeTargetHttpsProxyUpdateEncoder (d , meta , obj )
452
+ if err != nil {
453
+ return err
454
+ }
455
+
451
456
url , err := tpgresource .ReplaceVars (d , config , "{{ComputeBasePath}}projects/{{project}}/global/targetHttpsProxies/{{name}}/setQuicOverride" )
452
457
if err != nil {
453
458
return err
@@ -496,6 +501,11 @@ func resourceComputeTargetHttpsProxyUpdate(d *schema.ResourceData, meta interfac
496
501
obj ["sslCertificates" ] = sslCertificatesProp
497
502
}
498
503
504
+ obj , err = resourceComputeTargetHttpsProxyUpdateEncoder (d , meta , obj )
505
+ if err != nil {
506
+ return err
507
+ }
508
+
499
509
url , err := tpgresource .ReplaceVars (d , config , "{{ComputeBasePath}}projects/{{project}}/targetHttpsProxies/{{name}}/setSslCertificates" )
500
510
if err != nil {
501
511
return err
@@ -538,6 +548,11 @@ func resourceComputeTargetHttpsProxyUpdate(d *schema.ResourceData, meta interfac
538
548
obj ["certificateMap" ] = certificateMapProp
539
549
}
540
550
551
+ obj , err = resourceComputeTargetHttpsProxyUpdateEncoder (d , meta , obj )
552
+ if err != nil {
553
+ return err
554
+ }
555
+
541
556
url , err := tpgresource .ReplaceVars (d , config , "{{ComputeBasePath}}projects/{{project}}/global/targetHttpsProxies/{{name}}/setCertificateMap" )
542
557
if err != nil {
543
558
return err
@@ -580,6 +595,11 @@ func resourceComputeTargetHttpsProxyUpdate(d *schema.ResourceData, meta interfac
580
595
obj ["sslPolicy" ] = sslPolicyProp
581
596
}
582
597
598
+ obj , err = resourceComputeTargetHttpsProxyUpdateEncoder (d , meta , obj )
599
+ if err != nil {
600
+ return err
601
+ }
602
+
583
603
url , err := tpgresource .ReplaceVars (d , config , "{{ComputeBasePath}}projects/{{project}}/global/targetHttpsProxies/{{name}}/setSslPolicy" )
584
604
if err != nil {
585
605
return err
@@ -622,6 +642,11 @@ func resourceComputeTargetHttpsProxyUpdate(d *schema.ResourceData, meta interfac
622
642
obj ["urlMap" ] = urlMapProp
623
643
}
624
644
645
+ obj , err = resourceComputeTargetHttpsProxyUpdateEncoder (d , meta , obj )
646
+ if err != nil {
647
+ return err
648
+ }
649
+
625
650
url , err := tpgresource .ReplaceVars (d , config , "{{ComputeBasePath}}projects/{{project}}/targetHttpsProxies/{{name}}/setUrlMap" )
626
651
if err != nil {
627
652
return err
@@ -925,6 +950,19 @@ func resourceComputeTargetHttpsProxyEncoder(d *schema.ResourceData, meta interfa
925
950
return obj , nil
926
951
}
927
952
953
+ func resourceComputeTargetHttpsProxyUpdateEncoder (d * schema.ResourceData , meta interface {}, obj map [string ]interface {}) (map [string ]interface {}, error ) {
954
+
955
+ if _ , ok := obj ["certificateManagerCertificates" ]; ok {
956
+ // The field certificateManagerCertificates should not be included in the API request, and it should be renamed to `sslCertificates`
957
+ // The API does not allow using both certificate manager certificates and sslCertificates. If that changes
958
+ // in the future, the encoder logic should change accordingly because this will mean that both fields are no longer mutual exclusive.
959
+ log .Printf ("[DEBUG] converting the field CertificateManagerCertificates to sslCertificates before sending the request" )
960
+ obj ["sslCertificates" ] = obj ["certificateManagerCertificates" ]
961
+ delete (obj , "certificateManagerCertificates" )
962
+ }
963
+ return obj , nil
964
+ }
965
+
928
966
func resourceComputeTargetHttpsProxyDecoder (d * schema.ResourceData , meta interface {}, res map [string ]interface {}) (map [string ]interface {}, error ) {
929
967
// Since both sslCertificates and certificateManagerCertificates maps to the same API field (sslCertificates), we need to check the types
930
968
// of certificates that exist in the array and decide whether to change the field to certificateManagerCertificate or not.
0 commit comments