Skip to content

Commit bc492bf

Browse files
committed
fix(cvm): [122395875] Array element "" is not allowed
1 parent 81de2da commit bc492bf

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

tencentcloud/common/validators.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,3 +391,10 @@ func ValidateTkeGpuDriverVersion(v interface{}, k string) (ws []string, errors [
391391
}
392392
return
393393
}
394+
395+
func ValidateStringNotNil(v interface{}, k string) (ws []string, errors []error) {
396+
if v == nil || v == "" {
397+
errors = append(errors, fmt.Errorf("%s cannot be null or \\", k))
398+
}
399+
return
400+
}

tencentcloud/services/cvm/resource_tc_instance.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,11 @@ func ResourceTencentCloudInstance() *schema.Resource {
220220
},
221221

222222
"orderly_security_groups": {
223-
Type: schema.TypeList,
224-
Elem: &schema.Schema{Type: schema.TypeString},
223+
Type: schema.TypeList,
224+
Elem: &schema.Schema{
225+
Type: schema.TypeString,
226+
ValidateFunc: tccommon.ValidateStringNotNil,
227+
},
225228
Optional: true,
226229
Computed: true,
227230
ConflictsWith: []string{"security_groups"},

0 commit comments

Comments
 (0)