@@ -93,6 +93,36 @@ Used as additional context for the endpoint group.`,
93
93
Please refer to the field 'effective_labels' for all of the labels present on the resource.` ,
94
94
Elem : & schema.Schema {Type : schema .TypeString },
95
95
},
96
+ "associations" : {
97
+ Type : schema .TypeSet ,
98
+ Computed : true ,
99
+ Description : `List of associations to this endpoint group.` ,
100
+ Elem : networksecurityInterceptEndpointGroupAssociationsSchema (),
101
+ // Default schema.HashSchema is used.
102
+ },
103
+ "connected_deployment_group" : {
104
+ Type : schema .TypeList ,
105
+ Computed : true ,
106
+ Description : `The endpoint group's view of a connected deployment group.` ,
107
+ Elem : & schema.Resource {
108
+ Schema : map [string ]* schema.Schema {
109
+ "locations" : {
110
+ Type : schema .TypeSet ,
111
+ Computed : true ,
112
+ Description : `The list of locations where the deployment group is present.` ,
113
+ Elem : networksecurityInterceptEndpointGroupConnectedDeploymentGroupLocationsSchema (),
114
+ // Default schema.HashSchema is used.
115
+ },
116
+ "name" : {
117
+ Type : schema .TypeString ,
118
+ Computed : true ,
119
+ Description : `The connected deployment group's resource name, for example:
120
+ 'projects/123456789/locations/global/interceptDeploymentGroups/my-dg'.
121
+ See https://google.aip.dev/124.` ,
122
+ },
123
+ },
124
+ },
125
+ },
96
126
"create_time" : {
97
127
Type : schema .TypeString ,
98
128
Computed : true ,
@@ -158,6 +188,61 @@ See https://google.aip.dev/148#timestamps.`,
158
188
}
159
189
}
160
190
191
+ func networksecurityInterceptEndpointGroupAssociationsSchema () * schema.Resource {
192
+ return & schema.Resource {
193
+ Schema : map [string ]* schema.Schema {
194
+ "name" : {
195
+ Type : schema .TypeString ,
196
+ Computed : true ,
197
+ Description : `The connected association's resource name, for example:
198
+ 'projects/123456789/locations/global/interceptEndpointGroupAssociations/my-ega'.
199
+ See https://google.aip.dev/124.` ,
200
+ },
201
+ "network" : {
202
+ Type : schema .TypeString ,
203
+ Computed : true ,
204
+ Description : `The associated network, for example:
205
+ projects/123456789/global/networks/my-network.
206
+ See https://google.aip.dev/124.` ,
207
+ },
208
+ "state" : {
209
+ Type : schema .TypeString ,
210
+ Computed : true ,
211
+ Description : `Most recent known state of the association.
212
+ Possible values:
213
+ STATE_UNSPECIFIED
214
+ ACTIVE
215
+ CREATING
216
+ DELETING
217
+ CLOSED
218
+ OUT_OF_SYNC
219
+ DELETE_FAILED` ,
220
+ },
221
+ },
222
+ }
223
+ }
224
+
225
+ func networksecurityInterceptEndpointGroupConnectedDeploymentGroupLocationsSchema () * schema.Resource {
226
+ return & schema.Resource {
227
+ Schema : map [string ]* schema.Schema {
228
+ "location" : {
229
+ Type : schema .TypeString ,
230
+ Computed : true ,
231
+ Description : `The cloud location, e.g. 'us-central1-a' or 'asia-south1-b'.` ,
232
+ },
233
+ "state" : {
234
+ Type : schema .TypeString ,
235
+ Computed : true ,
236
+ Description : `The current state of the association in this location.
237
+ Possible values:
238
+ STATE_UNSPECIFIED
239
+ ACTIVE
240
+ OUT_OF_SYNC` ,
241
+ },
242
+ },
243
+ }
244
+ }
245
+
161
246
func resourceNetworkSecurityInterceptEndpointGroupCreate (d * schema.ResourceData , meta interface {}) error {
162
247
config := meta .(* transport_tpg.Config )
163
248
userAgent , err := tpgresource .GenerateUserAgentString (d , config .UserAgent )
@@ -321,6 +406,12 @@ func resourceNetworkSecurityInterceptEndpointGroupRead(d *schema.ResourceData, m
321
406
if err := d .Set ("description" , flattenNetworkSecurityInterceptEndpointGroupDescription (res ["description" ], d , config )); err != nil {
322
407
return fmt .Errorf ("Error reading InterceptEndpointGroup: %s" , err )
323
408
}
409
+ if err := d .Set ("associations" , flattenNetworkSecurityInterceptEndpointGroupAssociations (res ["associations" ], d , config )); err != nil {
410
+ return fmt .Errorf ("Error reading InterceptEndpointGroup: %s" , err )
411
+ }
412
+ if err := d .Set ("connected_deployment_group" , flattenNetworkSecurityInterceptEndpointGroupConnectedDeploymentGroup (res ["connectedDeploymentGroup" ], d , config )); err != nil {
413
+ return fmt .Errorf ("Error reading InterceptEndpointGroup: %s" , err )
414
+ }
324
415
if err := d .Set ("terraform_labels" , flattenNetworkSecurityInterceptEndpointGroupTerraformLabels (res ["labels" ], d , config )); err != nil {
325
416
return fmt .Errorf ("Error reading InterceptEndpointGroup: %s" , err )
326
417
}
@@ -538,6 +629,84 @@ func flattenNetworkSecurityInterceptEndpointGroupDescription(v interface{}, d *s
538
629
return v
539
630
}
540
631
632
+ func flattenNetworkSecurityInterceptEndpointGroupAssociations (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
633
+ if v == nil {
634
+ return v
635
+ }
636
+ l := v .([]interface {})
637
+ transformed := schema .NewSet (schema .HashResource (networksecurityInterceptEndpointGroupAssociationsSchema ()), []interface {}{})
638
+ for _ , raw := range l {
639
+ original := raw .(map [string ]interface {})
640
+ if len (original ) < 1 {
641
+ // Do not include empty json objects coming back from the api
642
+ continue
643
+ }
644
+ transformed .Add (map [string ]interface {}{
645
+ "name" : flattenNetworkSecurityInterceptEndpointGroupAssociationsName (original ["name" ], d , config ),
646
+ "network" : flattenNetworkSecurityInterceptEndpointGroupAssociationsNetwork (original ["network" ], d , config ),
647
+ "state" : flattenNetworkSecurityInterceptEndpointGroupAssociationsState (original ["state" ], d , config ),
648
+ })
649
+ }
650
+ return transformed
651
+ }
652
+ func flattenNetworkSecurityInterceptEndpointGroupAssociationsName (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
653
+ return v
654
+ }
655
+
656
+ func flattenNetworkSecurityInterceptEndpointGroupAssociationsNetwork (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
657
+ return v
658
+ }
659
+
660
+ func flattenNetworkSecurityInterceptEndpointGroupAssociationsState (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
661
+ return v
662
+ }
663
+
664
+ func flattenNetworkSecurityInterceptEndpointGroupConnectedDeploymentGroup (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
665
+ if v == nil {
666
+ return nil
667
+ }
668
+ original := v .(map [string ]interface {})
669
+ if len (original ) == 0 {
670
+ return nil
671
+ }
672
+ transformed := make (map [string ]interface {})
673
+ transformed ["name" ] =
674
+ flattenNetworkSecurityInterceptEndpointGroupConnectedDeploymentGroupName (original ["name" ], d , config )
675
+ transformed ["locations" ] =
676
+ flattenNetworkSecurityInterceptEndpointGroupConnectedDeploymentGroupLocations (original ["locations" ], d , config )
677
+ return []interface {}{transformed }
678
+ }
679
+ func flattenNetworkSecurityInterceptEndpointGroupConnectedDeploymentGroupName (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
680
+ return v
681
+ }
682
+
683
+ func flattenNetworkSecurityInterceptEndpointGroupConnectedDeploymentGroupLocations (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
684
+ if v == nil {
685
+ return v
686
+ }
687
+ l := v .([]interface {})
688
+ transformed := schema .NewSet (schema .HashResource (networksecurityInterceptEndpointGroupConnectedDeploymentGroupLocationsSchema ()), []interface {}{})
689
+ for _ , raw := range l {
690
+ original := raw .(map [string ]interface {})
691
+ if len (original ) < 1 {
692
+ // Do not include empty json objects coming back from the api
693
+ continue
694
+ }
695
+ transformed .Add (map [string ]interface {}{
696
+ "location" : flattenNetworkSecurityInterceptEndpointGroupConnectedDeploymentGroupLocationsLocation (original ["location" ], d , config ),
697
+ "state" : flattenNetworkSecurityInterceptEndpointGroupConnectedDeploymentGroupLocationsState (original ["state" ], d , config ),
698
+ })
699
+ }
700
+ return transformed
701
+ }
702
+ func flattenNetworkSecurityInterceptEndpointGroupConnectedDeploymentGroupLocationsLocation (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
703
+ return v
704
+ }
705
+
706
+ func flattenNetworkSecurityInterceptEndpointGroupConnectedDeploymentGroupLocationsState (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
707
+ return v
708
+ }
709
+
541
710
func flattenNetworkSecurityInterceptEndpointGroupTerraformLabels (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
542
711
if v == nil {
543
712
return v
0 commit comments