Skip to content

Commit d57945d

Browse files
Add Proxy Bind to Target Proxies (#4597) (#3061)
* mark field as updatable Co-authored-by: upodroid <[email protected]> * add proxy_bind Signed-off-by: Modular Magician <[email protected]>
1 parent 66e5ed1 commit d57945d

8 files changed

+94
-0
lines changed

.changelog/4597.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
compute: added `proxy_bind` to `google_compute_target_tcp_proxy`, `google_compute_target_http_proxy` and `google_compute_target_https_proxy`
3+
```

google-beta/resource_compute_backend_service_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,6 +1512,7 @@ resource "google_compute_target_http_proxy" "default" {
15121512
name = "%s"
15131513
description = "a description"
15141514
url_map = google_compute_url_map.default.self_link
1515+
proxy_bind = true
15151516
}
15161517
15171518
resource "google_compute_backend_service" "backend_service" {

google-beta/resource_compute_target_http_proxy.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ to the BackendService.`,
6767
ForceNew: true,
6868
Description: `An optional description of this resource.`,
6969
},
70+
"proxy_bind": {
71+
Type: schema.TypeBool,
72+
Computed: true,
73+
Optional: true,
74+
ForceNew: true,
75+
Description: `This field only applies when the forwarding rule that references
76+
this target proxy has a loadBalancingScheme set to INTERNAL_SELF_MANAGED.`,
77+
},
7078
"creation_timestamp": {
7179
Type: schema.TypeString,
7280
Computed: true,
@@ -118,6 +126,12 @@ func resourceComputeTargetHttpProxyCreate(d *schema.ResourceData, meta interface
118126
} else if v, ok := d.GetOkExists("url_map"); !isEmptyValue(reflect.ValueOf(urlMapProp)) && (ok || !reflect.DeepEqual(v, urlMapProp)) {
119127
obj["urlMap"] = urlMapProp
120128
}
129+
proxyBindProp, err := expandComputeTargetHttpProxyProxyBind(d.Get("proxy_bind"), d, config)
130+
if err != nil {
131+
return err
132+
} else if v, ok := d.GetOkExists("proxy_bind"); !isEmptyValue(reflect.ValueOf(proxyBindProp)) && (ok || !reflect.DeepEqual(v, proxyBindProp)) {
133+
obj["proxyBind"] = proxyBindProp
134+
}
121135

122136
url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/targetHttpProxies")
123137
if err != nil {
@@ -214,6 +228,9 @@ func resourceComputeTargetHttpProxyRead(d *schema.ResourceData, meta interface{}
214228
if err := d.Set("url_map", flattenComputeTargetHttpProxyUrlMap(res["urlMap"], d, config)); err != nil {
215229
return fmt.Errorf("Error reading TargetHttpProxy: %s", err)
216230
}
231+
if err := d.Set("proxy_bind", flattenComputeTargetHttpProxyProxyBind(res["proxyBind"], d, config)); err != nil {
232+
return fmt.Errorf("Error reading TargetHttpProxy: %s", err)
233+
}
217234
if err := d.Set("self_link", ConvertSelfLinkToV1(res["selfLink"].(string))); err != nil {
218235
return fmt.Errorf("Error reading TargetHttpProxy: %s", err)
219236
}
@@ -379,6 +396,10 @@ func flattenComputeTargetHttpProxyUrlMap(v interface{}, d *schema.ResourceData,
379396
return ConvertSelfLinkToV1(v.(string))
380397
}
381398

399+
func flattenComputeTargetHttpProxyProxyBind(v interface{}, d *schema.ResourceData, config *Config) interface{} {
400+
return v
401+
}
402+
382403
func expandComputeTargetHttpProxyDescription(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
383404
return v, nil
384405
}
@@ -394,3 +415,7 @@ func expandComputeTargetHttpProxyUrlMap(v interface{}, d TerraformResourceData,
394415
}
395416
return f.RelativeLink(), nil
396417
}
418+
419+
func expandComputeTargetHttpProxyProxyBind(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
420+
return v, nil
421+
}

google-beta/resource_compute_target_https_proxy.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@ to the BackendService.`,
7979
ForceNew: true,
8080
Description: `An optional description of this resource.`,
8181
},
82+
"proxy_bind": {
83+
Type: schema.TypeBool,
84+
Computed: true,
85+
Optional: true,
86+
ForceNew: true,
87+
Description: `This field only applies when the forwarding rule that references
88+
this target proxy has a loadBalancingScheme set to INTERNAL_SELF_MANAGED.`,
89+
},
8290
"quic_override": {
8391
Type: schema.TypeString,
8492
Optional: true,
@@ -167,6 +175,12 @@ func resourceComputeTargetHttpsProxyCreate(d *schema.ResourceData, meta interfac
167175
} else if v, ok := d.GetOkExists("url_map"); !isEmptyValue(reflect.ValueOf(urlMapProp)) && (ok || !reflect.DeepEqual(v, urlMapProp)) {
168176
obj["urlMap"] = urlMapProp
169177
}
178+
proxyBindProp, err := expandComputeTargetHttpsProxyProxyBind(d.Get("proxy_bind"), d, config)
179+
if err != nil {
180+
return err
181+
} else if v, ok := d.GetOkExists("proxy_bind"); !isEmptyValue(reflect.ValueOf(proxyBindProp)) && (ok || !reflect.DeepEqual(v, proxyBindProp)) {
182+
obj["proxyBind"] = proxyBindProp
183+
}
170184

171185
url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/targetHttpsProxies")
172186
if err != nil {
@@ -272,6 +286,9 @@ func resourceComputeTargetHttpsProxyRead(d *schema.ResourceData, meta interface{
272286
if err := d.Set("url_map", flattenComputeTargetHttpsProxyUrlMap(res["urlMap"], d, config)); err != nil {
273287
return fmt.Errorf("Error reading TargetHttpsProxy: %s", err)
274288
}
289+
if err := d.Set("proxy_bind", flattenComputeTargetHttpsProxyProxyBind(res["proxyBind"], d, config)); err != nil {
290+
return fmt.Errorf("Error reading TargetHttpsProxy: %s", err)
291+
}
275292
if err := d.Set("self_link", ConvertSelfLinkToV1(res["selfLink"].(string))); err != nil {
276293
return fmt.Errorf("Error reading TargetHttpsProxy: %s", err)
277294
}
@@ -561,6 +578,10 @@ func flattenComputeTargetHttpsProxyUrlMap(v interface{}, d *schema.ResourceData,
561578
return ConvertSelfLinkToV1(v.(string))
562579
}
563580

581+
func flattenComputeTargetHttpsProxyProxyBind(v interface{}, d *schema.ResourceData, config *Config) interface{} {
582+
return v
583+
}
584+
564585
func expandComputeTargetHttpsProxyDescription(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
565586
return v, nil
566587
}
@@ -604,3 +625,7 @@ func expandComputeTargetHttpsProxyUrlMap(v interface{}, d TerraformResourceData,
604625
}
605626
return f.RelativeLink(), nil
606627
}
628+
629+
func expandComputeTargetHttpsProxyProxyBind(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
630+
return v, nil
631+
}

google-beta/resource_compute_target_tcp_proxy.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ character, which cannot be a dash.`,
6767
ForceNew: true,
6868
Description: `An optional description of this resource.`,
6969
},
70+
"proxy_bind": {
71+
Type: schema.TypeBool,
72+
Computed: true,
73+
Optional: true,
74+
ForceNew: true,
75+
Description: `This field only applies when the forwarding rule that references
76+
this target proxy has a loadBalancingScheme set to INTERNAL_SELF_MANAGED.`,
77+
},
7078
"proxy_header": {
7179
Type: schema.TypeString,
7280
Optional: true,
@@ -132,6 +140,12 @@ func resourceComputeTargetTcpProxyCreate(d *schema.ResourceData, meta interface{
132140
} else if v, ok := d.GetOkExists("backend_service"); !isEmptyValue(reflect.ValueOf(serviceProp)) && (ok || !reflect.DeepEqual(v, serviceProp)) {
133141
obj["service"] = serviceProp
134142
}
143+
proxyBindProp, err := expandComputeTargetTcpProxyProxyBind(d.Get("proxy_bind"), d, config)
144+
if err != nil {
145+
return err
146+
} else if v, ok := d.GetOkExists("proxy_bind"); !isEmptyValue(reflect.ValueOf(proxyBindProp)) && (ok || !reflect.DeepEqual(v, proxyBindProp)) {
147+
obj["proxyBind"] = proxyBindProp
148+
}
135149

136150
url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/targetTcpProxies")
137151
if err != nil {
@@ -231,6 +245,9 @@ func resourceComputeTargetTcpProxyRead(d *schema.ResourceData, meta interface{})
231245
if err := d.Set("backend_service", flattenComputeTargetTcpProxyBackendService(res["service"], d, config)); err != nil {
232246
return fmt.Errorf("Error reading TargetTcpProxy: %s", err)
233247
}
248+
if err := d.Set("proxy_bind", flattenComputeTargetTcpProxyProxyBind(res["proxyBind"], d, config)); err != nil {
249+
return fmt.Errorf("Error reading TargetTcpProxy: %s", err)
250+
}
234251
if err := d.Set("self_link", ConvertSelfLinkToV1(res["selfLink"].(string))); err != nil {
235252
return fmt.Errorf("Error reading TargetTcpProxy: %s", err)
236253
}
@@ -434,6 +451,10 @@ func flattenComputeTargetTcpProxyBackendService(v interface{}, d *schema.Resourc
434451
return ConvertSelfLinkToV1(v.(string))
435452
}
436453

454+
func flattenComputeTargetTcpProxyProxyBind(v interface{}, d *schema.ResourceData, config *Config) interface{} {
455+
return v
456+
}
457+
437458
func expandComputeTargetTcpProxyDescription(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
438459
return v, nil
439460
}
@@ -453,3 +474,7 @@ func expandComputeTargetTcpProxyBackendService(v interface{}, d TerraformResourc
453474
}
454475
return f.RelativeLink(), nil
455476
}
477+
478+
func expandComputeTargetTcpProxyProxyBind(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
479+
return v, nil
480+
}

website/docs/r/compute_target_http_proxy.html.markdown

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ The following arguments are supported:
134134
(Optional)
135135
An optional description of this resource.
136136

137+
* `proxy_bind` -
138+
(Optional)
139+
This field only applies when the forwarding rule that references
140+
this target proxy has a loadBalancingScheme set to INTERNAL_SELF_MANAGED.
141+
137142
* `project` - (Optional) The ID of the project in which the resource belongs.
138143
If it is not provided, the provider project is used.
139144

website/docs/r/compute_target_https_proxy.html.markdown

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ The following arguments are supported:
143143
the TargetHttpsProxy resource. If not set, the TargetHttpsProxy
144144
resource will not have any SSL policy configured.
145145

146+
* `proxy_bind` -
147+
(Optional)
148+
This field only applies when the forwarding rule that references
149+
this target proxy has a loadBalancingScheme set to INTERNAL_SELF_MANAGED.
150+
146151
* `project` - (Optional) The ID of the project in which the resource belongs.
147152
If it is not provided, the provider project is used.
148153

website/docs/r/compute_target_tcp_proxy.html.markdown

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ The following arguments are supported:
102102
Default value is `NONE`.
103103
Possible values are `NONE` and `PROXY_V1`.
104104

105+
* `proxy_bind` -
106+
(Optional)
107+
This field only applies when the forwarding rule that references
108+
this target proxy has a loadBalancingScheme set to INTERNAL_SELF_MANAGED.
109+
105110
* `project` - (Optional) The ID of the project in which the resource belongs.
106111
If it is not provided, the provider project is used.
107112

0 commit comments

Comments
 (0)