Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Terraform Version
Terraform v1.10.4
provider registry.terraform.io/tencentcloudstack/tencentcloud v1.83.11
Affected Resource(s)
tencentcloud_dts_sync_job
Terraform Configuration Files
resource "tencentcloud_dts_sync_job" "example" {
pay_mode = "PostPay"
src_database_type = "postgresql"
src_region = "ap-singapore"
dst_database_type = "postgresql"
dst_region = "ap-singapore"
instance_class = "medium"
}
Debug Output
N/A
Panic Output
N/A
Expected Behavior
terraform destroy on a running DTS sync job should internally pause the job first, wait for Paused state, isolate it, then destroy — without requiring manual intervention.
When a sync job is deleted outside Terraform, terraform plan should silently remove the stale state entry instead of failing.
Actual Behavior
Issue 1 — Destroy fails on running job:
terraform destroy immediately calls IsolateSyncJobs regardless of the job's current status. Tencent rejects this when the job is actively syncing:
UnsupportedOperation.UnsupportedOperationError: Current job is temporarily unable to respond to isolation events
This makes it impossible to destroy the resource through Terraform while the job is running — which is the normal production state.
Issue 2 — Plan breaks after out-of-band deletion:
When a sync job is deleted outside Terraform, every subsequent terraform plan fails with:
Error: resource syncJob sync-xxx does not exist
The Read function calls d.SetId("") correctly but then returns fmt.Errorf(...) instead of nil, so Terraform errors rather than removing the stale entry from state.
Steps to Reproduce
Issue 1:
Create a tencentcloud_dts_sync_job with an actively running sync job.
Remove the resource from Terraform configuration.
Run terraform apply.
Observe: UnsupportedOperation.UnsupportedOperationError — destroy fails.
Issue 2:
Create and apply a tencentcloud_dts_sync_job.
Delete the sync job manually via the Tencent Cloud Console.
Run terraform plan.
Observe: plan fails with resource syncJob sync-xxx does not exist instead of removing the resource from state.
Important Factoids
The required destroy sequence for a DTS sync job is: pause → wait for Paused → isolate → wait for Isolated → destroy. The provider currently skips the pause step and calls isolate directly.
The fix involves:
Adding a PauseDtsSyncJobById helper to service_tencentcloud_dts.go
Checking job status in the Delete function and pausing before isolating if the job is running
Returning nil instead of fmt.Errorf in the Read function after d.SetId("")
References
Fix implemented in: https://github.com/Rajendraladkat1919/terraform-provider-tencentcloud/tree/fix/dts-sync-job-delete-lifecycle
Community Note
Terraform Version
Terraform v1.10.4
provider registry.terraform.io/tencentcloudstack/tencentcloud v1.83.11
Affected Resource(s)
tencentcloud_dts_sync_jobTerraform Configuration Files