@@ -121,6 +121,13 @@ See https://google.aip.dev/148#timestamps.`,
121
121
Description : `All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services.` ,
122
122
Elem : & schema.Schema {Type : schema .TypeString },
123
123
},
124
+ "locations" : {
125
+ Type : schema .TypeSet ,
126
+ Computed : true ,
127
+ Description : `The list of locations where the deployment group is present.` ,
128
+ Elem : networksecurityMirroringDeploymentGroupLocationsSchema (),
129
+ // Default schema.HashSchema is used.
130
+ },
124
131
"name" : {
125
132
Type : schema .TypeString ,
126
133
Computed : true ,
@@ -171,6 +178,27 @@ See https://google.aip.dev/148#timestamps.`,
171
178
}
172
179
}
173
180
181
+ func networksecurityMirroringDeploymentGroupLocationsSchema () * schema.Resource {
182
+ return & schema.Resource {
183
+ Schema : map [string ]* schema.Schema {
184
+ "location" : {
185
+ Type : schema .TypeString ,
186
+ Computed : true ,
187
+ Description : `The cloud location, e.g. 'us-central1-a' or 'asia-south1-b'.` ,
188
+ },
189
+ "state" : {
190
+ Type : schema .TypeString ,
191
+ Computed : true ,
192
+ Description : `The current state of the association in this location.
193
+ Possible values:
194
+ STATE_UNSPECIFIED
195
+ ACTIVE
196
+ OUT_OF_SYNC` ,
197
+ },
198
+ },
199
+ }
200
+ }
201
+
174
202
func resourceNetworkSecurityMirroringDeploymentGroupCreate (d * schema.ResourceData , meta interface {}) error {
175
203
config := meta .(* transport_tpg.Config )
176
204
userAgent , err := tpgresource .GenerateUserAgentString (d , config .UserAgent )
@@ -337,6 +365,9 @@ func resourceNetworkSecurityMirroringDeploymentGroupRead(d *schema.ResourceData,
337
365
if err := d .Set ("description" , flattenNetworkSecurityMirroringDeploymentGroupDescription (res ["description" ], d , config )); err != nil {
338
366
return fmt .Errorf ("Error reading MirroringDeploymentGroup: %s" , err )
339
367
}
368
+ if err := d .Set ("locations" , flattenNetworkSecurityMirroringDeploymentGroupLocations (res ["locations" ], d , config )); err != nil {
369
+ return fmt .Errorf ("Error reading MirroringDeploymentGroup: %s" , err )
370
+ }
340
371
if err := d .Set ("terraform_labels" , flattenNetworkSecurityMirroringDeploymentGroupTerraformLabels (res ["labels" ], d , config )); err != nil {
341
372
return fmt .Errorf ("Error reading MirroringDeploymentGroup: %s" , err )
342
373
}
@@ -576,6 +607,33 @@ func flattenNetworkSecurityMirroringDeploymentGroupDescription(v interface{}, d
576
607
return v
577
608
}
578
609
610
+ func flattenNetworkSecurityMirroringDeploymentGroupLocations (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
611
+ if v == nil {
612
+ return v
613
+ }
614
+ l := v .([]interface {})
615
+ transformed := schema .NewSet (schema .HashResource (networksecurityMirroringDeploymentGroupLocationsSchema ()), []interface {}{})
616
+ for _ , raw := range l {
617
+ original := raw .(map [string ]interface {})
618
+ if len (original ) < 1 {
619
+ // Do not include empty json objects coming back from the api
620
+ continue
621
+ }
622
+ transformed .Add (map [string ]interface {}{
623
+ "location" : flattenNetworkSecurityMirroringDeploymentGroupLocationsLocation (original ["location" ], d , config ),
624
+ "state" : flattenNetworkSecurityMirroringDeploymentGroupLocationsState (original ["state" ], d , config ),
625
+ })
626
+ }
627
+ return transformed
628
+ }
629
+ func flattenNetworkSecurityMirroringDeploymentGroupLocationsLocation (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
630
+ return v
631
+ }
632
+
633
+ func flattenNetworkSecurityMirroringDeploymentGroupLocationsState (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
634
+ return v
635
+ }
636
+
579
637
func flattenNetworkSecurityMirroringDeploymentGroupTerraformLabels (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
580
638
if v == nil {
581
639
return v
0 commit comments