From 09c3a5a6a7a1842e9927575fcb8a32aaa5bb85bb Mon Sep 17 00:00:00 2001 From: yangshuai Date: Tue, 8 Sep 2020 14:31:42 +0800 Subject: [PATCH] Update cce node pool resource param --- .../resource_huaweicloud_cce_node_pool.go | 26 ++++++------------- ...resource_huaweicloud_cce_node_pool_test.go | 10 +++---- website/docs/r/cce_node_pool.html.md | 13 +++------- 3 files changed, 17 insertions(+), 32 deletions(-) diff --git a/huaweicloud/resource_huaweicloud_cce_node_pool.go b/huaweicloud/resource_huaweicloud_cce_node_pool.go index b223499f79..12cf86c321 100644 --- a/huaweicloud/resource_huaweicloud_cce_node_pool.go +++ b/huaweicloud/resource_huaweicloud_cce_node_pool.go @@ -43,11 +43,6 @@ func resourceCCENodePool() *schema.Resource { Required: true, ForceNew: true, }, - "availability_zone": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, "root_volume": { Type: schema.TypeList, Required: true, @@ -89,6 +84,12 @@ func resourceCCENodePool() *schema.Resource { }, }}, }, + "availability_zone": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Default: "random", + }, "os": { Type: schema.TypeString, Optional: true, @@ -127,20 +128,10 @@ func resourceCCENodePool() *schema.Resource { }, }}, }, - "bandwidth_charge_mode": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - }, "billing_mode": { Type: schema.TypeInt, Computed: true, }, - "extend_param_charging_mode": { - Type: schema.TypeInt, - Optional: true, - ForceNew: true, - }, "preinstall": { Type: schema.TypeString, Optional: true, @@ -249,9 +240,8 @@ func resourceCCENodePoolCreate(d *schema.ResourceData, meta interface{}) error { }, }, ExtendParam: nodes.ExtendParam{ - ChargingMode: d.Get("extend_param_charging_mode").(int), - PreInstall: base64PreInstall, - PostInstall: base64PostInstall, + PreInstall: base64PreInstall, + PostInstall: base64PostInstall, }, Taints: resourceCCETaint(d), }, diff --git a/huaweicloud/resource_huaweicloud_cce_node_pool_test.go b/huaweicloud/resource_huaweicloud_cce_node_pool_test.go index 78ef692486..c5c994fec1 100644 --- a/huaweicloud/resource_huaweicloud_cce_node_pool_test.go +++ b/huaweicloud/resource_huaweicloud_cce_node_pool_test.go @@ -18,7 +18,7 @@ func TestAccCCENodePool_basic(t *testing.T) { updateName := rName + "update" resourceName := "huaweicloud_cce_node_pool.test" //clusterName here is used to provide the cluster id to fetch cce node pool. - clusterName := "huaweicloud_cce_cluster_v3.test" + clusterName := "huaweicloud_cce_cluster.test" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -58,7 +58,7 @@ func testAccCheckCCENodePoolDestroy(s *terraform.State) error { var clusterId string for _, rs := range s.RootModule().Resources { - if rs.Type == "huaweicloud_cce_cluster_v3" { + if rs.Type == "huaweicloud_cce_cluster" { clusterId = rs.Primary.ID } @@ -125,7 +125,7 @@ resource "huaweicloud_compute_keypair_v2" "test" { public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAjpC1hwiOCCmKEWxJ4qzTTsJbKzndLo1BCz5PcwtUnflmU+gHJtWMZKpuEGVi29h0A/+ydKek1O18k10Ff+4tyFjiHDQAT9+OfgWf7+b1yK+qDip3X1C0UPMbwHlTfSGWLGZquwhvEFx9k3h/M+VtMvwR1lJ9LUyTAImnNjWG7TAIPmui30HvM2UiFEmqkr4ijq45MyX2+fLIePLRIFuu1p4whjHAQYufqyno3BS48icQb4p6iVEZPo4AE2o9oIyQvj2mx4dk5Y8CgSETOZTYDOR3rU2fZTRDRgPJDH9FWvQjF5tA0p3d9CoWWd2s6GKKbfoUIi8R/Db1BSPJwkqB jrp-hp-pc" } -resource "huaweicloud_cce_cluster_v3" "test" { +resource "huaweicloud_cce_cluster" "test" { name = "%s" cluster_type = "VirtualMachine" flavor_id = "cce.s1.small" @@ -141,7 +141,7 @@ func testAccCCENodePool_basic(rName string) string { %s resource "huaweicloud_cce_node_pool" "test" { - cluster_id = huaweicloud_cce_cluster_v3.test.id + cluster_id = huaweicloud_cce_cluster.test.id name = "%s" os = "EulerOS 2.5" flavor_id = "s6.large.2" @@ -171,7 +171,7 @@ func testAccCCENodePool_update(rName, updateName string) string { %s resource "huaweicloud_cce_node_pool" "test" { - cluster_id = huaweicloud_cce_cluster_v3.test.id + cluster_id = huaweicloud_cce_cluster.test.id name = "%s" os = "EulerOS 2.5" flavor_id = "s6.large.2" diff --git a/website/docs/r/cce_node_pool.html.md b/website/docs/r/cce_node_pool.html.md index dce06df604..55f7e228c8 100644 --- a/website/docs/r/cce_node_pool.html.md +++ b/website/docs/r/cce_node_pool.html.md @@ -25,7 +25,6 @@ resource "huaweicloud_cce_node_pool" "node_pool" { flavor_id = "s3.large.4" availability_zone = var.availability_zone key_pair = var.keypair - region = "cn-east-3" scall_enable = true min_node_count = 1 max_node_count = 10 @@ -54,11 +53,12 @@ The following arguments are supported: * `flavor_id` - (Required) Specifies the flavor id. Changing this parameter will create a new resource. -* `availability_zone` - (Required) specify the name of the available partition (AZ). Changing this parameter will create a new resource. +* `availability_zone` - (Optional) specify the name of the available partition (AZ). Default value is random + to create nodes in a random AZ in the node pool. + Changing this parameter will create a new resource. * `os` - (Optional) Operating System of the node. Changing this parameter will create a new resource. - - For VM nodes, clusters of v1.13 and later support *EulerOS 2.5* and *CentOS 7.6*. - - For BMS nodes purchased in the yearly/monthly billing mode, only *EulerOS 2.3* is supported. + - node pools only support VM nodes cluster, so the supported OS are EulerOS 2.5 and CentOS 7.6. * `key_pair` - (Optional) Key pair name when logging in to select the key pair mode. This parameter and `password` are alternative. Changing this parameter will create a new resource. @@ -68,11 +68,6 @@ The following arguments are supported: * `subnet_id` - (Optional) The ID of the subnet to which the NIC belongs. Changing this parameter will create a new resource. -* `bandwidth_charge_mode` - (Optional) Bandwidth billing type. Changing this parameter will create a new resource. - -* `extend_param_charging_mode` - (Optional) Billing mode of a node. Value 0 indicates pay-per-use. - Changing this parameter will create a new resource. - * `preinstall` - (Optional) Script required before installation. The input value can be a Base64 encoded string or not. Changing this parameter will create a new resource.