Skip to content

Commit 00267f5

Browse files
author
WeiMengXS
committed
fix: parm
1 parent f73495e commit 00267f5

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tencentcloud/resource_tc_scf_function.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func resourceTencentCloudScfFunction() *schema.Resource {
119119
},
120120
"handler": {
121121
Type: schema.TypeString,
122-
Required: true,
122+
Optional: true,
123123
ValidateFunc: helper.ComposeValidateFunc(
124124
validateStringLengthInRange(2, 60),
125125
scfFunctionValidate(true),
@@ -162,7 +162,7 @@ func resourceTencentCloudScfFunction() *schema.Resource {
162162
},
163163
"runtime": {
164164
Type: schema.TypeString,
165-
Required: true,
165+
Optional: true,
166166
Description: "Runtime of the SCF function, only supports `Python2.7`, `Python3.6`, `Nodejs6.10`, `Nodejs8.9`, `Nodejs10.15`, `PHP5`, `PHP7`, `Golang1`, and `Java8`.",
167167
},
168168
"vpc_id": {
@@ -528,14 +528,18 @@ func resourceTencentCloudScfFunctionCreate(d *schema.ResourceData, m interface{}
528528
var functionInfo scfFunctionInfo
529529

530530
functionInfo.name = d.Get("name").(string)
531-
functionInfo.handler = helper.String(d.Get("handler").(string))
532531
functionInfo.desc = helper.String(d.Get("description").(string))
533532
functionInfo.memSize = helper.Int(d.Get("mem_size").(int))
534533
functionInfo.timeout = helper.Int(d.Get("timeout").(int))
535534
functionInfo.environment = helper.GetTags(d, "environment")
536-
functionInfo.runtime = helper.String(d.Get("runtime").(string))
537535
functionInfo.namespace = helper.String(d.Get("namespace").(string))
538536

537+
if raw, ok := d.GetOk("handler"); ok {
538+
functionInfo.handler = helper.String(raw.(string))
539+
}
540+
if raw, ok := d.GetOk("runtime"); ok {
541+
functionInfo.runtime = helper.String(raw.(string))
542+
}
539543
if raw, ok := d.GetOk("vpc_id"); ok {
540544
functionInfo.vpcId = helper.String(raw.(string))
541545
}

0 commit comments

Comments
 (0)