Skip to content

Commit

Permalink
Update cce node pool resource param
Browse files Browse the repository at this point in the history
  • Loading branch information
smilemusic committed Sep 8, 2020
1 parent 3719833 commit 09c3a5a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 32 deletions.
26 changes: 8 additions & 18 deletions huaweicloud/resource_huaweicloud_cce_node_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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),
},
Expand Down
10 changes: 5 additions & 5 deletions huaweicloud/resource_huaweicloud_cce_node_pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) },
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
13 changes: 4 additions & 9 deletions website/docs/r/cce_node_pool.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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.

Expand Down

0 comments on commit 09c3a5a

Please sign in to comment.