From 19bd1044f4dbe05cda3b4efc0a358fa411410fa2 Mon Sep 17 00:00:00 2001 From: Zhenguo Niu Date: Mon, 13 Jul 2020 09:42:49 +0000 Subject: [PATCH] Add eip_id argument to cce_node This adds eip_id argument to cce_node and deprecates eip_ids. --- .../resource_huaweicloud_cce_node_v3.go | 21 ++++++++++++++----- .../resource_huaweicloud_cce_node_v3_test.go | 2 +- website/docs/r/cce_node_v3.html.md | 7 ++++--- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/huaweicloud/resource_huaweicloud_cce_node_v3.go b/huaweicloud/resource_huaweicloud_cce_node_v3.go index 99c586715a..eae7d9e0ce 100644 --- a/huaweicloud/resource_huaweicloud_cce_node_v3.go +++ b/huaweicloud/resource_huaweicloud_cce_node_v3.go @@ -124,11 +124,19 @@ func resourceCCENodeV3() *schema.Resource { }}, }, "eip_ids": { - Type: schema.TypeSet, - Optional: true, - ForceNew: true, - Elem: &schema.Schema{Type: schema.TypeString}, - Set: schema.HashString, + Type: schema.TypeSet, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: schema.HashString, + ConflictsWith: []string{"eip_id"}, + Deprecated: "use eip_id instead", + }, + "eip_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ConflictsWith: []string{"eip_ids"}, }, "eip_count": { Type: schema.TypeInt, @@ -280,6 +288,9 @@ func resourceCCERootVolume(d *schema.ResourceData) nodes.VolumeSpec { return nics } func resourceCCEEipIDs(d *schema.ResourceData) []string { + if v, ok := d.GetOk("eip_id"); ok { + return []string{v.(string)} + } rawID := d.Get("eip_ids").(*schema.Set) id := make([]string, rawID.Len()) for i, raw := range rawID.List() { diff --git a/huaweicloud/resource_huaweicloud_cce_node_v3_test.go b/huaweicloud/resource_huaweicloud_cce_node_v3_test.go index aabcb21422..059c86b931 100644 --- a/huaweicloud/resource_huaweicloud_cce_node_v3_test.go +++ b/huaweicloud/resource_huaweicloud_cce_node_v3_test.go @@ -253,7 +253,7 @@ resource "huaweicloud_cce_node_v3" "test" { } // Assign existing EIP - eip_ids = [huaweicloud_vpc_eip_v1.test.id] + eip_id = huaweicloud_vpc_eip_v1.test.id } `, testAccCCENodeV3_Base(rName), rName) } diff --git a/website/docs/r/cce_node_v3.html.md b/website/docs/r/cce_node_v3.html.md index 819679c4a2..e7fbb3b056 100644 --- a/website/docs/r/cce_node_v3.html.md +++ b/website/docs/r/cce_node_v3.html.md @@ -6,7 +6,6 @@ description: |- Add a node to a container cluster. --- - # huaweicloud_cce_node_v3 Add a node to a container cluster. @@ -61,10 +60,12 @@ 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. -* `eip_ids` - (Optional) List of existing elastic IP IDs. Changing this parameter will create a new resource. +* `eip_id` - (Optional) The ID of the EIP. Changing this parameter will create a new resource. + +* `eip_ids` - (Deprecated) This has been deprecated, use eip_id instead. List of existing elastic IP IDs. Changing this parameter will create a new resource. **Note:** -If the eip_ids parameter is configured, you do not need to configure the bandwidth parameters: iptype, bandwidth_charge_mode, bandwidth_size and share_type. +If the eip_id parameter is configured, you do not need to configure the bandwidth parameters: iptype, bandwidth_charge_mode, bandwidth_size and share_type. * `iptype` - (Optional) Elastic IP type. Default is 5_bgp. Changing this parameter will create a new resource.