@@ -93,6 +93,21 @@ 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 : networksecurityMirroringEndpointGroupAssociationsSchema (),
101
+ // Default schema.HashSchema is used.
102
+ },
103
+ "connected_deployment_groups" : {
104
+ Type : schema .TypeSet ,
105
+ Computed : true ,
106
+ Description : `List of details about the connected deployment groups to this endpoint
107
+ group.` ,
108
+ Elem : networksecurityMirroringEndpointGroupConnectedDeploymentGroupsSchema (),
109
+ // Default schema.HashSchema is used.
110
+ },
96
111
"create_time" : {
97
112
Type : schema .TypeString ,
98
113
Computed : true ,
@@ -158,6 +173,82 @@ See https://google.aip.dev/148#timestamps.`,
158
173
}
159
174
}
160
175
176
+ func networksecurityMirroringEndpointGroupAssociationsSchema () * schema.Resource {
177
+ return & schema.Resource {
178
+ Schema : map [string ]* schema.Schema {
179
+ "name" : {
180
+ Type : schema .TypeString ,
181
+ Computed : true ,
182
+ Description : `The connected association's resource name, for example:
183
+ 'projects/123456789/locations/global/mirroringEndpointGroupAssociations/my-ega'.
184
+ See https://google.aip.dev/124.` ,
185
+ },
186
+ "network" : {
187
+ Type : schema .TypeString ,
188
+ Computed : true ,
189
+ Description : `The associated network, for example:
190
+ projects/123456789/global/networks/my-network.
191
+ See https://google.aip.dev/124.` ,
192
+ },
193
+ "state" : {
194
+ Type : schema .TypeString ,
195
+ Computed : true ,
196
+ Description : `Most recent known state of the association.
197
+ Possible values:
198
+ STATE_UNSPECIFIED
199
+ ACTIVE
200
+ CREATING
201
+ DELETING
202
+ CLOSED
203
+ OUT_OF_SYNC
204
+ DELETE_FAILED` ,
205
+ },
206
+ },
207
+ }
208
+ }
209
+
210
+ func networksecurityMirroringEndpointGroupConnectedDeploymentGroupsSchema () * schema.Resource {
211
+ return & schema.Resource {
212
+ Schema : map [string ]* schema.Schema {
213
+ "locations" : {
214
+ Type : schema .TypeSet ,
215
+ Computed : true ,
216
+ Description : `The list of locations where the deployment group is present.` ,
217
+ Elem : networksecurityMirroringEndpointGroupConnectedDeploymentGroupsConnectedDeploymentGroupsLocationsSchema (),
218
+ // Default schema.HashSchema is used.
219
+ },
220
+ "name" : {
221
+ Type : schema .TypeString ,
222
+ Computed : true ,
223
+ Description : `The connected deployment group's resource name, for example:
224
+ 'projects/123456789/locations/global/mirroringDeploymentGroups/my-dg'.
225
+ See https://google.aip.dev/124.` ,
226
+ },
227
+ },
228
+ }
229
+ }
230
+
231
+ func networksecurityMirroringEndpointGroupConnectedDeploymentGroupsConnectedDeploymentGroupsLocationsSchema () * schema.Resource {
232
+ return & schema.Resource {
233
+ Schema : map [string ]* schema.Schema {
234
+ "location" : {
235
+ Type : schema .TypeString ,
236
+ Computed : true ,
237
+ Description : `The cloud location, e.g. 'us-central1-a' or 'asia-south1-b'.` ,
238
+ },
239
+ "state" : {
240
+ Type : schema .TypeString ,
241
+ Computed : true ,
242
+ Description : `The current state of the association in this location.
243
+ Possible values:
244
+ STATE_UNSPECIFIED
245
+ ACTIVE
246
+ OUT_OF_SYNC` ,
247
+ },
248
+ },
249
+ }
250
+ }
251
+
161
252
func resourceNetworkSecurityMirroringEndpointGroupCreate (d * schema.ResourceData , meta interface {}) error {
162
253
config := meta .(* transport_tpg.Config )
163
254
userAgent , err := tpgresource .GenerateUserAgentString (d , config .UserAgent )
@@ -321,6 +412,12 @@ func resourceNetworkSecurityMirroringEndpointGroupRead(d *schema.ResourceData, m
321
412
if err := d .Set ("description" , flattenNetworkSecurityMirroringEndpointGroupDescription (res ["description" ], d , config )); err != nil {
322
413
return fmt .Errorf ("Error reading MirroringEndpointGroup: %s" , err )
323
414
}
415
+ if err := d .Set ("associations" , flattenNetworkSecurityMirroringEndpointGroupAssociations (res ["associations" ], d , config )); err != nil {
416
+ return fmt .Errorf ("Error reading MirroringEndpointGroup: %s" , err )
417
+ }
418
+ if err := d .Set ("connected_deployment_groups" , flattenNetworkSecurityMirroringEndpointGroupConnectedDeploymentGroups (res ["connectedDeploymentGroups" ], d , config )); err != nil {
419
+ return fmt .Errorf ("Error reading MirroringEndpointGroup: %s" , err )
420
+ }
324
421
if err := d .Set ("terraform_labels" , flattenNetworkSecurityMirroringEndpointGroupTerraformLabels (res ["labels" ], d , config )); err != nil {
325
422
return fmt .Errorf ("Error reading MirroringEndpointGroup: %s" , err )
326
423
}
@@ -538,6 +635,88 @@ func flattenNetworkSecurityMirroringEndpointGroupDescription(v interface{}, d *s
538
635
return v
539
636
}
540
637
638
+ func flattenNetworkSecurityMirroringEndpointGroupAssociations (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
639
+ if v == nil {
640
+ return v
641
+ }
642
+ l := v .([]interface {})
643
+ transformed := schema .NewSet (schema .HashResource (networksecurityMirroringEndpointGroupAssociationsSchema ()), []interface {}{})
644
+ for _ , raw := range l {
645
+ original := raw .(map [string ]interface {})
646
+ if len (original ) < 1 {
647
+ // Do not include empty json objects coming back from the api
648
+ continue
649
+ }
650
+ transformed .Add (map [string ]interface {}{
651
+ "name" : flattenNetworkSecurityMirroringEndpointGroupAssociationsName (original ["name" ], d , config ),
652
+ "network" : flattenNetworkSecurityMirroringEndpointGroupAssociationsNetwork (original ["network" ], d , config ),
653
+ "state" : flattenNetworkSecurityMirroringEndpointGroupAssociationsState (original ["state" ], d , config ),
654
+ })
655
+ }
656
+ return transformed
657
+ }
658
+ func flattenNetworkSecurityMirroringEndpointGroupAssociationsName (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
659
+ return v
660
+ }
661
+
662
+ func flattenNetworkSecurityMirroringEndpointGroupAssociationsNetwork (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
663
+ return v
664
+ }
665
+
666
+ func flattenNetworkSecurityMirroringEndpointGroupAssociationsState (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
667
+ return v
668
+ }
669
+
670
+ func flattenNetworkSecurityMirroringEndpointGroupConnectedDeploymentGroups (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
671
+ if v == nil {
672
+ return v
673
+ }
674
+ l := v .([]interface {})
675
+ transformed := schema .NewSet (schema .HashResource (networksecurityMirroringEndpointGroupConnectedDeploymentGroupsSchema ()), []interface {}{})
676
+ for _ , raw := range l {
677
+ original := raw .(map [string ]interface {})
678
+ if len (original ) < 1 {
679
+ // Do not include empty json objects coming back from the api
680
+ continue
681
+ }
682
+ transformed .Add (map [string ]interface {}{
683
+ "name" : flattenNetworkSecurityMirroringEndpointGroupConnectedDeploymentGroupsName (original ["name" ], d , config ),
684
+ "locations" : flattenNetworkSecurityMirroringEndpointGroupConnectedDeploymentGroupsLocations (original ["locations" ], d , config ),
685
+ })
686
+ }
687
+ return transformed
688
+ }
689
+ func flattenNetworkSecurityMirroringEndpointGroupConnectedDeploymentGroupsName (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
690
+ return v
691
+ }
692
+
693
+ func flattenNetworkSecurityMirroringEndpointGroupConnectedDeploymentGroupsLocations (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
694
+ if v == nil {
695
+ return v
696
+ }
697
+ l := v .([]interface {})
698
+ transformed := schema .NewSet (schema .HashResource (networksecurityMirroringEndpointGroupConnectedDeploymentGroupsConnectedDeploymentGroupsLocationsSchema ()), []interface {}{})
699
+ for _ , raw := range l {
700
+ original := raw .(map [string ]interface {})
701
+ if len (original ) < 1 {
702
+ // Do not include empty json objects coming back from the api
703
+ continue
704
+ }
705
+ transformed .Add (map [string ]interface {}{
706
+ "location" : flattenNetworkSecurityMirroringEndpointGroupConnectedDeploymentGroupsLocationsLocation (original ["location" ], d , config ),
707
+ "state" : flattenNetworkSecurityMirroringEndpointGroupConnectedDeploymentGroupsLocationsState (original ["state" ], d , config ),
708
+ })
709
+ }
710
+ return transformed
711
+ }
712
+ func flattenNetworkSecurityMirroringEndpointGroupConnectedDeploymentGroupsLocationsLocation (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
713
+ return v
714
+ }
715
+
716
+ func flattenNetworkSecurityMirroringEndpointGroupConnectedDeploymentGroupsLocationsState (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
717
+ return v
718
+ }
719
+
541
720
func flattenNetworkSecurityMirroringEndpointGroupTerraformLabels (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
542
721
if v == nil {
543
722
return v
0 commit comments