@@ -197,6 +197,26 @@ If true, update will affect both PENDING and ACCEPTED/REJECTED PSC endpoints. Fo
197197 DiffSuppressFunc : tpgresource .CompareSelfLinkOrResourceName ,
198198 Description : `URL of the region where the resource resides.` ,
199199 },
200+ "tunneling_config" : {
201+ Type : schema .TypeList ,
202+ Optional : true ,
203+ Description : `Tunneling configuration for this service attachment.` ,
204+ MaxItems : 1 ,
205+ Elem : & schema.Resource {
206+ Schema : map [string ]* schema.Schema {
207+ "encapsulation_profile" : {
208+ Type : schema .TypeString ,
209+ Optional : true ,
210+ Description : `The encapsulation profile for tunneling traffic.` ,
211+ },
212+ "routing_mode" : {
213+ Type : schema .TypeString ,
214+ Optional : true ,
215+ Description : `The routing mode for tunneling traffic.` ,
216+ },
217+ },
218+ },
219+ },
200220 "connected_endpoints" : {
201221 Type : schema .TypeList ,
202222 Computed : true ,
@@ -239,6 +259,25 @@ this service attachment.`,
239259 Description : `Fingerprint of this resource. This field is used internally during
240260updates of this resource.` ,
241261 },
262+ "psc_service_attachment_id" : {
263+ Type : schema .TypeList ,
264+ Computed : true ,
265+ Description : `An 128-bit global unique ID of the PSC service attachment.` ,
266+ Elem : & schema.Resource {
267+ Schema : map [string ]* schema.Schema {
268+ "high" : {
269+ Type : schema .TypeString ,
270+ Computed : true ,
271+ Description : `The high 64 bits of the PSC service attachment ID.` ,
272+ },
273+ "low" : {
274+ Type : schema .TypeString ,
275+ Computed : true ,
276+ Description : `The low 64 bits of the PSC service attachment ID.` ,
277+ },
278+ },
279+ },
280+ },
242281 "send_propagated_connection_limit_if_zero" : {
243282 Type : schema .TypeBool ,
244283 Optional : true ,
@@ -345,6 +384,12 @@ func resourceComputeServiceAttachmentCreate(d *schema.ResourceData, meta interfa
345384 } else if v , ok := d .GetOkExists ("domain_names" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (domainNamesProp )) && (ok || ! reflect .DeepEqual (v , domainNamesProp )) {
346385 obj ["domainNames" ] = domainNamesProp
347386 }
387+ tunnelingConfigProp , err := expandComputeServiceAttachmentTunnelingConfig (d .Get ("tunneling_config" ), d , config )
388+ if err != nil {
389+ return err
390+ } else if v , ok := d .GetOkExists ("tunneling_config" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (tunnelingConfigProp )) && (ok || ! reflect .DeepEqual (v , tunnelingConfigProp )) {
391+ obj ["tunnelingConfig" ] = tunnelingConfigProp
392+ }
348393 consumerRejectListsProp , err := expandComputeServiceAttachmentConsumerRejectLists (d .Get ("consumer_reject_lists" ), d , config )
349394 if err != nil {
350395 return err
@@ -502,6 +547,9 @@ func resourceComputeServiceAttachmentRead(d *schema.ResourceData, meta interface
502547 if err := d .Set ("fingerprint" , flattenComputeServiceAttachmentFingerprint (res ["fingerprint" ], d , config )); err != nil {
503548 return fmt .Errorf ("Error reading ServiceAttachment: %s" , err )
504549 }
550+ if err := d .Set ("psc_service_attachment_id" , flattenComputeServiceAttachmentPscServiceAttachmentId (res ["pscServiceAttachmentId" ], d , config )); err != nil {
551+ return fmt .Errorf ("Error reading ServiceAttachment: %s" , err )
552+ }
505553 if err := d .Set ("connection_preference" , flattenComputeServiceAttachmentConnectionPreference (res ["connectionPreference" ], d , config )); err != nil {
506554 return fmt .Errorf ("Error reading ServiceAttachment: %s" , err )
507555 }
@@ -585,6 +633,12 @@ func resourceComputeServiceAttachmentUpdate(d *schema.ResourceData, meta interfa
585633 } else if v , ok := d .GetOkExists ("enable_proxy_protocol" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (v )) && (ok || ! reflect .DeepEqual (v , enableProxyProtocolProp )) {
586634 obj ["enableProxyProtocol" ] = enableProxyProtocolProp
587635 }
636+ tunnelingConfigProp , err := expandComputeServiceAttachmentTunnelingConfig (d .Get ("tunneling_config" ), d , config )
637+ if err != nil {
638+ return err
639+ } else if v , ok := d .GetOkExists ("tunneling_config" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (v )) && (ok || ! reflect .DeepEqual (v , tunnelingConfigProp )) {
640+ obj ["tunnelingConfig" ] = tunnelingConfigProp
641+ }
588642 consumerRejectListsProp , err := expandComputeServiceAttachmentConsumerRejectLists (d .Get ("consumer_reject_lists" ), d , config )
589643 if err != nil {
590644 return err
@@ -750,6 +804,29 @@ func flattenComputeServiceAttachmentFingerprint(v interface{}, d *schema.Resourc
750804 return v
751805}
752806
807+ func flattenComputeServiceAttachmentPscServiceAttachmentId (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
808+ if v == nil {
809+ return nil
810+ }
811+ original := v .(map [string ]interface {})
812+ if len (original ) == 0 {
813+ return nil
814+ }
815+ transformed := make (map [string ]interface {})
816+ transformed ["high" ] =
817+ flattenComputeServiceAttachmentPscServiceAttachmentIdHigh (original ["high" ], d , config )
818+ transformed ["low" ] =
819+ flattenComputeServiceAttachmentPscServiceAttachmentIdLow (original ["low" ], d , config )
820+ return []interface {}{transformed }
821+ }
822+ func flattenComputeServiceAttachmentPscServiceAttachmentIdHigh (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
823+ return v
824+ }
825+
826+ func flattenComputeServiceAttachmentPscServiceAttachmentIdLow (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
827+ return v
828+ }
829+
753830func flattenComputeServiceAttachmentConnectionPreference (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
754831 return v
755832}
@@ -947,6 +1024,40 @@ func expandComputeServiceAttachmentDomainNames(v interface{}, d tpgresource.Terr
9471024 return v , nil
9481025}
9491026
1027+ func expandComputeServiceAttachmentTunnelingConfig (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1028+ l := v .([]interface {})
1029+ if len (l ) == 0 || l [0 ] == nil {
1030+ return nil , nil
1031+ }
1032+ raw := l [0 ]
1033+ original := raw .(map [string ]interface {})
1034+ transformed := make (map [string ]interface {})
1035+
1036+ transformedRoutingMode , err := expandComputeServiceAttachmentTunnelingConfigRoutingMode (original ["routing_mode" ], d , config )
1037+ if err != nil {
1038+ return nil , err
1039+ } else if val := reflect .ValueOf (transformedRoutingMode ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
1040+ transformed ["routingMode" ] = transformedRoutingMode
1041+ }
1042+
1043+ transformedEncapsulationProfile , err := expandComputeServiceAttachmentTunnelingConfigEncapsulationProfile (original ["encapsulation_profile" ], d , config )
1044+ if err != nil {
1045+ return nil , err
1046+ } else if val := reflect .ValueOf (transformedEncapsulationProfile ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
1047+ transformed ["encapsulationProfile" ] = transformedEncapsulationProfile
1048+ }
1049+
1050+ return transformed , nil
1051+ }
1052+
1053+ func expandComputeServiceAttachmentTunnelingConfigRoutingMode (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1054+ return v , nil
1055+ }
1056+
1057+ func expandComputeServiceAttachmentTunnelingConfigEncapsulationProfile (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1058+ return v , nil
1059+ }
1060+
9501061func expandComputeServiceAttachmentConsumerRejectLists (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
9511062 return v , nil
9521063}
0 commit comments