Skip to content

Commit 6378fa4

Browse files
committed
fix(tmp): [120953595] add open_default_record Field
1 parent 7ce73bd commit 6378fa4

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

tencentcloud/services/tmp/resource_tc_monitor_tmp_tke_cluster_agent.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,12 @@ func ResourceTencentCloudMonitorTmpTkeClusterAgent() *schema.Resource {
144144
Optional: true,
145145
Description: "Whether to collect indicators, true means drop all indicators, false means collect default indicators.",
146146
},
147+
"open_default_record": {
148+
Type: schema.TypeBool,
149+
Optional: true,
150+
Computed: true,
151+
Description: "Whether to enable the default pre-aggregation rule.",
152+
},
147153
"cluster_name": {
148154
Type: schema.TypeString,
149155
Computed: true,
@@ -247,6 +253,9 @@ func resourceTencentCloudMonitorTmpTkeClusterAgentCreate(d *schema.ResourceData,
247253
if v, ok := dMap["not_scrape"]; ok {
248254
prometheusClusterAgent.NotScrape = helper.Bool(v.(bool))
249255
}
256+
if v, ok := dMap["open_default_record"]; ok {
257+
prometheusClusterAgent.OpenDefaultRecord = helper.Bool(v.(bool))
258+
}
250259
var prometheusClusterAgents []*monitor.PrometheusClusterAgentBasic
251260
prometheusClusterAgents = append(prometheusClusterAgents, &prometheusClusterAgent)
252261
request.Agents = prometheusClusterAgents
@@ -324,6 +333,9 @@ func resourceTencentCloudMonitorTmpTkeClusterAgentRead(d *schema.ResourceData, m
324333

325334
var agents []map[string]interface{}
326335
agent := make(map[string]interface{})
336+
if v, ok := d.GetOk("agents"); ok && len(v.([]interface{})) > 0 {
337+
agent = v.([]interface{})[0].(map[string]interface{})
338+
}
327339
agent["cluster_id"] = clusterAgent.ClusterId
328340
agent["cluster_type"] = clusterAgent.ClusterType
329341
agent["status"] = clusterAgent.Status

tencentcloud/services/tmp/resource_tc_monitor_tmp_tke_cluster_agent_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,10 @@ const testClusterAgentYaml_basic = testClusterAgentYamlVar + `
147147
resource "tencentcloud_monitor_tmp_tke_cluster_agent" "basic" {
148148
instance_id = var.prometheus_id
149149
agents {
150-
region = var.default_region
151-
cluster_type = var.agent_cluster_type
152-
cluster_id = var.agent_cluster_id
153-
enable_external = false
150+
region = var.default_region
151+
cluster_type = var.agent_cluster_type
152+
cluster_id = var.agent_cluster_id
153+
enable_external = false
154+
open_default_record = true
154155
}
155156
}`

website/docs/r/monitor_tmp_tke_cluster_agent.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ The `agents` object supports the following:
188188
* `in_cluster_pod_config` - (Optional, List) Pod configuration for components deployed in the cluster.
189189
* `not_install_basic_scrape` - (Optional, Bool) Whether to install the default collection configuration.
190190
* `not_scrape` - (Optional, Bool) Whether to collect indicators, true means drop all indicators, false means collect default indicators.
191+
* `open_default_record` - (Optional, Bool) Whether to enable the default pre-aggregation rule.
191192

192193
The `external_labels` object of `agents` supports the following:
193194

0 commit comments

Comments
 (0)