66 "strings"
77 "testing"
88
9+ sdkErrors "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors"
10+
911 "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
1012 "github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
1113)
@@ -23,11 +25,11 @@ func TestAccTencentCloudTdmqSubscriptionAttachmentResource_basic(t *testing.T) {
2325 {
2426 Config : testAccTdmqSubscriptionAttachment ,
2527 Check : resource .ComposeTestCheckFunc (
26- resource .TestCheckResourceAttrSet ("tencentcloud_tdmq_subscription_attachment.subscription_attachment " , "id" ),
28+ resource .TestCheckResourceAttrSet ("tencentcloud_tdmq_subscription_attachment.example " , "id" ),
2729 ),
2830 },
2931 {
30- ResourceName : "tencentcloud_tdmq_subscription_attachment.subscription_attachment " ,
32+ ResourceName : "tencentcloud_tdmq_subscription_attachment.example " ,
3133 ImportState : true ,
3234 ImportStateVerify : true ,
3335 },
@@ -58,6 +60,11 @@ func testAccCheckTdmqSubscriptionAttachmentDestroy(s *terraform.State) error {
5860 response , err := service .DescribeTdmqSubscriptionAttachmentById (ctx , environmentId , Topic , subscriptionName , clusterId )
5961
6062 if err != nil {
63+ if sdkerr , ok := err .(* sdkErrors.TencentCloudSDKError ); ok {
64+ if sdkerr .Code == "ResourceNotFound.Cluster" {
65+ return nil
66+ }
67+ }
6168 return err
6269 }
6370
@@ -93,7 +100,7 @@ resource "tencentcloud_tdmq_topic" "example" {
93100 environ_id = tencentcloud_tdmq_namespace.example.environ_name
94101 cluster_id = tencentcloud_tdmq_instance.example.id
95102 topic_name = "tf-example-topic"
96- partitions = 6
103+ partitions = 1
97104 pulsar_topic_type = 3
98105 remark = "remark."
99106}
0 commit comments