Skip to content

fix(tmp): [120953595] add open_default_record field #3018

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/3018.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_monitor_tmp_tke_cluster_agent: support `open_default_record` field.
```
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ func ResourceTencentCloudMonitorTmpTkeClusterAgent() *schema.Resource {
Optional: true,
Description: "Whether to collect indicators, true means drop all indicators, false means collect default indicators.",
},
"open_default_record": {
Type: schema.TypeBool,
Optional: true,
Computed: true,
Description: "Whether to enable the default pre-aggregation rule.",
},
"cluster_name": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -247,6 +253,9 @@ func resourceTencentCloudMonitorTmpTkeClusterAgentCreate(d *schema.ResourceData,
if v, ok := dMap["not_scrape"]; ok {
prometheusClusterAgent.NotScrape = helper.Bool(v.(bool))
}
if v, ok := dMap["open_default_record"]; ok {
prometheusClusterAgent.OpenDefaultRecord = helper.Bool(v.(bool))
}
var prometheusClusterAgents []*monitor.PrometheusClusterAgentBasic
prometheusClusterAgents = append(prometheusClusterAgents, &prometheusClusterAgent)
request.Agents = prometheusClusterAgents
Expand Down Expand Up @@ -324,6 +333,9 @@ func resourceTencentCloudMonitorTmpTkeClusterAgentRead(d *schema.ResourceData, m

var agents []map[string]interface{}
agent := make(map[string]interface{})
if v, ok := d.GetOk("agents"); ok && len(v.([]interface{})) > 0 {
agent = v.([]interface{})[0].(map[string]interface{})
}
agent["cluster_id"] = clusterAgent.ClusterId
agent["cluster_type"] = clusterAgent.ClusterType
agent["status"] = clusterAgent.Status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ func TestAccTencentCloudMonitorClusterAgent_basic(t *testing.T) {
Config: testClusterAgentYaml_basic,
Check: resource.ComposeTestCheckFunc(
testAccCheckClusterAgentExists("tencentcloud_monitor_tmp_tke_cluster_agent.basic"),
resource.TestCheckResourceAttr("tencentcloud_monitor_tmp_tke_cluster_agent.basic", "agents.0.cluster_id", "cls-9ae9qo9k"),
resource.TestCheckResourceAttr("tencentcloud_monitor_tmp_tke_cluster_agent.basic", "agents.0.cluster_type", "eks"),
resource.TestCheckResourceAttr("tencentcloud_monitor_tmp_tke_cluster_agent.basic", "agents.0.cluster_id", tcacctest.TkeClusterIdAgent),
resource.TestCheckResourceAttr("tencentcloud_monitor_tmp_tke_cluster_agent.basic", "agents.0.cluster_type", tcacctest.TkeClusterTypeAgent),
resource.TestCheckResourceAttr("tencentcloud_monitor_tmp_tke_cluster_agent.basic", "agents.0.open_default_record", "true"),
),
},
},
Expand Down Expand Up @@ -147,9 +148,10 @@ const testClusterAgentYaml_basic = testClusterAgentYamlVar + `
resource "tencentcloud_monitor_tmp_tke_cluster_agent" "basic" {
instance_id = var.prometheus_id
agents {
region = var.default_region
cluster_type = var.agent_cluster_type
cluster_id = var.agent_cluster_id
enable_external = false
region = var.default_region
cluster_type = var.agent_cluster_type
cluster_id = var.agent_cluster_id
enable_external = false
open_default_record = true
}
}`
1 change: 1 addition & 0 deletions website/docs/r/monitor_tmp_tke_cluster_agent.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ The `agents` object supports the following:
* `in_cluster_pod_config` - (Optional, List) Pod configuration for components deployed in the cluster.
* `not_install_basic_scrape` - (Optional, Bool) Whether to install the default collection configuration.
* `not_scrape` - (Optional, Bool) Whether to collect indicators, true means drop all indicators, false means collect default indicators.
* `open_default_record` - (Optional, Bool) Whether to enable the default pre-aggregation rule.

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

Expand Down
Loading