Skip to content

Commit 1bb26f4

Browse files
Add connectedDeploymentGroups and associations fields to mirroring endpoint group. (#13372) (#9606)
[upstream:37ee09c192f26f68c199a1a48b9f05408be3b7ac] Signed-off-by: Modular Magician <[email protected]>
1 parent d635f4b commit 1bb26f4

4 files changed

+251
-0
lines changed

Diff for: .changelog/13372.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
networksecurity: added `connectedDeploymentGroups` and `associations` fields to `google_network_security_mirroring_endpoint_group` resource
3+
```

Diff for: google-beta/services/networksecurity/resource_network_security_mirroring_endpoint_group.go

+179
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,21 @@ Used as additional context for the endpoint group.`,
9393
Please refer to the field 'effective_labels' for all of the labels present on the resource.`,
9494
Elem: &schema.Schema{Type: schema.TypeString},
9595
},
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+
},
96111
"create_time": {
97112
Type: schema.TypeString,
98113
Computed: true,
@@ -158,6 +173,82 @@ See https://google.aip.dev/148#timestamps.`,
158173
}
159174
}
160175

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+
161252
func resourceNetworkSecurityMirroringEndpointGroupCreate(d *schema.ResourceData, meta interface{}) error {
162253
config := meta.(*transport_tpg.Config)
163254
userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent)
@@ -321,6 +412,12 @@ func resourceNetworkSecurityMirroringEndpointGroupRead(d *schema.ResourceData, m
321412
if err := d.Set("description", flattenNetworkSecurityMirroringEndpointGroupDescription(res["description"], d, config)); err != nil {
322413
return fmt.Errorf("Error reading MirroringEndpointGroup: %s", err)
323414
}
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+
}
324421
if err := d.Set("terraform_labels", flattenNetworkSecurityMirroringEndpointGroupTerraformLabels(res["labels"], d, config)); err != nil {
325422
return fmt.Errorf("Error reading MirroringEndpointGroup: %s", err)
326423
}
@@ -538,6 +635,88 @@ func flattenNetworkSecurityMirroringEndpointGroupDescription(v interface{}, d *s
538635
return v
539636
}
540637

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+
541720
func flattenNetworkSecurityMirroringEndpointGroupTerraformLabels(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
542721
if v == nil {
543722
return v

Diff for: google-beta/services/networksecurity/resource_network_security_mirroring_endpoint_group_generated_meta.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ api_service_name: 'networksecurity.googleapis.com'
55
api_version: 'v1beta1'
66
api_resource_type_kind: 'MirroringEndpointGroup'
77
fields:
8+
- field: 'associations.name'
9+
- field: 'associations.network'
10+
- field: 'associations.state'
11+
- field: 'connected_deployment_groups.locations.location'
12+
- field: 'connected_deployment_groups.locations.state'
13+
- field: 'connected_deployment_groups.name'
814
- field: 'create_time'
915
- field: 'description'
1016
- field: 'effective_labels'

Diff for: website/docs/r/network_security_mirroring_endpoint_group.html.markdown

+63
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,15 @@ In addition to the arguments listed above, the following computed attributes are
141141
operation (e.g. adding a new association to the group).
142142
See https://google.aip.dev/128.
143143

144+
* `associations` -
145+
List of associations to this endpoint group.
146+
Structure is [documented below](#nested_associations).
147+
148+
* `connected_deployment_groups` -
149+
List of details about the connected deployment groups to this endpoint
150+
group.
151+
Structure is [documented below](#nested_connected_deployment_groups).
152+
144153
* `terraform_labels` -
145154
The combination of labels configured directly on the resource
146155
and default labels configured on the provider.
@@ -149,6 +158,60 @@ In addition to the arguments listed above, the following computed attributes are
149158
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services.
150159

151160

161+
<a name="nested_associations"></a>The `associations` block contains:
162+
163+
* `name` -
164+
(Output)
165+
The connected association's resource name, for example:
166+
`projects/123456789/locations/global/mirroringEndpointGroupAssociations/my-ega`.
167+
See https://google.aip.dev/124.
168+
169+
* `network` -
170+
(Output)
171+
The associated network, for example:
172+
projects/123456789/global/networks/my-network.
173+
See https://google.aip.dev/124.
174+
175+
* `state` -
176+
(Output)
177+
Most recent known state of the association.
178+
Possible values:
179+
STATE_UNSPECIFIED
180+
ACTIVE
181+
CREATING
182+
DELETING
183+
CLOSED
184+
OUT_OF_SYNC
185+
DELETE_FAILED
186+
187+
<a name="nested_connected_deployment_groups"></a>The `connected_deployment_groups` block contains:
188+
189+
* `name` -
190+
(Output)
191+
The connected deployment group's resource name, for example:
192+
`projects/123456789/locations/global/mirroringDeploymentGroups/my-dg`.
193+
See https://google.aip.dev/124.
194+
195+
* `locations` -
196+
(Output)
197+
The list of locations where the deployment group is present.
198+
Structure is [documented below](#nested_connected_deployment_groups_connected_deployment_groups_locations).
199+
200+
201+
<a name="nested_connected_deployment_groups_connected_deployment_groups_locations"></a>The `locations` block contains:
202+
203+
* `location` -
204+
(Output)
205+
The cloud location, e.g. `us-central1-a` or `asia-south1-b`.
206+
207+
* `state` -
208+
(Output)
209+
The current state of the association in this location.
210+
Possible values:
211+
STATE_UNSPECIFIED
212+
ACTIVE
213+
OUT_OF_SYNC
214+
152215
## Timeouts
153216

154217
This resource provides the following

0 commit comments

Comments
 (0)