@@ -293,6 +293,46 @@ var (
293
293
},
294
294
},
295
295
},
296
+ "static_request_headers" : {
297
+ Type : schema .TypeList ,
298
+ MaxItems : 1 ,
299
+ Optional : true ,
300
+ Description : "" ,
301
+ Elem : & schema.Resource {
302
+ Schema : map [string ]* schema.Schema {
303
+ "enabled" : {
304
+ Type : schema .TypeBool ,
305
+ Optional : true ,
306
+ Default : true ,
307
+ },
308
+ "value" : {
309
+ Type : schema .TypeMap ,
310
+ Elem : & schema.Schema {Type : schema .TypeString },
311
+ Required : true ,
312
+ },
313
+ },
314
+ },
315
+ },
316
+ "static_headers" : {
317
+ Type : schema .TypeList ,
318
+ MaxItems : 1 ,
319
+ Optional : true ,
320
+ Description : "" ,
321
+ Elem : & schema.Resource {
322
+ Schema : map [string ]* schema.Schema {
323
+ "enabled" : {
324
+ Type : schema .TypeBool ,
325
+ Optional : true ,
326
+ Default : true ,
327
+ },
328
+ "value" : {
329
+ Type : schema .TypeMap ,
330
+ Elem : & schema.Schema {Type : schema .TypeString },
331
+ Required : true ,
332
+ },
333
+ },
334
+ },
335
+ },
296
336
},
297
337
},
298
338
}
@@ -361,7 +401,6 @@ func resourceCDNResource() *schema.Resource {
361
401
RequiredWith : []string {"ssl_enabled" },
362
402
Description : "Specify the SSL Certificate ID which should be used for the CDN Resource." ,
363
403
},
364
- "options" : optionsSchema ,
365
404
"active" : {
366
405
Type : schema .TypeBool ,
367
406
Optional : true ,
@@ -373,6 +412,7 @@ func resourceCDNResource() *schema.Resource {
373
412
Computed : true ,
374
413
Description : "Status of a CDN resource content availability. Possible values are: Active, Suspended, Processed." ,
375
414
},
415
+ "options" : optionsSchema ,
376
416
},
377
417
CreateContext : resourceCDNResourceCreate ,
378
418
ReadContext : resourceCDNResourceRead ,
@@ -637,6 +677,32 @@ func listToOptions(l []interface{}) *gcdn.Options {
637
677
opts .QueryParamsBlacklist .Value = append (opts .QueryParamsBlacklist .Value , v .(string ))
638
678
}
639
679
}
680
+ if opt , ok := getOptByName (fields , "static_request_headers" ); ok {
681
+ enabled := true
682
+ if _ , ok := opt ["enabled" ]; ok {
683
+ enabled = opt ["enabled" ].(bool )
684
+ }
685
+ opts .StaticRequestHeaders = & gcdn.StaticRequestHeaders {
686
+ Enabled : enabled ,
687
+ Value : map [string ]string {},
688
+ }
689
+ for k , v := range opt ["value" ].(map [string ]interface {}) {
690
+ opts .StaticRequestHeaders .Value [k ] = v .(string )
691
+ }
692
+ }
693
+ if opt , ok := getOptByName (fields , "static_headers" ); ok {
694
+ enabled := true
695
+ if _ , ok := opt ["enabled" ]; ok {
696
+ enabled = opt ["enabled" ].(bool )
697
+ }
698
+ opts .StaticHeaders = & gcdn.StaticHeaders {
699
+ Enabled : enabled ,
700
+ Value : map [string ]string {},
701
+ }
702
+ for k , v := range opt ["value" ].(map [string ]interface {}) {
703
+ opts .StaticHeaders .Value [k ] = v .(string )
704
+ }
705
+ }
640
706
return & opts
641
707
}
642
708
@@ -712,6 +778,14 @@ func optionsToList(options *gcdn.Options) []interface{} {
712
778
m := structToMap (options .QueryParamsBlacklist )
713
779
result ["query_params_blacklist" ] = []interface {}{m }
714
780
}
781
+ if options .StaticRequestHeaders != nil {
782
+ m := structToMap (options .StaticRequestHeaders )
783
+ result ["static_request_headers" ] = []interface {}{m }
784
+ }
785
+ if options .StaticHeaders != nil {
786
+ m := structToMap (options .StaticHeaders )
787
+ result ["static_headers" ] = []interface {}{m }
788
+ }
715
789
return []interface {}{result }
716
790
}
717
791
0 commit comments