@@ -65,6 +65,11 @@ func resourceComputeTargetHttpsProxy() *schema.Resource {
65
65
Optional : true ,
66
66
ForceNew : true ,
67
67
},
68
+ "ssl_policy" : {
69
+ Type : schema .TypeString ,
70
+ Optional : true ,
71
+ DiffSuppressFunc : compareSelfLinkOrResourceName ,
72
+ },
68
73
"creation_timestamp" : {
69
74
Type : schema .TypeString ,
70
75
Computed : true ,
@@ -111,12 +116,17 @@ func resourceComputeTargetHttpsProxyCreate(d *schema.ResourceData, meta interfac
111
116
if err != nil {
112
117
return err
113
118
}
119
+ sslPolicyProp , err := expandComputeTargetHttpsProxySslPolicy (d .Get ("ssl_policy" ), d , config )
120
+ if err != nil {
121
+ return err
122
+ }
114
123
115
124
obj := map [string ]interface {}{
116
125
"description" : descriptionProp ,
117
126
"name" : nameProp ,
118
127
"sslCertificates" : sslCertificatesProp ,
119
128
"urlMap" : urlMapProp ,
129
+ "sslPolicy" : sslPolicyProp ,
120
130
}
121
131
122
132
url , err := replaceVars (d , config , "https://www.googleapis.com/compute/v1/projects/{{project}}/global/targetHttpsProxies" )
@@ -191,6 +201,9 @@ func resourceComputeTargetHttpsProxyRead(d *schema.ResourceData, meta interface{
191
201
if err := d .Set ("url_map" , flattenComputeTargetHttpsProxyUrlMap (res ["urlMap" ])); err != nil {
192
202
return fmt .Errorf ("Error reading TargetHttpsProxy: %s" , err )
193
203
}
204
+ if err := d .Set ("ssl_policy" , flattenComputeTargetHttpsProxySslPolicy (res ["sslPolicy" ])); err != nil {
205
+ return fmt .Errorf ("Error reading TargetHttpsProxy: %s" , err )
206
+ }
194
207
if err := d .Set ("self_link" , res ["selfLink" ]); err != nil {
195
208
return fmt .Errorf ("Error reading TargetHttpsProxy: %s" , err )
196
209
}
@@ -281,6 +294,39 @@ func resourceComputeTargetHttpsProxyUpdate(d *schema.ResourceData, meta interfac
281
294
282
295
d .SetPartial ("url_map" )
283
296
}
297
+ if d .HasChange ("ssl_policy" ) {
298
+ sslPolicyProp , err := expandComputeTargetHttpsProxySslPolicy (d .Get ("ssl_policy" ), d , config )
299
+ if err != nil {
300
+ return err
301
+ }
302
+
303
+ obj := map [string ]interface {}{
304
+ "sslPolicy" : sslPolicyProp ,
305
+ }
306
+ url , err = replaceVars (d , config , "https://www.googleapis.com/compute/v1/projects/{{project}}/global/targetHttpsProxies/{{name}}/setSslPolicy" )
307
+ if err != nil {
308
+ return err
309
+ }
310
+ res , err = sendRequest (config , "POST" , url , obj )
311
+ if err != nil {
312
+ return fmt .Errorf ("Error updating TargetHttpsProxy %q: %s" , d .Id (), err )
313
+ }
314
+
315
+ err = Convert (res , op )
316
+ if err != nil {
317
+ return err
318
+ }
319
+
320
+ err = computeOperationWaitTime (
321
+ config .clientCompute , op , project , "Updating TargetHttpsProxy" ,
322
+ int (d .Timeout (schema .TimeoutUpdate ).Minutes ()))
323
+
324
+ if err != nil {
325
+ return err
326
+ }
327
+
328
+ d .SetPartial ("ssl_policy" )
329
+ }
284
330
285
331
d .Partial (false )
286
332
@@ -367,6 +413,10 @@ func flattenComputeTargetHttpsProxyUrlMap(v interface{}) interface{} {
367
413
return v
368
414
}
369
415
416
+ func flattenComputeTargetHttpsProxySslPolicy (v interface {}) interface {} {
417
+ return v
418
+ }
419
+
370
420
func expandComputeTargetHttpsProxyDescription (v interface {}, d * schema.ResourceData , config * Config ) (interface {}, error ) {
371
421
return v , nil
372
422
}
@@ -395,3 +445,11 @@ func expandComputeTargetHttpsProxyUrlMap(v interface{}, d *schema.ResourceData,
395
445
}
396
446
return f .RelativeLink (), nil
397
447
}
448
+
449
+ func expandComputeTargetHttpsProxySslPolicy (v interface {}, d * schema.ResourceData , config * Config ) (interface {}, error ) {
450
+ f , err := parseGlobalFieldValue ("sslPolicies" , v .(string ), "project" , d , config , true )
451
+ if err != nil {
452
+ return nil , fmt .Errorf ("Invalid value for ssl_policy: %s" , err )
453
+ }
454
+ return f .RelativeLink (), nil
455
+ }
0 commit comments