Skip to content

Commit 802fa03

Browse files
Add connectedDeploymentGroup and associations fields to intercept endpoint group. (#13373) (#9586)
[upstream:1c34755fab75d7d5d903e227101007b7e03d1567] Signed-off-by: Modular Magician <[email protected]>
1 parent 8903278 commit 802fa03

4 files changed

+240
-0
lines changed

.changelog/13373.txt

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

google-beta/services/networksecurity/resource_network_security_intercept_endpoint_group.go

+169
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,36 @@ 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: 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+
},
96126
"create_time": {
97127
Type: schema.TypeString,
98128
Computed: true,
@@ -158,6 +188,61 @@ See https://google.aip.dev/148#timestamps.`,
158188
}
159189
}
160190

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+
161246
func resourceNetworkSecurityInterceptEndpointGroupCreate(d *schema.ResourceData, meta interface{}) error {
162247
config := meta.(*transport_tpg.Config)
163248
userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent)
@@ -321,6 +406,12 @@ func resourceNetworkSecurityInterceptEndpointGroupRead(d *schema.ResourceData, m
321406
if err := d.Set("description", flattenNetworkSecurityInterceptEndpointGroupDescription(res["description"], d, config)); err != nil {
322407
return fmt.Errorf("Error reading InterceptEndpointGroup: %s", err)
323408
}
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+
}
324415
if err := d.Set("terraform_labels", flattenNetworkSecurityInterceptEndpointGroupTerraformLabels(res["labels"], d, config)); err != nil {
325416
return fmt.Errorf("Error reading InterceptEndpointGroup: %s", err)
326417
}
@@ -538,6 +629,84 @@ func flattenNetworkSecurityInterceptEndpointGroupDescription(v interface{}, d *s
538629
return v
539630
}
540631

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+
541710
func flattenNetworkSecurityInterceptEndpointGroupTerraformLabels(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
542711
if v == nil {
543712
return v

google-beta/services/networksecurity/resource_network_security_intercept_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: 'InterceptEndpointGroup'
77
fields:
8+
- field: 'associations.name'
9+
- field: 'associations.network'
10+
- field: 'associations.state'
11+
- field: 'connected_deployment_group.locations.location'
12+
- field: 'connected_deployment_group.locations.state'
13+
- field: 'connected_deployment_group.name'
814
- field: 'create_time'
915
- field: 'description'
1016
- field: 'effective_labels'

website/docs/r/network_security_intercept_endpoint_group.html.markdown

+62
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,14 @@ 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_group` -
149+
The endpoint group's view of a connected deployment group.
150+
Structure is [documented below](#nested_connected_deployment_group).
151+
144152
* `terraform_labels` -
145153
The combination of labels configured directly on the resource
146154
and default labels configured on the provider.
@@ -149,6 +157,60 @@ In addition to the arguments listed above, the following computed attributes are
149157
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services.
150158

151159

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

154216
This resource provides the following

0 commit comments

Comments
 (0)