Skip to content

Commit 1e73ddc

Browse files
authored
fix(tdmq): [128888409] tencentcloud_tdmq_rabbitmq_vip_instance update doc (#3619)
* add * add
1 parent fd82107 commit 1e73ddc

File tree

4 files changed

+59
-29
lines changed

4 files changed

+59
-29
lines changed

.changelog/3619.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/tencentcloud_tdmq_rabbitmq_vip_instance: update doc
3+
```

tencentcloud/services/tdmq/service_tencentcloud_tdmq.go

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1672,6 +1672,7 @@ func (me *TdmqService) DescribeTdmqRabbitmqVipInstanceById(ctx context.Context,
16721672
logId := tccommon.GetLogId(ctx)
16731673

16741674
request := tdmq.NewDescribeRabbitMQVipInstanceRequest()
1675+
response := tdmq.NewDescribeRabbitMQVipInstanceResponse()
16751676
request.ClusterId = &instanceId
16761677

16771678
defer func() {
@@ -1680,17 +1681,30 @@ func (me *TdmqService) DescribeTdmqRabbitmqVipInstanceById(ctx context.Context,
16801681
}
16811682
}()
16821683

1683-
ratelimit.Check(request.GetAction())
16841684
var iacExtInfo connectivity.IacExtInfo
16851685
iacExtInfo.InstanceId = instanceId
1686-
response, err := me.client.UseTdmqClient(iacExtInfo).DescribeRabbitMQVipInstance(request)
1686+
err := resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError {
1687+
ratelimit.Check(request.GetAction())
1688+
result, e := me.client.UseTdmqClient(iacExtInfo).DescribeRabbitMQVipInstance(request)
1689+
if e != nil {
1690+
return tccommon.RetryError(e)
1691+
} else {
1692+
log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), response.ToJsonString())
1693+
}
1694+
1695+
if result == nil || result.Response == nil {
1696+
return resource.NonRetryableError(fmt.Errorf("Describe rabbitmq vip instance failed, Response is nil."))
1697+
}
1698+
1699+
response = result
1700+
return nil
1701+
})
1702+
16871703
if err != nil {
16881704
errRet = err
16891705
return
16901706
}
16911707

1692-
log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), response.ToJsonString())
1693-
16941708
rabbitmqVipInstance = response.Response
16951709
return
16961710
}
@@ -1709,16 +1723,23 @@ func (me *TdmqService) DeleteTdmqRabbitmqVipInstanceById(ctx context.Context, in
17091723
}
17101724
}()
17111725

1712-
ratelimit.Check(request.GetAction())
1726+
err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError {
1727+
ratelimit.Check(request.GetAction())
1728+
result, e := me.client.UseTdmqClient().DeleteRabbitMQVipInstance(request)
1729+
if e != nil {
1730+
return tccommon.RetryError(e)
1731+
} else {
1732+
log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString())
1733+
}
1734+
1735+
return nil
1736+
})
17131737

1714-
response, err := me.client.UseTdmqClient().DeleteRabbitMQVipInstance(request)
17151738
if err != nil {
17161739
errRet = err
17171740
return
17181741
}
17191742

1720-
log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), response.ToJsonString())
1721-
17221743
return
17231744
}
17241745

tencentcloud/services/trabbit/resource_tc_tdmq_rabbitmq_vip_instance.go

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func ResourceTencentCloudTdmqRabbitmqVipInstance() *schema.Resource {
8686
Optional: true,
8787
Type: schema.TypeString,
8888
Computed: true,
89-
Description: "Cluster version, the default is `3.8.30`, valid values: `3.8.30` and `3.11.8`.",
89+
Description: "Cluster version, the default is `3.8.30`, valid values: `3.8.30`, `3.11.8` and `3.13.7`.",
9090
},
9191
"public_access_endpoint": {
9292
Type: schema.TypeString,
@@ -199,6 +199,10 @@ func resourceTencentCloudTdmqRabbitmqVipInstanceCreate(d *schema.ResourceData, m
199199
log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString())
200200
}
201201

202+
if result == nil || result.Response == nil {
203+
return resource.NonRetryableError(fmt.Errorf("Create tdmq rabbitmqVipInstance failed, Response is nil."))
204+
}
205+
202206
response = result
203207
return nil
204208
})
@@ -208,7 +212,12 @@ func resourceTencentCloudTdmqRabbitmqVipInstanceCreate(d *schema.ResourceData, m
208212
return err
209213
}
210214

215+
if response.Response.InstanceId == nil {
216+
return fmt.Errorf("InstanceId is nil.")
217+
}
218+
211219
instanceId = *response.Response.InstanceId
220+
d.SetId(instanceId)
212221

213222
// wait
214223
paramMap := make(map[string]interface{})
@@ -246,8 +255,6 @@ func resourceTencentCloudTdmqRabbitmqVipInstanceCreate(d *schema.ResourceData, m
246255
return err
247256
}
248257

249-
d.SetId(instanceId)
250-
251258
return resourceTencentCloudTdmqRabbitmqVipInstanceRead(d, meta)
252259
}
253260

@@ -268,8 +275,8 @@ func resourceTencentCloudTdmqRabbitmqVipInstanceRead(d *schema.ResourceData, met
268275
}
269276

270277
if rabbitmqVipInstance == nil {
278+
log.Printf("[WARN]%s resource `tencentcloud_tdmq_rabbitmq_vip_instance` [%s] not found, please check if it has been deleted.\n", logId, d.Id())
271279
d.SetId("")
272-
log.Printf("[WARN]%s resource `TdmqRabbitmqVipInstance` [%s] not found, please check if it has been deleted.\n", logId, d.Id())
273280
return nil
274281
}
275282

@@ -356,8 +363,8 @@ func resourceTencentCloudTdmqRabbitmqVipInstanceRead(d *schema.ResourceData, met
356363
})
357364

358365
if err != nil {
359-
d.SetId("")
360366
log.Printf("[WARN]%s resource `TdmqRabbitmqVipInstance` [%s] not found, please check if it has been deleted.\n", logId, d.Id())
367+
d.SetId("")
361368
return nil
362369
}
363370

@@ -386,28 +393,27 @@ func resourceTencentCloudTdmqRabbitmqVipInstanceUpdate(d *schema.ResourceData, m
386393
}
387394
}
388395

389-
request.InstanceId = &instanceId
390-
391396
if d.HasChange("cluster_name") {
392397
if v, ok := d.GetOk("cluster_name"); ok {
393398
request.ClusterName = helper.String(v.(string))
394399
}
395-
}
396400

397-
err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError {
398-
result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseTdmqClient().ModifyRabbitMQVipInstance(request)
399-
if e != nil {
400-
return tccommon.RetryError(e)
401-
} else {
402-
log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString())
403-
}
401+
request.InstanceId = &instanceId
402+
err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError {
403+
result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseTdmqClient().ModifyRabbitMQVipInstance(request)
404+
if e != nil {
405+
return tccommon.RetryError(e)
406+
} else {
407+
log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString())
408+
}
404409

405-
return nil
406-
})
410+
return nil
411+
})
407412

408-
if err != nil {
409-
log.Printf("[CRITAL]%s update tdmq rabbitmqVipInstance failed, reason:%+v", logId, err)
410-
return err
413+
if err != nil {
414+
log.Printf("[CRITAL]%s update tdmq rabbitmqVipInstance failed, reason:%+v", logId, err)
415+
return err
416+
}
411417
}
412418

413419
return resourceTencentCloudTdmqRabbitmqVipInstanceRead(d, meta)

website/docs/r/tdmq_rabbitmq_vip_instance.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ The following arguments are supported:
7373
* `vpc_id` - (Required, String) Private network VpcId.
7474
* `zone_ids` - (Required, Set: [`Int`]) availability zone.
7575
* `auto_renew_flag` - (Optional, Bool) Automatic renewal, the default is true.
76-
* `cluster_version` - (Optional, String) Cluster version, the default is `3.8.30`, valid values: `3.8.30` and `3.11.8`.
76+
* `cluster_version` - (Optional, String) Cluster version, the default is `3.8.30`, valid values: `3.8.30`, `3.11.8` and `3.13.7`.
7777
* `enable_create_default_ha_mirror_queue` - (Optional, Bool) Mirrored queue, the default is false.
7878
* `node_num` - (Optional, Int) The number of nodes, a minimum of 3 nodes for a multi-availability zone. If not passed, the default single availability zone is 1, and the multi-availability zone is 3.
7979
* `node_spec` - (Optional, String) Node specifications. Valid values: rabbit-vip-basic-5 (for 2C4G), rabbit-vip-profession-2c8g (for 2C8G), rabbit-vip-basic-1 (for 4C8G), rabbit-vip-profession-4c16g (for 4C16G), rabbit-vip-basic-2 (for 8C16G), rabbit-vip-profession-8c32g (for 8C32G), rabbit-vip-basic-4 (for 16C32G), rabbit-vip-profession-16c64g (for 16C64G). The default is rabbit-vip-basic-1. NOTE: The above specifications may be sold out or removed from the shelves.

0 commit comments

Comments
 (0)