Skip to content

fix(monitor): [122814398] tencentcloud_monitor_tmp_exporter_integration Offline resources #3290

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 2 commits into from
Apr 11, 2025
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
7 changes: 7 additions & 0 deletions .changelog/3290.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```release-note:enhancement
resource/tencentcloud_monitor_tmp_exporter_integration: This resource has been deprecated in Terraform TencentCloud provider version `1.81.182`. Please use `tencentcloud_monitor_tmp_exporter_integration_v2` instead.
```

```release-note:new-resource
tencentcloud_monitor_tmp_exporter_integration_v2
```
1 change: 1 addition & 0 deletions tencentcloud/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -1517,6 +1517,7 @@ func Provider() *schema.Provider {
"tencentcloud_monitor_tmp_cvm_agent": tmp.ResourceTencentCloudMonitorTmpCvmAgent(),
"tencentcloud_monitor_tmp_scrape_job": tmp.ResourceTencentCloudMonitorTmpScrapeJob(),
"tencentcloud_monitor_tmp_exporter_integration": tmp.ResourceTencentCloudMonitorTmpExporterIntegration(),
"tencentcloud_monitor_tmp_exporter_integration_v2": tmp.ResourceTencentCloudMonitorTmpExporterIntegrationV2(),
"tencentcloud_monitor_tmp_alert_rule": tmp.ResourceTencentCloudMonitorTmpAlertRule(),
"tencentcloud_monitor_tmp_recording_rule": tmp.ResourceTencentCloudMonitorTmpRecordingRule(),
"tencentcloud_monitor_tmp_multiple_writes": tmp.ResourceTencentCloudMonitorTmpMultipleWrites(),
Expand Down
1 change: 1 addition & 0 deletions tencentcloud/provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,7 @@ Resource
tencentcloud_monitor_tmp_instance
tencentcloud_monitor_tmp_alert_rule
tencentcloud_monitor_tmp_exporter_integration
tencentcloud_monitor_tmp_exporter_integration_v2
tencentcloud_monitor_tmp_cvm_agent
tencentcloud_monitor_tmp_scrape_job
tencentcloud_monitor_tmp_recording_rule
Expand Down
55 changes: 42 additions & 13 deletions tencentcloud/services/monitor/service_tencentcloud_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -544,14 +544,26 @@ func (me *MonitorService) DescribeMonitorTmpExporterIntegration(ctx context.Cont
}()

ids := strings.Split(tmpExporterIntegrationId, tccommon.FILED_SP)
if ids[0] != "" {
request.Name = &ids[0]
if len(ids) == 5 {
if ids[0] != "" {
request.Name = &ids[0]
}

request.InstanceId = &ids[1]
kubeType, _ := strconv.Atoi(ids[2])
request.KubeType = helper.IntInt64(kubeType)
request.ClusterId = &ids[3]
request.Kind = &ids[4]
} else if len(ids) == 3 {
if ids[0] != "" {
request.Name = &ids[0]
}

request.InstanceId = &ids[1]
request.Kind = &ids[2]
} else {
return nil, fmt.Errorf("id is broken, id is %s", tmpExporterIntegrationId)
}
request.InstanceId = &ids[1]
kubeType, _ := strconv.Atoi(ids[2])
request.KubeType = helper.IntInt64(kubeType)
request.ClusterId = &ids[3]
request.Kind = &ids[4]

response, err := me.client.UseMonitorClient().DescribeExporterIntegrations(request)
if err != nil {
Expand All @@ -560,12 +572,14 @@ func (me *MonitorService) DescribeMonitorTmpExporterIntegration(ctx context.Cont
errRet = err
return
}

log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n",
logId, request.GetAction(), request.ToJsonString(), response.ToJsonString())

if len(response.Response.IntegrationSet) < 1 {
return
}

tmpExporterIntegration = response.Response.IntegrationSet[0]
return
}
Expand All @@ -576,12 +590,26 @@ func (me *MonitorService) DeleteMonitorTmpExporterIntegrationById(ctx context.Co
request := monitor.NewDeleteExporterIntegrationRequest()
ids := strings.Split(tmpExporterIntegrationId, tccommon.FILED_SP)

request.Name = &ids[0]
request.InstanceId = &ids[1]
kubeType, _ := strconv.Atoi(ids[2])
request.KubeType = helper.IntInt64(kubeType)
request.ClusterId = &ids[3]
request.Kind = &ids[4]
if len(ids) == 5 {
if ids[0] != "" {
request.Name = &ids[0]
}

request.InstanceId = &ids[1]
kubeType, _ := strconv.Atoi(ids[2])
request.KubeType = helper.IntInt64(kubeType)
request.ClusterId = &ids[3]
request.Kind = &ids[4]
} else if len(ids) == 3 {
if ids[0] != "" {
request.Name = &ids[0]
}

request.InstanceId = &ids[1]
request.Kind = &ids[2]
} else {
return fmt.Errorf("id is broken, id is %s", tmpExporterIntegrationId)
}

defer func() {
if errRet != nil {
Expand All @@ -596,6 +624,7 @@ func (me *MonitorService) DeleteMonitorTmpExporterIntegrationById(ctx context.Co
errRet = err
return err
}

log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n",
logId, request.GetAction(), request.ToJsonString(), response.ToJsonString())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ import (

func ResourceTencentCloudMonitorTmpExporterIntegration() *schema.Resource {
return &schema.Resource{
Read: resourceTencentCloudMonitorTmpExporterIntegrationRead,
Create: resourceTencentCloudMonitorTmpExporterIntegrationCreate,
Update: resourceTencentCloudMonitorTmpExporterIntegrationUpdate,
Delete: resourceTencentCloudMonitorTmpExporterIntegrationDelete,
DeprecationMessage: "This resource has been deprecated in Terraform TencentCloud provider version 1.81.182. Please use 'tencentcloud_monitor_tmp_exporter_integration_v2' instead.",
Read: resourceTencentCloudMonitorTmpExporterIntegrationRead,
Create: resourceTencentCloudMonitorTmpExporterIntegrationCreate,
Update: resourceTencentCloudMonitorTmpExporterIntegrationUpdate,
Delete: resourceTencentCloudMonitorTmpExporterIntegrationDelete,
Schema: map[string]*schema.Schema{
"instance_id": {
Type: schema.TypeString,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Provides a resource to create a monitor tmpExporterIntegration

~> **NOTE:** This resource has been deprecated in Terraform TencentCloud provider version `1.81.182`. Please use `tencentcloud_monitor_tmp_exporter_integration_v2` instead.

~> **NOTE:** If you only want to upgrade the exporter version with same config, you can set `version` under `instanceSpec` with any value to trigger the change.

Example Usage
Expand Down
Loading
Loading