diff --git a/tencentcloud/resource_tc_kubernetes_node_pool.go b/tencentcloud/resource_tc_kubernetes_node_pool.go index 14d2fa67ac..aaae6f6cac 100644 --- a/tencentcloud/resource_tc_kubernetes_node_pool.go +++ b/tencentcloud/resource_tc_kubernetes_node_pool.go @@ -544,6 +544,16 @@ func ResourceTencentCloudKubernetesNodePool() *schema.Resource { Computed: true, Description: "The total node count.", }, + "autoscaling_added_total": { + Type: schema.TypeInt, + Computed: true, + Description: "The total of autoscaling added node.", + }, + "manually_added_total": { + Type: schema.TypeInt, + Computed: true, + Description: "The total of manually added node.", + }, "launch_config_id": { Type: schema.TypeString, Computed: true, @@ -927,7 +937,11 @@ func resourceKubernetesNodePoolRead(d *schema.ResourceData, meta interface{}) er _ = d.Set("name", nodePool.Name) _ = d.Set("status", nodePool.LifeState) - _ = d.Set("node_count", nodePool.NodeCountSummary) + AutoscalingAddedTotal := *nodePool.NodeCountSummary.AutoscalingAdded.Total + ManuallyAddedTotal := *nodePool.NodeCountSummary.ManuallyAdded.Total + _ = d.Set("autoscaling_added_total", AutoscalingAddedTotal) + _ = d.Set("manually_added_total", ManuallyAddedTotal) + _ = d.Set("node_count", AutoscalingAddedTotal+ManuallyAddedTotal) _ = d.Set("auto_scaling_group_id", nodePool.AutoscalingGroupId) _ = d.Set("launch_config_id", nodePool.LaunchConfigurationId) //set not force new parameters diff --git a/tencentcloud/resource_tc_kubernetes_node_pool_test.go b/tencentcloud/resource_tc_kubernetes_node_pool_test.go index 2c09355575..d4be9e286e 100644 --- a/tencentcloud/resource_tc_kubernetes_node_pool_test.go +++ b/tencentcloud/resource_tc_kubernetes_node_pool_test.go @@ -94,6 +94,9 @@ func TestAccTencentCloudTkeNodePoolResource(t *testing.T) { resource.TestCheckResourceAttr(testTkeClusterNodePoolResourceKey, "default_cooldown", "400"), resource.TestCheckResourceAttr(testTkeClusterNodePoolResourceKey, "termination_policies.#", "1"), resource.TestCheckResourceAttr(testTkeClusterNodePoolResourceKey, "termination_policies.0", "OLDEST_INSTANCE"), + resource.TestCheckResourceAttr(testTkeClusterNodePoolResourceKey, "node_count", "1"), + resource.TestCheckResourceAttr(testTkeClusterNodePoolResourceKey, "autoscaling_added_total", "1"), + resource.TestCheckResourceAttr(testTkeClusterNodePoolResourceKey, "manually_added_total", "0"), ), }, { @@ -270,6 +273,7 @@ resource "tencentcloud_kubernetes_node_pool" "np_test" { "root-dir=/var/lib/kubelet" ] } + node_os="Tencent tlinux release 2.2 (Final)" } ` diff --git a/website/docs/r/kubernetes_node_pool.html.markdown b/website/docs/r/kubernetes_node_pool.html.markdown index 0e5226075c..574e38986d 100644 --- a/website/docs/r/kubernetes_node_pool.html.markdown +++ b/website/docs/r/kubernetes_node_pool.html.markdown @@ -238,7 +238,9 @@ In addition to all arguments above, the following attributes are exported: * `id` - ID of the resource. * `auto_scaling_group_id` - The auto scaling group ID. +* `autoscaling_added_total` - The total of autoscaling added node. * `launch_config_id` - The launch config ID. +* `manually_added_total` - The total of manually added node. * `node_count` - The total node count. * `status` - Status of the node pool.