Skip to content

Commit 9a54f7b

Browse files
committed
Merge branch 'master' into feat/add-mongodb-instance-cpu-param
2 parents 57e59cf + af0637a commit 9a54f7b

46 files changed

Lines changed: 5550 additions & 1433 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changelog/4252.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_mongodb_sharding_instance: support add_node_list and remove_node_list parameters for dynamic node topology management
3+
```

.changelog/4261.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_teo_bind_security_template: replace read API with DescribeWebSecurityTemplates and add unit tests
3+
```

.changelog/4326.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_cls_cloud_product_log_task_v2: update doc
3+
```

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ require (
4646
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.3.105
4747
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.1033
4848
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.3.131
49-
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.3.133
49+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.3.141
5050
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/config v1.3.80
5151
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.3.130
5252
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cwp v1.3.30
@@ -69,7 +69,7 @@ require (
6969
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/lighthouse v1.3.108
7070
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/live v1.3.95
7171
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mariadb v1.3.102
72-
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mongodb v1.3.133
72+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mongodb v1.3.141
7373
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/monitor v1.3.101
7474
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mps v1.3.45
7575
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/organization v1.3.110
@@ -87,7 +87,7 @@ require (
8787
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sts v1.1.11
8888
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tag v1.0.860
8989
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tat v1.0.634
90-
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcaplusdb v1.0.199
90+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcaplusdb v1.3.105
9191
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcm v1.0.547
9292
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcr v1.3.89
9393
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tdcpg v1.0.533

go.sum

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -994,6 +994,7 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.3.110/go.mod
994994
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.3.112/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
995995
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.3.113/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
996996
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.3.115/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
997+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.3.116/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
997998
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.3.118/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
998999
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.3.121/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
9991000
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.3.122/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
@@ -1006,6 +1007,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.3.131/go.mod
10061007
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.3.132/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
10071008
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.3.133 h1:EKJsaGHbifEKqWCdJ4tJNLxbJ5h/Pm3CaLKzcCS/pkw=
10081009
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.3.133/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
1010+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.3.141 h1:NFHY8OVmV9yF521cyoVn8OPYIjYO/i9f+nUPkTSqGi8=
1011+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.3.141/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
10091012
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/config v1.3.80 h1:chnsNBeJn3MieFLki4hpbzoml5NiTvLVzOTqYRVxQho=
10101013
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/config v1.3.80/go.mod h1:B/ezGtlvDhZlleNM+2QdvZccrUi+J+fN6vMnDDsZnuM=
10111014
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter v1.1.51 h1:pGwrfCBBCt1u+EDHwfNj9NLQpvk5MVKVMcsE7SvwqM4=
@@ -1065,8 +1068,12 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/live v1.3.95 h1:rWiKud6
10651068
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/live v1.3.95/go.mod h1:uDGk0Bi0diOd1VaQPnfZO0MLKPKjqIT4Hi0sdanwD9s=
10661069
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mariadb v1.3.102 h1:I4QaWjVMOfuEsmxjTS8BxYgLcgdATWIAGutcHDnIvB4=
10671070
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mariadb v1.3.102/go.mod h1:Thfxer0Xf7Oq//ceL5i5nObFEXyQkUxzLHVNFh3p7jw=
1071+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mongodb v1.3.116 h1:fjoLwVyh1yMgiW2FJaEGICwvzeNuUZExvoZDWcIJ9Hc=
1072+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mongodb v1.3.116/go.mod h1:k2QPGbSnicTJ456ccBfJ5qZ4hVHckQEWhqmA+h2+6nY=
10681073
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mongodb v1.3.133 h1:J/x518dKdFwHa7KatmCWNw7/daJuf7yw+1bov8Du3d0=
10691074
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mongodb v1.3.133/go.mod h1:MloftTaY0U0CNcDc2PkbNw7pGwE089AadY4tJ1bc5hM=
1075+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mongodb v1.3.141 h1:cvvgcdt3CweSsAIbw3MsrdPEOCdHv1nFYdOs3skBRnk=
1076+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mongodb v1.3.141/go.mod h1:BXuG+T2d/4j+1oodFmEHBm6OCd4GR+N1ENNbD4cFUvo=
10701077
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/monitor v1.3.101 h1:r8PjkCuXrztjLyBROWTww0RJUq+a+l5ybPLl6GGlov8=
10711078
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/monitor v1.3.101/go.mod h1:+cX4PEEehIIbyHy9plpXOTShlFWtc9OC1AWcmOrOMT8=
10721079
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mps v1.3.45 h1:35PD/GXaOl3QhL1fI5a3Q+jcenzR1PqfuGxltOeO48w=
@@ -1107,8 +1114,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tag v1.0.860 h1:epSPxNq
11071114
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tag v1.0.860/go.mod h1:6hzZuAz+UAG4nWudMqk+6hHwRWXZrFrpP8P7yEsEqY0=
11081115
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tat v1.0.634 h1:GJDzXxKloZeM8fN+qlIspPnZbUw1lOZGe7jGqfFbQMM=
11091116
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tat v1.0.634/go.mod h1:yX1elLeYvjmtPvgBVCOyYxyy1u2XEKfXaEiZXIWRCKw=
1110-
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcaplusdb v1.0.199 h1:i17zUWDw6iN7EMkQMGDXIXpur73vwUvbZrX4M5S0xhQ=
1111-
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcaplusdb v1.0.199/go.mod h1:PUgbrkzA9IaKBj1urk+W4L6Jr5TuBhQ4xB/96QvLf/U=
1117+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcaplusdb v1.3.105 h1:6OndfnRdCLh3OTKvLaRA9OTOZbmsyB3uO8r4Hi8H/X4=
1118+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcaplusdb v1.3.105/go.mod h1:FR3HD44YAbGbfiDbMUA5IHxSk9j8MZ2Wdl8zKf/Z8rw=
11121119
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcm v1.0.547 h1:6bukohygmfu4riewOMCuYYZSkg3vTad8PCjpGyWD0Gs=
11131120
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcm v1.0.547/go.mod h1:C7b++Lr8Xh+2KtTUMBjbb+/BrBhfFhAxDMjXzT2GLhY=
11141121
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcr v1.3.89 h1:GXI1UyC8GVPYOPDtsAzefG1Mc6L738UOblk0CB92ztE=
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
schema: spec-driven
2+
created: 2026-06-25
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
## Context
2+
3+
The `tencentcloud_mongodb_sharding_instance` resource manages MongoDB sharding instances through the `ModifyDBInstanceSpec` API. The vendor SDK (`v20190725`) already supports `AddNodeList` and `RemoveNodeList` fields in the `ModifyDBInstanceSpecRequest` struct. The service layer (`MongodbService.UpgradeInstance`) already has handling code for these params via the `params map[string]interface{}` argument. The only missing piece is exposing these parameters in the Terraform resource schema and wiring them through the update function.
4+
5+
## Goals / Non-Goals
6+
7+
**Goals:**
8+
- Add `add_node_list` (TypeList) and `remove_node_list` (TypeList) as Optional schema fields
9+
- Wire these parameters to the existing `UpgradeInstance` service call in the update path
10+
- Both fields are Optional and preserve full backward compatibility
11+
12+
**Non-Goals:**
13+
- No changes to Create, Read, or Delete paths
14+
- No new API calls or service methods
15+
- No modification to the `UpgradeInstance` service method (it already handles these params)
16+
17+
## Decisions
18+
19+
1. **Schema field structure**: `add_node_list` uses `TypeList` with `MaxItems: 1` containing sub-fields `role` (Required, string) and `zone` (Required, string). `remove_node_list` uses `TypeList` with sub-fields `role` (Required, string), `node_name` (Required, string), and `zone` (Required, string). This mirrors the SDK struct layout exactly.
20+
21+
2. **Update trigger**: When `d.HasChange("add_node_list") || d.HasChange("remove_node_list")`, call the existing `UpgradeInstance` service method with these params in the `params` map. The `UpgradeInstance` method already handles constructing `AddNodeList` and `RemoveNodeList` from params.
22+
23+
3. **No state management in Read**: The `add_node_list` and `remove_node_list` parameters represent node addition/removal operations (not persistent state). They are not set back in the Read function. This follows the pattern of action-oriented parameters that drive changes but don't represent current state.
24+
25+
## Risks / Trade-offs
26+
27+
- **Risk**: After successful node addition/removal, the `d.SetId("")` won't be triggered but `add_node_list`/`remove_node_list` values remain in the Terraform config, causing a perpetual diff on next plan. → **Mitigation**: These fields should be documented as operational parameters that users should remove from config after the operation completes, or we can optionally clear them after successful execution.
28+
- **Risk**: Adding/removing nodes is a long-running async operation that could timeout. → **Mitigation**: The `UpgradeInstance` service method already handles this via `DescribeDBInstanceDeal` polling with retry logic.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## Why
2+
3+
The `tencentcloud_mongodb_sharding_instance` resource currently uses `ModifyDBInstanceSpec` API for scaling memory/volume, but does not expose `AddNodeList` and `RemoveNodeList` parameters that allow users to dynamically add or remove nodes (Mongod nodes, read-only nodes, Mongos nodes) from a sharding instance. This prevents Terraform users from managing node topology changes declaratively.
4+
5+
## What Changes
6+
7+
- Add `add_node_list` parameter (TypeList) to `tencentcloud_mongodb_sharding_instance` resource, supporting the following sub-fields:
8+
- `role` (TypeString, Required): Node role to add - `SECONDARY`, `READONLY`, or `MONGOS`
9+
- `zone` (TypeString, Required): Availability zone for the new node
10+
- Add `remove_node_list` parameter (TypeList) to `tencentcloud_mongodb_sharding_instance` resource, supporting the following sub-fields:
11+
- `role` (TypeString, Required): Node role to remove - `SECONDARY`, `READONLY`, or `MONGOS`
12+
- `node_name` (TypeString, Required): Node ID to remove (e.g., `cmgo-xxxx_0-node-readonly0`)
13+
- Wire these parameters through the existing `ModifyDBInstanceSpec` API call in the update path
14+
15+
## Capabilities
16+
17+
### New Capabilities
18+
- `mongodb-sharding-node-list-management`: Ability to add and remove nodes (Mongod, read-only, Mongos) from a MongoDB sharding instance via `add_node_list` and `remove_node_list` parameters in the `ModifyDBInstanceSpec` API.
19+
20+
### Modified Capabilities
21+
<!-- None - this is purely additive, no existing capability requirements change -->
22+
23+
## Impact
24+
25+
- **Code**: `tencentcloud/services/mongodb/resource_tc_mongodb_sharding_instance.go` - Add schema definitions and wire parameters in the update function
26+
- **Code**: `tencentcloud/services/mongodb/resource_tc_mongodb_sharding_instance_test.go` - Add test cases for new parameters
27+
- **Docs**: `tencentcloud/services/mongodb/resource_tc_mongodb_sharding_instance.md` - Add example and parameter documentation
28+
- **API**: Uses existing `ModifyDBInstanceSpec` API (already available in vendor SDK `v20190725`)
29+
- **Backward Compatibility**: Fully backward compatible - both new fields are Optional
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## ADDED Requirements
2+
3+
### Requirement: User can add nodes to a MongoDB sharding instance
4+
The `tencentcloud_mongodb_sharding_instance` resource SHALL expose an `add_node_list` parameter that allows users to add nodes (SECONDARY, READONLY, or MONGOS) to an existing sharding instance via the `ModifyDBInstanceSpec` API.
5+
6+
#### Scenario: Add a read-only node
7+
- **WHEN** user specifies `add_node_list` with `role = "READONLY"` and `zone = "ap-guangzhou-2"`
8+
- **THEN** the provider calls `ModifyDBInstanceSpec` with `AddNodeList` containing the specified role and zone, and waits for the operation to complete
9+
10+
#### Scenario: Add multiple node types
11+
- **WHEN** user specifies `add_node_list` with multiple entries (e.g., one SECONDARY and one READONLY)
12+
- **THEN** the provider calls `ModifyDBInstanceSpec` with `AddNodeList` containing all specified nodes
13+
14+
### Requirement: User can remove nodes from a MongoDB sharding instance
15+
The `tencentcloud_mongodb_sharding_instance` resource SHALL expose a `remove_node_list` parameter that allows users to remove nodes from an existing sharding instance via the `ModifyDBInstanceSpec` API.
16+
17+
#### Scenario: Remove a read-only node by node name
18+
- **WHEN** user specifies `remove_node_list` with `role = "READONLY"`, `node_name = "cmgo-xxxx_0-node-readonly0"`, and `zone = "ap-guangzhou-2"`
19+
- **THEN** the provider calls `ModifyDBInstanceSpec` with `RemoveNodeList` containing the specified role, node name, and zone, and waits for the operation to complete
20+
21+
### Requirement: Backward compatibility
22+
The `add_node_list` and `remove_node_list` parameters SHALL both be Optional. Existing Terraform configurations that do not use these parameters SHALL continue to work without any changes.
23+
24+
#### Scenario: Existing configuration without new parameters
25+
- **WHEN** user applies an existing `tencentcloud_mongodb_sharding_instance` configuration that does not include `add_node_list` or `remove_node_list`
26+
- **THEN** the provider behaves identically to before this change, with no diff or modification
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
## 1. Schema Definition
2+
3+
- [x] 1.1 Add `add_node_list` TypeList schema field with sub-fields `role` (Required, TypeString) and `zone` (Required, TypeString) to `ResourceTencentCloudMongodbShardingInstance`
4+
- [x] 1.2 Add `remove_node_list` TypeList schema field with sub-fields `role` (Required, TypeString), `node_name` (Required, TypeString), and `zone` (Required, TypeString) to `ResourceTencentCloudMongodbShardingInstance`
5+
6+
## 2. Update Function Wiring
7+
8+
- [x] 2.1 Add change detection for `add_node_list` and `remove_node_list` in `resourceMongodbShardingInstanceUpdate`
9+
- [x] 2.2 Pass `add_node_list` and `remove_node_list` to the existing `UpgradeInstance` service call via the `params` map
10+
11+
## 3. Documentation
12+
13+
- [x] 3.1 Update `resource_tc_mongodb_sharding_instance.md` with example usage of `add_node_list` and `remove_node_list`
14+
15+
## 4. Validation
16+
17+
- [x] 4.1 Verify the code compiles correctly
18+
- [x] 4.2 Review all generated code for correctness and consistency with existing patterns

0 commit comments

Comments
 (0)