Skip to content

Commit 9c2d9b9

Browse files
authored
update tem (#1215)
1 parent d0d2677 commit 9c2d9b9

7 files changed

+76
-50
lines changed

tencentcloud/resource_tc_instance_set.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,9 @@ func doResourceTencentCloudInstanceSetUpdate(d *schema.ResourceData, meta interf
654654
cvmService := CvmService{
655655
client: meta.(*TencentCloudClient).apiV3Conn,
656656
}
657+
if d.HasChange("instance_count") {
658+
return fmt.Errorf("`instance_count` do not support change now, please use `resource_tc_instace` instead.")
659+
}
657660

658661
if d.HasChange("exclude_instance_ids") {
659662
old, new := d.GetChange("exclude_instance_ids")

tencentcloud/resource_tc_tem_log_config.go

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ Example Usage
55
66
```hcl
77
resource "tencentcloud_tem_log_config" "logConfig" {
8-
environment_id = "en-853mggjm"
8+
environment_id = "en-o5edaepv"
99
application_id = "app-3j29aa2p"
10-
name = "terraform"
11-
logset_id = "b5824781-8d5b-4029-a2f7-d03c37f72bdf"
12-
topic_id = "a21a488d-d28f-4ac3-8044-bdf8c91b49f2"
13-
input_type = "container_stdout"
14-
log_type = "minimalist_log"
10+
workload_id = resource.tencentcloud_tem_workload.workload.id
11+
name = "terraform"
12+
logset_id = "b5824781-8d5b-4029-a2f7-d03c37f72bdf"
13+
topic_id = "5a85bb6d-8e41-4e04-b7bd-c05e04782f94"
14+
input_type = "container_stdout"
15+
log_type = "minimalist_log"
1516
}
1617
1718
```
@@ -60,6 +61,13 @@ func resourceTencentCloudTemLogConfig() *schema.Resource {
6061
Description: "application ID.",
6162
},
6263

64+
"workload_id": {
65+
Type: schema.TypeString,
66+
Required: true,
67+
ForceNew: true,
68+
Description: "application ID, which is combined by environment ID and application ID, like `en-o5edaepv#app-3j29aa2p`.",
69+
},
70+
6371
"name": {
6472
Type: schema.TypeString,
6573
Required: true,
@@ -135,6 +143,13 @@ func resourceTencentCloudTemLogConfigCreate(d *schema.ResourceData, meta interfa
135143
request.ApplicationId = helper.String(v.(string))
136144
}
137145

146+
if v, ok := d.GetOk("workload_id"); ok {
147+
workloadId := v.(string)
148+
if workloadId != environmentId+FILED_SP+applicationId {
149+
return fmt.Errorf("workloadId is error, it should be %s", environmentId+FILED_SP+applicationId)
150+
}
151+
}
152+
138153
if v, ok := d.GetOk("name"); ok {
139154
name = v.(string)
140155
request.Name = helper.String(v.(string))
@@ -217,10 +232,8 @@ func resourceTencentCloudTemLogConfigRead(d *schema.ResourceData, meta interface
217232
}
218233

219234
_ = d.Set("environment_id", environmentId)
220-
221-
if logConfig.ApplicationId != nil {
222-
_ = d.Set("application_id", logConfig.ApplicationId)
223-
}
235+
_ = d.Set("application_id", logConfig.ApplicationId)
236+
_ = d.Set("workload_id", environmentId+FILED_SP+applicationId)
224237

225238
if logConfig.Name != nil {
226239
_ = d.Set("name", logConfig.Name)
@@ -277,18 +290,6 @@ func resourceTencentCloudTemLogConfigUpdate(d *schema.ResourceData, meta interfa
277290
request.ApplicationId = &applicationId
278291
request.Name = &name
279292

280-
if d.HasChange("environment_id") {
281-
return fmt.Errorf("`environment_id` do not support change now.")
282-
}
283-
284-
if d.HasChange("application_id") {
285-
return fmt.Errorf("`application_id` do not support change now.")
286-
}
287-
288-
if d.HasChange("name") {
289-
return fmt.Errorf("`name` do not support change now.")
290-
}
291-
292293
if d.HasChange("logset_id") || d.HasChange("topic_id") || d.HasChange("input_type") || d.HasChange("log_type") ||
293294
d.HasChange("beginning_regex") || d.HasChange("log_path") || d.HasChange("file_pattern") {
294295
data := tem.LogConfig{}

tencentcloud/resource_tc_tem_scale_rule.go

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ Example Usage
55
66
```hcl
77
resource "tencentcloud_tem_scale_rule" "scaleRule" {
8-
environment_id = "en-853mggjm"
8+
environment_id = "en-o5edaepv"
99
application_id = "app-3j29aa2p"
10+
workload_id = resource.tencentcloud_tem_workload.workload.id
1011
autoscaler {
1112
autoscaler_name = "test3123"
1213
description = "test"
1314
enabled = true
1415
min_replicas = 1
15-
max_replicas = 3
16+
max_replicas = 4
1617
cron_horizontal_autoscaler {
1718
name = "test"
1819
period = "* * *"
@@ -36,7 +37,7 @@ resource "tencentcloud_tem_scale_rule" "scaleRule" {
3637
horizontal_autoscaler {
3738
metrics = "CPU"
3839
enabled = true
39-
max_replicas = 3
40+
max_replicas = 4
4041
min_replicas = 1
4142
threshold = 60
4243
}
@@ -90,6 +91,13 @@ func resourceTencentCloudTemScaleRule() *schema.Resource {
9091
Description: "application ID.",
9192
},
9293

94+
"workload_id": {
95+
Type: schema.TypeString,
96+
Required: true,
97+
ForceNew: true,
98+
Description: "application ID, which is combined by environment ID and application ID, like `en-o5edaepv#app-3j29aa2p`.",
99+
},
100+
93101
"autoscaler": {
94102
Type: schema.TypeList,
95103
MaxItems: 1,
@@ -234,6 +242,13 @@ func resourceTencentCloudTemScaleRuleCreate(d *schema.ResourceData, meta interfa
234242
request.ApplicationId = helper.String(v.(string))
235243
}
236244

245+
if v, ok := d.GetOk("workload_id"); ok {
246+
workloadId := v.(string)
247+
if workloadId != environmentId+FILED_SP+applicationId {
248+
return fmt.Errorf("workloadId is error, it should be %s", environmentId+FILED_SP+applicationId)
249+
}
250+
}
251+
237252
if dMap, ok := helper.InterfacesHeadMap(d, "autoscaler"); ok {
238253
autoscaler := tem.Autoscaler{}
239254
if v, ok := dMap["autoscaler_name"]; ok {
@@ -361,6 +376,7 @@ func resourceTencentCloudTemScaleRuleRead(d *schema.ResourceData, meta interface
361376

362377
_ = d.Set("environment_id", environmentId)
363378
_ = d.Set("application_id", applicationId)
379+
_ = d.Set("workload_id", environmentId+FILED_SP+applicationId)
364380

365381
autoscalerMap := map[string]interface{}{}
366382
if scaleRule.AutoscalerName != nil {

tencentcloud/resource_tc_tem_workload.go

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ resource "tencentcloud_tem_workload" "workload" {
1717
type = "HttpGet"
1818
protocol = "HTTP"
1919
path = "/"
20-
port = 8080
20+
port = 8201
2121
initial_delay_seconds = 0
2222
timeout_seconds = 1
2323
period_seconds = 10
@@ -27,7 +27,7 @@ resource "tencentcloud_tem_workload" "workload" {
2727
type = "HttpGet"
2828
protocol = "HTTP"
2929
path = "/"
30-
port = 8000
30+
port = 8201
3131
initial_delay_seconds = 0
3232
timeout_seconds = 1
3333
period_seconds = 10
@@ -37,7 +37,7 @@ resource "tencentcloud_tem_workload" "workload" {
3737
type = "HttpGet"
3838
protocol = "HTTP"
3939
path = "/"
40-
port = 36000
40+
port = 8201
4141
initial_delay_seconds = 0
4242
timeout_seconds = 1
4343
period_seconds = 10
@@ -751,23 +751,25 @@ func resourceTencentCloudTemWorkloadRead(d *schema.ResourceData, meta interface{
751751
envConfList := []interface{}{}
752752
for _, envConf := range workload.EnvConf {
753753
envConfMap := map[string]interface{}{}
754-
if envConf.Key != nil {
755-
envConfMap["key"] = envConf.Key
756-
}
757-
if envConf.Value != nil {
758-
envConfMap["value"] = envConf.Value
759-
}
760754
if envConf.Type != nil {
761-
envConfMap["type"] = envConf.Type
762-
}
763-
if envConf.Config != nil {
764-
envConfMap["config"] = envConf.Config
765-
}
766-
if envConf.Secret != nil {
767-
envConfMap["secret"] = envConf.Secret
755+
if *envConf.Type != "reserved" {
756+
envConfMap["type"] = envConf.Type
757+
if envConf.Key != nil {
758+
envConfMap["key"] = envConf.Key
759+
}
760+
if envConf.Value != nil {
761+
envConfMap["value"] = envConf.Value
762+
}
763+
if envConf.Config != nil {
764+
envConfMap["config"] = envConf.Config
765+
}
766+
if envConf.Secret != nil {
767+
envConfMap["secret"] = envConf.Secret
768+
}
769+
envConfList = append(envConfList, envConfMap)
770+
}
768771
}
769772

770-
envConfList = append(envConfList, envConfMap)
771773
}
772774
_ = d.Set("env_conf", envConfList)
773775
}

website/docs/r/tem_log_config.html.markdown

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ Provides a resource to create a tem logConfig
1515

1616
```hcl
1717
resource "tencentcloud_tem_log_config" "logConfig" {
18-
environment_id = "en-853mggjm"
18+
environment_id = "en-o5edaepv"
1919
application_id = "app-3j29aa2p"
20+
workload_id = resource.tencentcloud_tem_workload.workload.id
2021
name = "terraform"
2122
logset_id = "b5824781-8d5b-4029-a2f7-d03c37f72bdf"
22-
topic_id = "a21a488d-d28f-4ac3-8044-bdf8c91b49f2"
23+
topic_id = "5a85bb6d-8e41-4e04-b7bd-c05e04782f94"
2324
input_type = "container_stdout"
2425
log_type = "minimalist_log"
2526
}
@@ -36,6 +37,7 @@ The following arguments are supported:
3637
* `logset_id` - (Required, String) logset.
3738
* `name` - (Required, String, ForceNew) appConfig name.
3839
* `topic_id` - (Required, String) topic.
40+
* `workload_id` - (Required, String, ForceNew) application ID, which is combined by environment ID and application ID, like `en-o5edaepv#app-3j29aa2p`.
3941
* `beginning_regex` - (Optional, String) regex pattern.
4042
* `file_pattern` - (Optional, String) file name pattern if container_file.
4143
* `log_path` - (Optional, String) directory if container_file.

website/docs/r/tem_scale_rule.html.markdown

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ Provides a resource to create a tem scaleRule
1515

1616
```hcl
1717
resource "tencentcloud_tem_scale_rule" "scaleRule" {
18-
environment_id = "en-853mggjm"
18+
environment_id = "en-o5edaepv"
1919
application_id = "app-3j29aa2p"
20+
workload_id = resource.tencentcloud_tem_workload.workload.id
2021
autoscaler {
2122
autoscaler_name = "test3123"
2223
description = "test"
2324
enabled = true
2425
min_replicas = 1
25-
max_replicas = 3
26+
max_replicas = 4
2627
cron_horizontal_autoscaler {
2728
name = "test"
2829
period = "* * *"
@@ -46,7 +47,7 @@ resource "tencentcloud_tem_scale_rule" "scaleRule" {
4647
horizontal_autoscaler {
4748
metrics = "CPU"
4849
enabled = true
49-
max_replicas = 3
50+
max_replicas = 4
5051
min_replicas = 1
5152
threshold = 60
5253
}
@@ -62,6 +63,7 @@ The following arguments are supported:
6263
* `application_id` - (Required, String, ForceNew) application ID.
6364
* `autoscaler` - (Required, List) .
6465
* `environment_id` - (Required, String, ForceNew) environment ID.
66+
* `workload_id` - (Required, String, ForceNew) application ID, which is combined by environment ID and application ID, like `en-o5edaepv#app-3j29aa2p`.
6567

6668
The `autoscaler` object supports the following:
6769

website/docs/r/tem_workload.html.markdown

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ resource "tencentcloud_tem_workload" "workload" {
2727
type = "HttpGet"
2828
protocol = "HTTP"
2929
path = "/"
30-
port = 8080
30+
port = 8201
3131
initial_delay_seconds = 0
3232
timeout_seconds = 1
3333
period_seconds = 10
@@ -37,7 +37,7 @@ resource "tencentcloud_tem_workload" "workload" {
3737
type = "HttpGet"
3838
protocol = "HTTP"
3939
path = "/"
40-
port = 8000
40+
port = 8201
4141
initial_delay_seconds = 0
4242
timeout_seconds = 1
4343
period_seconds = 10
@@ -47,7 +47,7 @@ resource "tencentcloud_tem_workload" "workload" {
4747
type = "HttpGet"
4848
protocol = "HTTP"
4949
path = "/"
50-
port = 36000
50+
port = 8201
5151
initial_delay_seconds = 0
5252
timeout_seconds = 1
5353
period_seconds = 10

0 commit comments

Comments
 (0)