@@ -81,6 +81,35 @@ Please refer to the field 'effective_labels' for all of the labels present on th
81
81
Private services access must already be configured for the network. If left unspecified, the index endpoint is not peered with any network.
82
82
[Format](https://cloud.google.com/compute/docs/reference/rest/v1/networks/insert): 'projects/{project}/global/networks/{network}'.
83
83
Where '{project}' is a project number, as in '12345', and '{network}' is network name.` ,
84
+ ConflictsWith : []string {"private_service_connect_config" },
85
+ },
86
+ "private_service_connect_config" : {
87
+ Type : schema .TypeList ,
88
+ Computed : true ,
89
+ Optional : true ,
90
+ ForceNew : true ,
91
+ Description : `Optional. Configuration for private service connect. 'network' and 'privateServiceConnectConfig' are mutually exclusive.` ,
92
+ MaxItems : 1 ,
93
+ Elem : & schema.Resource {
94
+ Schema : map [string ]* schema.Schema {
95
+ "enable_private_service_connect" : {
96
+ Type : schema .TypeBool ,
97
+ Required : true ,
98
+ ForceNew : true ,
99
+ Description : `If set to true, the IndexEndpoint is created without private service access.` ,
100
+ },
101
+ "project_allowlist" : {
102
+ Type : schema .TypeList ,
103
+ Optional : true ,
104
+ ForceNew : true ,
105
+ Description : `A list of Projects from which the forwarding rule will target the service attachment.` ,
106
+ Elem : & schema.Schema {
107
+ Type : schema .TypeString ,
108
+ },
109
+ },
110
+ },
111
+ },
112
+ ConflictsWith : []string {"network" },
84
113
},
85
114
"public_endpoint_enabled" : {
86
115
Type : schema .TypeBool ,
@@ -169,6 +198,12 @@ func resourceVertexAIIndexEndpointCreate(d *schema.ResourceData, meta interface{
169
198
} else if v , ok := d .GetOkExists ("network" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (networkProp )) && (ok || ! reflect .DeepEqual (v , networkProp )) {
170
199
obj ["network" ] = networkProp
171
200
}
201
+ privateServiceConnectConfigProp , err := expandVertexAIIndexEndpointPrivateServiceConnectConfig (d .Get ("private_service_connect_config" ), d , config )
202
+ if err != nil {
203
+ return err
204
+ } else if v , ok := d .GetOkExists ("private_service_connect_config" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (privateServiceConnectConfigProp )) && (ok || ! reflect .DeepEqual (v , privateServiceConnectConfigProp )) {
205
+ obj ["privateServiceConnectConfig" ] = privateServiceConnectConfigProp
206
+ }
172
207
publicEndpointEnabledProp , err := expandVertexAIIndexEndpointPublicEndpointEnabled (d .Get ("public_endpoint_enabled" ), d , config )
173
208
if err != nil {
174
209
return err
@@ -311,6 +346,9 @@ func resourceVertexAIIndexEndpointRead(d *schema.ResourceData, meta interface{})
311
346
if err := d .Set ("network" , flattenVertexAIIndexEndpointNetwork (res ["network" ], d , config )); err != nil {
312
347
return fmt .Errorf ("Error reading IndexEndpoint: %s" , err )
313
348
}
349
+ if err := d .Set ("private_service_connect_config" , flattenVertexAIIndexEndpointPrivateServiceConnectConfig (res ["privateServiceConnectConfig" ], d , config )); err != nil {
350
+ return fmt .Errorf ("Error reading IndexEndpoint: %s" , err )
351
+ }
314
352
if err := d .Set ("public_endpoint_domain_name" , flattenVertexAIIndexEndpointPublicEndpointDomainName (res ["publicEndpointDomainName" ], d , config )); err != nil {
315
353
return fmt .Errorf ("Error reading IndexEndpoint: %s" , err )
316
354
}
@@ -529,6 +567,35 @@ func flattenVertexAIIndexEndpointNetwork(v interface{}, d *schema.ResourceData,
529
567
return v
530
568
}
531
569
570
+ func flattenVertexAIIndexEndpointPrivateServiceConnectConfig (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
571
+ transformed := make (map [string ]interface {})
572
+
573
+ if v == nil {
574
+ // Disabled by default, but API will not return object if value is false
575
+ transformed ["enable_private_service_connect" ] = false
576
+ return []interface {}{transformed }
577
+ }
578
+
579
+ original := v .(map [string ]interface {})
580
+ if len (original ) == 0 {
581
+ return nil
582
+ }
583
+
584
+ transformed ["enable_private_service_connect" ] =
585
+ flattenVertexAIIndexEndpointPrivateServiceConnectConfigEnablePrivateServiceConnect (original ["enablePrivateServiceConnect" ], d , config )
586
+ transformed ["project_allowlist" ] =
587
+ flattenVertexAIIndexEndpointPrivateServiceConnectConfigProjectAllowlist (original ["projectAllowlist" ], d , config )
588
+ return []interface {}{transformed }
589
+ }
590
+
591
+ func flattenVertexAIIndexEndpointPrivateServiceConnectConfigEnablePrivateServiceConnect (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
592
+ return v
593
+ }
594
+
595
+ func flattenVertexAIIndexEndpointPrivateServiceConnectConfigProjectAllowlist (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
596
+ return v
597
+ }
598
+
532
599
func flattenVertexAIIndexEndpointPublicEndpointDomainName (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
533
600
return v
534
601
}
@@ -564,6 +631,40 @@ func expandVertexAIIndexEndpointNetwork(v interface{}, d tpgresource.TerraformRe
564
631
return v , nil
565
632
}
566
633
634
+ func expandVertexAIIndexEndpointPrivateServiceConnectConfig (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
635
+ l := v .([]interface {})
636
+ if len (l ) == 0 || l [0 ] == nil {
637
+ return nil , nil
638
+ }
639
+ raw := l [0 ]
640
+ original := raw .(map [string ]interface {})
641
+ transformed := make (map [string ]interface {})
642
+
643
+ transformedEnablePrivateServiceConnect , err := expandVertexAIIndexEndpointPrivateServiceConnectConfigEnablePrivateServiceConnect (original ["enable_private_service_connect" ], d , config )
644
+ if err != nil {
645
+ return nil , err
646
+ } else if val := reflect .ValueOf (transformedEnablePrivateServiceConnect ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
647
+ transformed ["enablePrivateServiceConnect" ] = transformedEnablePrivateServiceConnect
648
+ }
649
+
650
+ transformedProjectAllowlist , err := expandVertexAIIndexEndpointPrivateServiceConnectConfigProjectAllowlist (original ["project_allowlist" ], d , config )
651
+ if err != nil {
652
+ return nil , err
653
+ } else if val := reflect .ValueOf (transformedProjectAllowlist ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
654
+ transformed ["projectAllowlist" ] = transformedProjectAllowlist
655
+ }
656
+
657
+ return transformed , nil
658
+ }
659
+
660
+ func expandVertexAIIndexEndpointPrivateServiceConnectConfigEnablePrivateServiceConnect (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
661
+ return v , nil
662
+ }
663
+
664
+ func expandVertexAIIndexEndpointPrivateServiceConnectConfigProjectAllowlist (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
665
+ return v , nil
666
+ }
667
+
567
668
func expandVertexAIIndexEndpointPublicEndpointEnabled (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
568
669
return v , nil
569
670
}
0 commit comments