@@ -21,6 +21,11 @@ func resourceCDNResource() *schema.Resource {
21
21
Required : true ,
22
22
Description : "A CNAME that will be used to deliver content though a CDN" ,
23
23
},
24
+ "description" : {
25
+ Type : schema .TypeString ,
26
+ Optional : true ,
27
+ Description : "Custom client description of the resource." ,
28
+ },
24
29
"origin_group" : {
25
30
Type : schema .TypeInt ,
26
31
Optional : true ,
@@ -121,6 +126,24 @@ func resourceCDNResource() *schema.Resource {
121
126
},
122
127
},
123
128
},
129
+ "redirect_http_to_https" : {
130
+ Type : schema .TypeList ,
131
+ MaxItems : 1 ,
132
+ Optional : true ,
133
+ Description : "Sets redirect from HTTP protocol to HTTPS for all resource requests." ,
134
+ Elem : & schema.Resource {
135
+ Schema : map [string ]* schema.Schema {
136
+ "enabled" : {
137
+ Type : schema .TypeBool ,
138
+ Required : true ,
139
+ },
140
+ "value" : {
141
+ Type : schema .TypeBool ,
142
+ Required : true ,
143
+ },
144
+ },
145
+ },
146
+ },
124
147
},
125
148
},
126
149
},
@@ -151,6 +174,7 @@ func resourceCDNResourceCreate(ctx context.Context, d *schema.ResourceData, m in
151
174
152
175
var req resources.CreateRequest
153
176
req .Cname = d .Get ("cname" ).(string )
177
+ req .Description = d .Get ("description" ).(string )
154
178
req .Origin = d .Get ("origin" ).(string )
155
179
req .OriginGroup = d .Get ("origin_group" ).(int )
156
180
@@ -187,6 +211,7 @@ func resourceCDNResourceRead(ctx context.Context, d *schema.ResourceData, m inte
187
211
}
188
212
189
213
d .Set ("cname" , result .Cname )
214
+ d .Set ("description" , result .Description )
190
215
d .Set ("origin_group" , result .OriginGroup )
191
216
d .Set ("origin_protocol" , result .OriginProtocol )
192
217
d .Set ("secondary_hostnames" , result .SecondaryHostnames )
@@ -215,6 +240,7 @@ func resourceCDNResourceUpdate(ctx context.Context, d *schema.ResourceData, m in
215
240
216
241
var req resources.UpdateRequest
217
242
req .Active = d .Get ("active" ).(bool )
243
+ req .Description = d .Get ("description" ).(string )
218
244
req .SSlEnabled = d .Get ("ssl_enabled" ).(bool )
219
245
req .SSLData = d .Get ("ssl_data" ).(int )
220
246
req .OriginGroup = d .Get ("origin_group" ).(int )
@@ -283,7 +309,12 @@ func listToOptions(l []interface{}) *gcdn.Options {
283
309
Value : opt ["value" ].(string ),
284
310
}
285
311
}
286
-
312
+ if opt , ok := getOptByName (fields , "redirect_http_to_https" ); ok {
313
+ opts .RedirectHttpToHttps = & gcdn.RedirectHttpToHttps {
314
+ Enabled : opt ["enabled" ].(bool ),
315
+ Value : opt ["value" ].(bool ),
316
+ }
317
+ }
287
318
return & opts
288
319
}
289
320
@@ -319,6 +350,10 @@ func optionsToList(options *gcdn.Options) []interface{} {
319
350
m := structToMap (options .HostHeader )
320
351
result ["host_header" ] = []interface {}{m }
321
352
}
353
+ if options .RedirectHttpToHttps != nil {
354
+ m := structToMap (options .RedirectHttpToHttps )
355
+ result ["redirect_http_to_https" ] = []interface {}{m }
356
+ }
322
357
return []interface {}{result }
323
358
}
324
359
0 commit comments