Skip to content

Commit 42e1f28

Browse files
authored
Merge pull request #1531 from tencentcloudstack/feat/fix_scf_func_state
fix scf func state change
2 parents a40a216 + f3c31c0 commit 42e1f28

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

.changelog/1531.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: keep state consistent when vpc_id is not set
3+
```

tencentcloud/resource_tc_scf_function.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,13 @@ func resourceTencentCloudScfFunction() *schema.Resource {
233233
Type: schema.TypeBool,
234234
Optional: true,
235235
Default: false,
236-
Description: "Indicates whether public net config enabled. NOTE: only `vpc_id` specified can disable public net config.",
236+
Description: "Indicates whether public net config enabled. Default `false`. NOTE: only `vpc_id` specified can disable public net config.",
237237
},
238238
"enable_eip_config": {
239239
Type: schema.TypeBool,
240240
Optional: true,
241241
Default: false,
242-
Description: "Indicates whether EIP config set to `ENABLE` when `enable_public_net` was true.",
242+
Description: "Indicates whether EIP config set to `ENABLE` when `enable_public_net` was true. Default `false`.",
243243
},
244244
// cos code
245245
"cos_bucket_name": {
@@ -593,10 +593,10 @@ func resourceTencentCloudScfFunctionCreate(d *schema.ResourceData, m interface{}
593593
functionInfo.layers = layers
594594
}
595595

596-
enablePublicNet, enablePublicNetOk := d.GetOk("enable_public_net")
597-
enableEipConfig, enableEipConfigOk := d.GetOk("enable_eip_config")
596+
enablePublicNet, _ := d.GetOk("enable_public_net")
597+
enableEipConfig, _ := d.GetOk("enable_eip_config")
598598

599-
if enablePublicNetOk {
599+
if enablePublicNet != nil {
600600
enable := enablePublicNet.(bool)
601601
publicNetStatus := helper.String("ENABLE")
602602
if !enable {
@@ -610,7 +610,7 @@ func resourceTencentCloudScfFunctionCreate(d *schema.ResourceData, m interface{}
610610
}
611611
}
612612

613-
if enableEipConfigOk {
613+
if enableEipConfig != nil {
614614
enableEip := enableEipConfig.(bool)
615615
eipStatus := "DISABLE"
616616
if enableEip {
@@ -1156,7 +1156,7 @@ func resourceTencentCloudScfFunctionUpdate(d *schema.ResourceData, m interface{}
11561156
updateAttrs = append(updateAttrs, "enable_eip_config")
11571157
}
11581158

1159-
if raw, ok := d.GetOk("enable_public_net"); ok {
1159+
if raw, _ := d.GetOk("enable_public_net"); raw != nil {
11601160
enablePublicNet := raw.(bool)
11611161
publicNetStatus := helper.String("ENABLE")
11621162
if !enablePublicNet {
@@ -1170,7 +1170,7 @@ func resourceTencentCloudScfFunctionUpdate(d *schema.ResourceData, m interface{}
11701170
}
11711171
}
11721172

1173-
if raw, ok := d.GetOk("enable_eip_config"); ok {
1173+
if raw, _ := d.GetOk("enable_eip_config"); raw != nil {
11741174
status := "DISABLE"
11751175
enablePublicNet := d.Get("enable_public_net").(bool)
11761176
if raw.(bool) {

website/docs/r/scf_function.html.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ The following arguments are supported:
5858
* `cos_bucket_region` - (Optional, String) Cos bucket region of the SCF function, conflict with `zip_file`.
5959
* `cos_object_name` - (Optional, String) Cos object name of the SCF function, should have suffix `.zip` or `.jar`, conflict with `zip_file`.
6060
* `description` - (Optional, String) Description of the SCF function. Description supports English letters, numbers, spaces, commas, newlines, periods and Chinese, the maximum length is 1000.
61-
* `enable_eip_config` - (Optional, Bool) Indicates whether EIP config set to `ENABLE` when `enable_public_net` was true.
62-
* `enable_public_net` - (Optional, Bool) Indicates whether public net config enabled. NOTE: only `vpc_id` specified can disable public net config.
61+
* `enable_eip_config` - (Optional, Bool) Indicates whether EIP config set to `ENABLE` when `enable_public_net` was true. Default `false`.
62+
* `enable_public_net` - (Optional, Bool) Indicates whether public net config enabled. Default `false`. NOTE: only `vpc_id` specified can disable public net config.
6363
* `environment` - (Optional, Map) Environment of the SCF function.
6464
* `image_config` - (Optional, List) Image of the SCF function, conflict with ``.
6565
* `l5_enable` - (Optional, Bool) Enable L5 for SCF function, default is `false`.

0 commit comments

Comments
 (0)