Skip to content
This repository was archived by the owner on Mar 1, 2023. It is now read-only.

Commit e0b650b

Browse files
vvelikodnyVitaly Velikodny
andauthored
fix enabled field default value for 'redirect_http_to_https' & 'ghzip_on' resource option (#70)
Co-authored-by: Vitaly Velikodny <[email protected]>
1 parent 57b4a8d commit e0b650b

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

gcore/resource_gcore_cdn_resource.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ func resourceCDNResource() *schema.Resource {
135135
Schema: map[string]*schema.Schema{
136136
"enabled": {
137137
Type: schema.TypeBool,
138-
Required: true,
138+
Optional: true,
139+
Default: true,
139140
},
140141
"value": {
141142
Type: schema.TypeBool,
@@ -153,7 +154,8 @@ func resourceCDNResource() *schema.Resource {
153154
Schema: map[string]*schema.Schema{
154155
"enabled": {
155156
Type: schema.TypeBool,
156-
Required: true,
157+
Optional: true,
158+
Default: true,
157159
},
158160
"value": {
159161
Type: schema.TypeBool,
@@ -334,8 +336,12 @@ func listToOptions(l []interface{}) *gcdn.Options {
334336
}
335337
}
336338
if opt, ok := getOptByName(fields, "gzip_on"); ok {
339+
enabled := true
340+
if _, ok := opt["enabled"]; ok {
341+
enabled = opt["enabled"].(bool)
342+
}
337343
opts.GzipOn = &gcdn.GzipOn{
338-
Enabled: opt["enabled"].(bool),
344+
Enabled: enabled,
339345
Value: opt["value"].(bool),
340346
}
341347
}

0 commit comments

Comments
 (0)