Skip to content

Commit 5ca0292

Browse files
authored
scf function update runtime param and add example with triggers (#2412)
* scf function update runtime param and add example with triggers * add changelog 2412.txt
1 parent e884ffb commit 5ca0292

File tree

4 files changed

+92
-3
lines changed

4 files changed

+92
-3
lines changed

.changelog/2412.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/tencentcloud_scf_function: Update `runtime` description and add example with triggers.
3+
```

tencentcloud/resource_tc_scf_function.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ func resourceTencentCloudScfFunction() *schema.Resource {
118118
"runtime": {
119119
Type: schema.TypeString,
120120
Optional: true,
121-
Description: "Runtime of the SCF function, only supports `Python2.7`, `Python3.6`, `Nodejs6.10`, `Nodejs8.9`, `Nodejs10.15`, `PHP5`, `PHP7`, `Golang1`, and `Java8`.",
121+
Description: "Runtime of the SCF function, only supports `Python2.7`, `Python3.6`, `Nodejs6.10`, `Nodejs8.9`, `Nodejs10.15`, `Nodejs12.16`, `Php5.2`, `Php7.4`, `Go1`, `Java8`, and `CustomRuntime`, default is `Python2.7`.",
122122
},
123123
"vpc_id": {
124124
Type: schema.TypeString,

tencentcloud/services/scf/resource_tc_scf_function.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,51 @@ resource "tencentcloud_scf_function" "foo" {
3535
"env" = "test"
3636
}
3737
}
38+
```
3839

3940
Using CFS config
41+
42+
```
43+
resource "tencentcloud_scf_function" "foo" {
44+
name = "ci-test-function"
45+
handler = "main.do_it"
46+
runtime = "Python3.6"
47+
48+
cfs_config {
49+
user_id = "10000"
50+
user_group_id = "10000"
51+
cfs_id = "cfs-xxxxxxxx"
52+
mount_ins_id = "cfs-xxxxxxxx"
53+
local_mount_dir = "/mnt"
54+
remote_mount_dir = "/"
55+
}
56+
}
57+
```
58+
59+
Using triggers
60+
61+
```hcl
62+
resource "tencentcloud_scf_function" "foo" {
63+
name = "ci-test-function"
64+
handler = "first.do_it_first"
65+
runtime = "Python3.6"
66+
enable_public_net = true
67+
68+
zip_file = "/scf/first.zip"
69+
70+
triggers {
71+
name = "tf-test-fn-trigger"
72+
type = "timer"
73+
trigger_desc = "*/5 * * * * * *"
74+
}
75+
76+
triggers {
77+
name = "scf-bucket-1308919341.cos.ap-guangzhou.myqcloud.com"
78+
cos_region = "ap-guangzhou"
79+
type = "cos"
80+
trigger_desc = "{\"event\":\"cos:ObjectCreated:Put\",\"filter\":{\"Prefix\":\"\",\"Suffix\":\"\"}}"
81+
}
82+
}
4083
```
4184

4285
Import

website/docs/r/scf_function.html.markdown

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,51 @@ resource "tencentcloud_scf_function" "foo" {
4646
"env" = "test"
4747
}
4848
}
49+
```
50+
51+
### Using CFS config
52+
53+
```hcl
54+
resource "tencentcloud_scf_function" "foo" {
55+
name = "ci-test-function"
56+
handler = "main.do_it"
57+
runtime = "Python3.6"
58+
59+
cfs_config {
60+
user_id = "10000"
61+
user_group_id = "10000"
62+
cfs_id = "cfs-xxxxxxxx"
63+
mount_ins_id = "cfs-xxxxxxxx"
64+
local_mount_dir = "/mnt"
65+
remote_mount_dir = "/"
66+
}
67+
}
68+
```
69+
70+
### Using triggers
4971

50-
Using CFS config
72+
```hcl
73+
resource "tencentcloud_scf_function" "foo" {
74+
name = "ci-test-function"
75+
handler = "first.do_it_first"
76+
runtime = "Python3.6"
77+
enable_public_net = true
78+
79+
zip_file = "/scf/first.zip"
80+
81+
triggers {
82+
name = "tf-test-fn-trigger"
83+
type = "timer"
84+
trigger_desc = "*/5 * * * * * *"
85+
}
86+
87+
triggers {
88+
name = "scf-bucket-1308919341.cos.ap-guangzhou.myqcloud.com"
89+
cos_region = "ap-guangzhou"
90+
type = "cos"
91+
trigger_desc = "{\"event\":\"cos:ObjectCreated:Put\",\"filter\":{\"Prefix\":\"\",\"Suffix\":\"\"}}"
92+
}
93+
}
5194
```
5295

5396
## Argument Reference
@@ -76,7 +119,7 @@ The following arguments are supported:
76119
* `mem_size` - (Optional, Int) Memory size of the SCF function, unit is MB. The default is `128`MB. The ladder is 128M.
77120
* `namespace` - (Optional, String, ForceNew) Namespace of the SCF function, default is `default`.
78121
* `role` - (Optional, String) Role of the SCF function.
79-
* `runtime` - (Optional, String) Runtime of the SCF function, only supports `Python2.7`, `Python3.6`, `Nodejs6.10`, `Nodejs8.9`, `Nodejs10.15`, `PHP5`, `PHP7`, `Golang1`, and `Java8`.
122+
* `runtime` - (Optional, String) Runtime of the SCF function, only supports `Python2.7`, `Python3.6`, `Nodejs6.10`, `Nodejs8.9`, `Nodejs10.15`, `Nodejs12.16`, `Php5.2`, `Php7.4`, `Go1`, `Java8`, and `CustomRuntime`, default is `Python2.7`.
80123
* `subnet_id` - (Optional, String) Subnet ID of the SCF function.
81124
* `tags` - (Optional, Map) Tags of the SCF function.
82125
* `timeout` - (Optional, Int) Timeout of the SCF function, unit is second. Default `3`. Available value is 1-900.

0 commit comments

Comments
 (0)