From 4d3620f8deb279b9266a8865b7f9db6fdae1af3f Mon Sep 17 00:00:00 2001 From: mikatong Date: Wed, 26 Jun 2024 15:39:16 +0800 Subject: [PATCH 1/3] fix launch failed prompt --- tencentcloud/services/cvm/resource_tc_instance.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tencentcloud/services/cvm/resource_tc_instance.go b/tencentcloud/services/cvm/resource_tc_instance.go index b2e8ff3e2f..0469b36203 100644 --- a/tencentcloud/services/cvm/resource_tc_instance.go +++ b/tencentcloud/services/cvm/resource_tc_instance.go @@ -697,7 +697,7 @@ func resourceTencentCloudInstanceCreate(d *schema.ResourceData, meta interface{} } if instance != nil && *instance.InstanceState == CVM_STATUS_LAUNCH_FAILED { //LatestOperationCodeMode - return resource.NonRetryableError(fmt.Errorf("cvm instance %s launch failed, this resource will not be stored to tfstate and will auto removed\n.", *instance.InstanceId)) + return resource.NonRetryableError(fmt.Errorf("cvm instance %s launch failed. There are insufficient resources. Please try again later, or you can go to another available area and try to purchase.\n.", *instance.InstanceId)) } if instance != nil && *instance.InstanceState == CVM_STATUS_RUNNING { return nil From ef94494c358b5e05ad7d90888e3b4487c18a90f5 Mon Sep 17 00:00:00 2001 From: mikatong Date: Fri, 28 Jun 2024 15:09:11 +0800 Subject: [PATCH 2/3] update --- tencentcloud/services/cvm/resource_tc_instance.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tencentcloud/services/cvm/resource_tc_instance.go b/tencentcloud/services/cvm/resource_tc_instance.go index 0469b36203..b88acb0245 100644 --- a/tencentcloud/services/cvm/resource_tc_instance.go +++ b/tencentcloud/services/cvm/resource_tc_instance.go @@ -697,7 +697,7 @@ func resourceTencentCloudInstanceCreate(d *schema.ResourceData, meta interface{} } if instance != nil && *instance.InstanceState == CVM_STATUS_LAUNCH_FAILED { //LatestOperationCodeMode - return resource.NonRetryableError(fmt.Errorf("cvm instance %s launch failed. There are insufficient resources. Please try again later, or you can go to another available area and try to purchase.\n.", *instance.InstanceId)) + return resource.NonRetryableError(fmt.Errorf("cvm instance %s launch failed. Error msg: %s.\n", *instance.InstanceId, *instance.LatestOperationErrorMsg)) } if instance != nil && *instance.InstanceState == CVM_STATUS_RUNNING { return nil From ce191c1162a45649732f03bfb99ea8af284a6758 Mon Sep 17 00:00:00 2001 From: mikatong Date: Mon, 1 Jul 2024 19:44:57 +0800 Subject: [PATCH 3/3] update --- tencentcloud/services/cvm/resource_tc_instance.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tencentcloud/services/cvm/resource_tc_instance.go b/tencentcloud/services/cvm/resource_tc_instance.go index b88acb0245..d772e7a26b 100644 --- a/tencentcloud/services/cvm/resource_tc_instance.go +++ b/tencentcloud/services/cvm/resource_tc_instance.go @@ -697,7 +697,10 @@ func resourceTencentCloudInstanceCreate(d *schema.ResourceData, meta interface{} } if instance != nil && *instance.InstanceState == CVM_STATUS_LAUNCH_FAILED { //LatestOperationCodeMode - return resource.NonRetryableError(fmt.Errorf("cvm instance %s launch failed. Error msg: %s.\n", *instance.InstanceId, *instance.LatestOperationErrorMsg)) + if instance.LatestOperationErrorMsg != nil { + return resource.NonRetryableError(fmt.Errorf("cvm instance %s launch failed. Error msg: %s.\n", *instance.InstanceId, *instance.LatestOperationErrorMsg)) + } + return resource.NonRetryableError(fmt.Errorf("cvm instance %s launch failed, this resource will not be stored to tfstate and will auto removed\n.", *instance.InstanceId)) } if instance != nil && *instance.InstanceState == CVM_STATUS_RUNNING { return nil