From 1733508c361f8d6c632e574c545814e4e7aa41be Mon Sep 17 00:00:00 2001 From: ShiChangkuo Date: Thu, 1 Apr 2021 15:34:05 +0800 Subject: [PATCH 1/2] support prePaid charging mode for cce cluster --- docs/resources/cce_cluster.md | 16 ++ go.mod | 2 +- go.sum | 2 + .../resource_huaweicloud_cce_cluster_v3.go | 222 +++++++++++++----- .../autoscaling/v1/groups/requests.go | 2 + .../autoscaling/v1/groups/results.go | 1 + .../openstack/cce/v3/clusters/results.go | 2 +- .../openstack/cce/v3/nodepools/requests.go | 2 +- .../openstack/cce/v3/nodes/results.go | 7 + .../networking/v1/subnets/results.go | 3 + .../openstack/sfs_turbo/v1/shares/results.go | 2 + vendor/modules.txt | 2 +- 12 files changed, 196 insertions(+), 67 deletions(-) diff --git a/docs/resources/cce_cluster.md b/docs/resources/cce_cluster.md index 10f3dc9c7b..e9eadaa6c0 100644 --- a/docs/resources/cce_cluster.md +++ b/docs/resources/cce_cluster.md @@ -160,6 +160,22 @@ The following arguments are supported: * `extend_param` - (Optional, Map, ForceNew) Extended parameter. Changing this parameter will create a new cluster resource. +* `charging_mode` - (Optional, String, ForceNew) Specifies the charging mode of the CCE cluster. + Valid values are *prePaid* and *postPaid*, defaults to *postPaid*. + Changing this creates a new cluster. + +* `period_unit` - (Optional, String, ForceNew) Specifies the charging period unit of the CCE cluster. + Valid values are *month* and *year*. This parameter is mandatory if `charging_mode` is set to *prePaid*. + Changing this creates a new cluster. + +* `period` - (Optional, Int, ForceNew) Specifies the charging period of the CCE cluster. + If `period_unit` is set to *month*, the value ranges from 1 to 9. + If `period_unit` is set to *year*, the value ranges from 1 to 3. + This parameter is mandatory if `charging_mode` is set to *prePaid*. Changing this creates a new cluster. + +* `auto_renew` - (Optional, String, ForceNew) Specifies whether auto renew is enabled. + Valid values are "true" and "false". Changing this creates a new cluster. + * `enterprise_project_id` - (Optional, String, ForceNew) The enterprise project id of the cce cluster. Changing this creates a new cluster. diff --git a/go.mod b/go.mod index 6e3a8c224c..49fb61b8e1 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.14 require ( github.com/hashicorp/errwrap v1.0.0 github.com/hashicorp/terraform-plugin-sdk v1.16.0 - github.com/huaweicloud/golangsdk v0.0.0-20210329082007-ee3a1fd6c542 + github.com/huaweicloud/golangsdk v0.0.0-20210401071036-b8be64ba4002 github.com/jen20/awspolicyequivalence v1.1.0 github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa // indirect github.com/stretchr/testify v1.4.0 diff --git a/go.sum b/go.sum index 9661196324..8e4d5783e9 100644 --- a/go.sum +++ b/go.sum @@ -229,6 +229,8 @@ github.com/huaweicloud/golangsdk v0.0.0-20210323020602-6d5ee0030244 h1:Jzq3828aW github.com/huaweicloud/golangsdk v0.0.0-20210323020602-6d5ee0030244/go.mod h1:fcOI5u+0f62JtJd7zkCch/Z57BNC6bhqb32TKuiF4r0= github.com/huaweicloud/golangsdk v0.0.0-20210329082007-ee3a1fd6c542 h1:rA1o0dd7F2cR/zBe9Fyk7DjjgSv85MM6PdToMabNXq4= github.com/huaweicloud/golangsdk v0.0.0-20210329082007-ee3a1fd6c542/go.mod h1:fcOI5u+0f62JtJd7zkCch/Z57BNC6bhqb32TKuiF4r0= +github.com/huaweicloud/golangsdk v0.0.0-20210401071036-b8be64ba4002 h1:RxtuAdoAiJI9bScWcXf09sVDAEjP0w4X8zIe5e4pljU= +github.com/huaweicloud/golangsdk v0.0.0-20210401071036-b8be64ba4002/go.mod h1:fcOI5u+0f62JtJd7zkCch/Z57BNC6bhqb32TKuiF4r0= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.9 h1:UauaLniWCFHWd+Jp9oCEkTBj8VO/9DKg3PV3VCNMDIg= github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= diff --git a/huaweicloud/resource_huaweicloud_cce_cluster_v3.go b/huaweicloud/resource_huaweicloud_cce_cluster_v3.go index f0cbc64e48..0efa97b969 100644 --- a/huaweicloud/resource_huaweicloud_cce_cluster_v3.go +++ b/huaweicloud/resource_huaweicloud_cce_cluster_v3.go @@ -12,6 +12,7 @@ import ( "github.com/huaweicloud/golangsdk" "github.com/huaweicloud/golangsdk/openstack/aom/v1/icagents" "github.com/huaweicloud/golangsdk/openstack/cce/v3/clusters" + "github.com/huaweicloud/golangsdk/openstack/cce/v3/nodes" ) var associateDeleteSchema *schema.Schema = &schema.Schema{ @@ -52,18 +53,6 @@ func ResourceCCEClusterV3() *schema.Resource { Required: true, ForceNew: true, }, - "labels": { - Type: schema.TypeMap, - Optional: true, - ForceNew: true, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "annotations": { - Type: schema.TypeMap, - Optional: true, - ForceNew: true, - Elem: &schema.Schema{Type: schema.TypeString}, - }, "flavor_id": { Type: schema.TypeString, Required: true, @@ -86,11 +75,17 @@ func ResourceCCEClusterV3() *schema.Resource { Optional: true, Computed: true, }, - "billing_mode": { - Type: schema.TypeInt, + "labels": { + Type: schema.TypeMap, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "annotations": { + Type: schema.TypeMap, Optional: true, - Computed: true, ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, }, "vpc_id": { Type: schema.TypeString, @@ -108,12 +103,6 @@ func ResourceCCEClusterV3() *schema.Resource { Computed: true, ForceNew: true, }, - "extend_param": { - Type: schema.TypeMap, - Optional: true, - ForceNew: true, - Elem: &schema.Schema{Type: schema.TypeString}, - }, "container_network_type": { Type: schema.TypeString, Required: true, @@ -197,6 +186,19 @@ func ResourceCCEClusterV3() *schema.Resource { ForceNew: true, Computed: true, }, + "extend_param": { + Type: schema.TypeMap, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + // charge info: charging_mode, period_unit, period, auto_renew + "charging_mode": schemeChargingMode(nil), + "period_unit": schemaPeriodUnit(nil), + "period": schemaPeriod(nil), + "auto_renew": schemaAutoRenew(nil), + "delete_efs": associateDeleteSchema, "delete_eni": associateDeleteSchema, "delete_evs": associateDeleteSchema, @@ -259,6 +261,15 @@ func ResourceCCEClusterV3() *schema.Resource { }, }, }, + + // Deprecated + "billing_mode": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ForceNew: true, + Deprecated: "use charging_mode instead", + }, }, } } @@ -277,27 +288,54 @@ func resourceClusterAnnotationsV3(d *schema.ResourceData) map[string]string { } return m } -func resourceClusterExtendParamV3(d *schema.ResourceData, config *Config) map[string]string { - m := make(map[string]string) - for key, val := range d.Get("extend_param").(map[string]interface{}) { - m[key] = val.(string) +func resourceClusterExtendParamV3(d *schema.ResourceData, config *Config) map[string]interface{} { + extendParam := make(map[string]interface{}) + if v, ok := d.GetOk("extend_param"); ok { + for key, val := range v.(map[string]interface{}) { + extendParam[key] = val.(string) + } + } + + // assemble the charge info + var isPrePaid bool + var billingMode int + if v, ok := d.GetOk("charging_mode"); ok && v.(string) == "prePaid" { + isPrePaid = true + } + if v, ok := d.GetOk("billing_mode"); ok { + billingMode = v.(int) + } + if isPrePaid || billingMode == 1 { + extendParam["isAutoPay"] = "true" + extendParam["isAutoRenew"] = "false" } + + if v, ok := d.GetOk("period_unit"); ok { + extendParam["periodType"] = v.(string) + } + if v, ok := d.GetOk("period"); ok { + extendParam["periodNum"] = v.(int) + } + if v, ok := d.GetOk("auto_renew"); ok { + extendParam["isAutoRenew"] = v.(string) + } + if multi_az, ok := d.GetOk("multi_az"); ok && multi_az == true { - m["clusterAZ"] = "multi_az" + extendParam["clusterAZ"] = "multi_az" } if kube_proxy_mode, ok := d.GetOk("kube_proxy_mode"); ok { - m["kubeProxyMode"] = kube_proxy_mode.(string) + extendParam["kubeProxyMode"] = kube_proxy_mode.(string) } if eip, ok := d.GetOk("eip"); ok { - m["clusterExternalIP"] = eip.(string) + extendParam["clusterExternalIP"] = eip.(string) } epsID := GetEnterpriseProjectID(d, config) - if epsID != "" { - m["enterpriseProjectId"] = epsID + extendParam["enterpriseProjectId"] = epsID } - return m + + return extendParam } func resourceClusterMastersV3(d *schema.ResourceData) ([]clusters.MasterSpec, error) { @@ -328,19 +366,33 @@ func resourceClusterMastersV3(d *schema.ResourceData) ([]clusters.MasterSpec, er func resourceCCEClusterV3Create(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) cceClient, err := config.CceV3Client(GetRegion(d, config)) - if err != nil { return fmt.Errorf("Unable to create HuaweiCloud CCE client : %s", err) } + icAgentClient, err := config.AomV1Client(GetRegion(d, config)) + if err != nil { + return fmt.Errorf("Unable to create HuaweiCloud AOM client : %s", err) + } authenticating_proxy := make(map[string]string) if hasFilledOpt(d, "authenticating_proxy_ca") { authenticating_proxy["ca"] = d.Get("authenticating_proxy_ca").(string) } + + billingMode := 0 + if d.Get("charging_mode").(string) == "prePaid" || d.Get("billing_mode").(int) == 1 { + billingMode = 1 + if err := validatePrePaidChargeInfo(d); err != nil { + return err + } + } + + clusterName := d.Get("name").(string) createOpts := clusters.CreateOpts{ Kind: "Cluster", ApiVersion: "v3", - Metadata: clusters.CreateMetaData{Name: d.Get("name").(string), + Metadata: clusters.CreateMetaData{ + Name: clusterName, Labels: resourceClusterLabelsV3(d), Annotations: resourceClusterAnnotationsV3(d)}, Spec: clusters.Spec{ @@ -361,7 +413,7 @@ func resourceCCEClusterV3Create(d *schema.ResourceData, meta interface{}) error Mode: d.Get("authentication_mode").(string), AuthenticatingProxy: authenticating_proxy, }, - BillingMode: d.Get("billing_mode").(int), + BillingMode: billingMode, ExtendParam: resourceClusterExtendParamV3(d, config), KubernetesSvcIPRange: d.Get("service_network_cidr").(string), }, @@ -381,18 +433,27 @@ func resourceCCEClusterV3Create(d *schema.ResourceData, meta interface{}) error } createOpts.Spec.Masters = masters - create, err := clusters.Create(cceClient, createOpts).Extract() - + s, err := clusters.Create(cceClient, createOpts).Extract() if err != nil { return fmt.Errorf("Error creating HuaweiCloud Cluster: %s", err) } - log.Printf("[DEBUG] Waiting for HuaweiCloud CCE cluster (%s) to become available", create.Metadata.Id) + jobID := s.Status.JobID + if jobID == "" { + return fmt.Errorf("Error fetching job id after creating cce cluster: %s", clusterName) + } + clusterID, err := getCCEClusterIDFromJob(cceClient, jobID) + if err != nil { + return err + } + d.SetId(clusterID) + + log.Printf("[DEBUG] Waiting for HuaweiCloud CCE cluster (%s) to become available", clusterID) stateConf := &resource.StateChangeConf{ Pending: []string{"Creating"}, Target: []string{"Available"}, - Refresh: waitForCCEClusterActive(cceClient, create.Metadata.Id), + Refresh: waitForCCEClusterActive(cceClient, clusterID), Timeout: d.Timeout(schema.TimeoutCreate), Delay: 150 * time.Second, PollInterval: 20 * time.Second, @@ -402,21 +463,18 @@ func resourceCCEClusterV3Create(d *schema.ResourceData, meta interface{}) error if err != nil { return fmt.Errorf("Error creating HuaweiCloud CCE cluster: %s", err) } - d.SetId(create.Metadata.Id) - - icAgentClient, err := config.AomV1Client(GetRegion(d, config)) + log.Printf("[DEBUG] installing ICAgent for CCE cluster (%s)", d.Id()) installParam := icagents.InstallParam{ ClusterId: d.Id(), NameSpace: "default", } - result := icagents.Create(icAgentClient, installParam) if result.Err != nil { - log.Printf("Error installing ci agent in CCE cluster: %s", result.Err) + log.Printf("Error installing ICAgent in CCE cluster: %s", result.Err) } - return resourceCCEClusterV3Read(d, meta) + return resourceCCEClusterV3Read(d, meta) } func resourceCCEClusterV3Read(d *schema.ResourceData, meta interface{}) error { @@ -442,7 +500,6 @@ func resourceCCEClusterV3Read(d *schema.ResourceData, meta interface{}) error { d.Set("cluster_version", n.Spec.Version) d.Set("cluster_type", n.Spec.Type) d.Set("description", n.Spec.Description) - d.Set("billing_mode", n.Spec.BillingMode) d.Set("vpc_id", n.Spec.HostNetwork.VpcId) d.Set("subnet_id", n.Spec.HostNetwork.SubnetId) d.Set("highway_subnet_id", n.Spec.HostNetwork.HighwaySubnet) @@ -455,6 +512,10 @@ func resourceCCEClusterV3Read(d *schema.ResourceData, meta interface{}) error { d.Set("region", GetRegion(d, config)) d.Set("enterprise_project_id", n.Spec.ExtendParam["enterpriseProjectId"]) d.Set("service_network_cidr", n.Spec.KubernetesSvcIPRange) + d.Set("billing_mode", n.Spec.BillingMode) + if n.Spec.BillingMode != 0 { + d.Set("charging_mode", "prePaid") + } r := clusters.GetCert(cceClient, d.Id()) @@ -533,26 +594,35 @@ func resourceCCEClusterV3Delete(d *schema.ResourceData, meta interface{}) error if err != nil { return fmt.Errorf("Error creating HuaweiCloud CCE Client: %s", err) } - deleteOpts := clusters.DeleteOpts{} - if v, ok := d.GetOk("delete_all"); ok && v.(bool) { - deleteOpts.DeleteEfs = "true" - deleteOpts.DeleteENI = "true" - deleteOpts.DeleteEvs = "true" - deleteOpts.DeleteNet = "true" - deleteOpts.DeleteObs = "true" - deleteOpts.DeleteSfs = "true" + + // for prePaid mode, we should unsubscribe the resource + if d.Get("charging_mode").(string) == "prePaid" || d.Get("billing_mode").(int) == 1 { + if err := UnsubscribePrePaidResource(d, config, []string{d.Id()}); err != nil { + return fmt.Errorf("Error unsubscribing HuaweiCloud CCE cluster: %s", err) + } } else { - deleteOpts.DeleteEfs = d.Get("delete_efs").(string) - deleteOpts.DeleteENI = d.Get("delete_eni").(string) - deleteOpts.DeleteEvs = d.Get("delete_evs").(string) - deleteOpts.DeleteNet = d.Get("delete_net").(string) - deleteOpts.DeleteObs = d.Get("delete_obs").(string) - deleteOpts.DeleteSfs = d.Get("delete_sfs").(string) - } - err = clusters.DeleteWithOpts(cceClient, d.Id(), deleteOpts).ExtractErr() - if err != nil { - return fmt.Errorf("Error deleting HuaweiCloud CCE Cluster: %s", err) + deleteOpts := clusters.DeleteOpts{} + if v, ok := d.GetOk("delete_all"); ok && v.(bool) { + deleteOpts.DeleteEfs = "true" + deleteOpts.DeleteENI = "true" + deleteOpts.DeleteEvs = "true" + deleteOpts.DeleteNet = "true" + deleteOpts.DeleteObs = "true" + deleteOpts.DeleteSfs = "true" + } else { + deleteOpts.DeleteEfs = d.Get("delete_efs").(string) + deleteOpts.DeleteENI = d.Get("delete_eni").(string) + deleteOpts.DeleteEvs = d.Get("delete_evs").(string) + deleteOpts.DeleteNet = d.Get("delete_net").(string) + deleteOpts.DeleteObs = d.Get("delete_obs").(string) + deleteOpts.DeleteSfs = d.Get("delete_sfs").(string) + } + err = clusters.DeleteWithOpts(cceClient, d.Id(), deleteOpts).ExtractErr() + if err != nil { + return fmt.Errorf("Error deleting HuaweiCloud CCE Cluster: %s", err) + } } + stateConf := &resource.StateChangeConf{ Pending: []string{"Deleting", "Available", "Unavailable"}, Target: []string{"Deleted"}, @@ -602,3 +672,29 @@ func waitForCCEClusterDelete(cceClient *golangsdk.ServiceClient, clusterId strin return r, "Available", nil } } + +func getCCEClusterIDFromJob(client *golangsdk.ServiceClient, jobID string) (string, error) { + // waiting for 30 seconds to avoid 401 response code + time.Sleep(30 * time.Second) + + stateJob := &resource.StateChangeConf{ + Pending: []string{"Initializing"}, + Target: []string{"Running"}, + Refresh: waitForJobStatus(client, jobID), + Timeout: 5 * time.Minute, + Delay: 5 * time.Second, + PollInterval: 3 * time.Second, + } + + v, err := stateJob.WaitForState() + if err != nil { + return "", fmt.Errorf("Error waiting for job (%s) to become running: %s", jobID, err) + } + + job := v.(*nodes.Job) + clusterID := job.Spec.ClusterID + if clusterID == "" { + return "", fmt.Errorf("Error fetching CCE cluster id") + } + return clusterID, nil +} diff --git a/vendor/github.com/huaweicloud/golangsdk/openstack/autoscaling/v1/groups/requests.go b/vendor/github.com/huaweicloud/golangsdk/openstack/autoscaling/v1/groups/requests.go index 27d9aba8e0..f34746879d 100644 --- a/vendor/github.com/huaweicloud/golangsdk/openstack/autoscaling/v1/groups/requests.go +++ b/vendor/github.com/huaweicloud/golangsdk/openstack/autoscaling/v1/groups/requests.go @@ -30,6 +30,7 @@ type CreateOpts struct { InstanceTerminatePolicy string `json:"instance_terminate_policy,omitempty"` Notifications []string `json:"notifications,omitempty"` IsDeletePublicip bool `json:"delete_publicip,omitempty"` + EnterpriseProjectID string `json:"enterprise_project_id,omitempty"` } type NetworkOpts struct { @@ -130,6 +131,7 @@ type UpdateOpts struct { Notifications []string `json:"notifications,omitempty"` IsDeletePublicip bool `json:"delete_publicip,omitempty"` ConfigurationID string `json:"scaling_configuration_id,omitempty"` + EnterpriseProjectID string `json:"enterprise_project_id,omitempty"` } func (opts UpdateOpts) ToGroupUpdateMap() (map[string]interface{}, error) { diff --git a/vendor/github.com/huaweicloud/golangsdk/openstack/autoscaling/v1/groups/results.go b/vendor/github.com/huaweicloud/golangsdk/openstack/autoscaling/v1/groups/results.go index 091fb90297..4d482c5717 100644 --- a/vendor/github.com/huaweicloud/golangsdk/openstack/autoscaling/v1/groups/results.go +++ b/vendor/github.com/huaweicloud/golangsdk/openstack/autoscaling/v1/groups/results.go @@ -64,6 +64,7 @@ type Group struct { Notifications []string `json:"notifications"` DeletePublicip bool `json:"delete_publicip"` CloudLocationID string `json:"cloud_location_id"` + EnterpriseProjectID string `json:"enterprise_project_id"` } type Network struct { diff --git a/vendor/github.com/huaweicloud/golangsdk/openstack/cce/v3/clusters/results.go b/vendor/github.com/huaweicloud/golangsdk/openstack/cce/v3/clusters/results.go index bd95070de7..bf63c340fd 100644 --- a/vendor/github.com/huaweicloud/golangsdk/openstack/cce/v3/clusters/results.go +++ b/vendor/github.com/huaweicloud/golangsdk/openstack/cce/v3/clusters/results.go @@ -63,7 +63,7 @@ type Spec struct { // Charging mode of the cluster, which is 0 (on demand) BillingMode int `json:"billingMode,omitempty"` //Extended parameter for a cluster - ExtendParam map[string]string `json:"extendParam,omitempty"` + ExtendParam map[string]interface{} `json:"extendParam,omitempty"` //Advanced configuration of master node Masters []MasterSpec `json:"masters,omitempty"` //Range of kubernetes clusterIp diff --git a/vendor/github.com/huaweicloud/golangsdk/openstack/cce/v3/nodepools/requests.go b/vendor/github.com/huaweicloud/golangsdk/openstack/cce/v3/nodepools/requests.go index 8ff594aa7e..0d68467a77 100644 --- a/vendor/github.com/huaweicloud/golangsdk/openstack/cce/v3/nodepools/requests.go +++ b/vendor/github.com/huaweicloud/golangsdk/openstack/cce/v3/nodepools/requests.go @@ -181,7 +181,7 @@ type UpdateMetaData struct { // UpdateSpec describes Node pools update specification type UpdateSpec struct { // Node type. Currently, only VM nodes are supported. - Type string `json:"type"` + Type string `json:"type,omitempty"` // Node template NodeTemplate nodes.Spec `json:"nodeTemplate"` // Initial number of expected nodes diff --git a/vendor/github.com/huaweicloud/golangsdk/openstack/cce/v3/nodes/results.go b/vendor/github.com/huaweicloud/golangsdk/openstack/cce/v3/nodes/results.go index 5a4667a0d5..63010ce063 100644 --- a/vendor/github.com/huaweicloud/golangsdk/openstack/cce/v3/nodes/results.go +++ b/vendor/github.com/huaweicloud/golangsdk/openstack/cce/v3/nodes/results.go @@ -73,6 +73,8 @@ type Spec struct { UserTags []tags.ResourceTag `json:"userTags,omitempty"` // Tag of a Kubernetes node, key value pair format K8sTags map[string]string `json:"k8sTags,omitempty"` + // The runtime spec + RunTime *RunTimeSpec `json:"runtime,omitempty"` // taints to created nodes to configure anti-affinity Taints []TaintSpec `json:"taints,omitempty"` } @@ -158,6 +160,11 @@ type EipSpec struct { Bandwidth BandwidthOpts `json:"bandwidth,omitempty"` } +type RunTimeSpec struct { + // the name of runtime: docker or containerd + Name string `json:"name,omitempty"` +} + type BandwidthOpts struct { ChargeMode string `json:"chargemode,omitempty"` Size int `json:"size,omitempty"` diff --git a/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v1/subnets/results.go b/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v1/subnets/results.go index 733678d4be..0a9af5441f 100644 --- a/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v1/subnets/results.go +++ b/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v1/subnets/results.go @@ -52,6 +52,9 @@ type Subnet struct { //Specifies the subnet ID. SubnetId string `json:"neutron_subnet_id"` + //Specifies the subnet ID of the IPv6 subnet. + IPv6SubnetId string `json:"neutron_subnet_id_v6"` + //Specifies the extra dhcp opts. ExtraDhcpOpts []ExtraDhcp `json:"extra_dhcp_opts"` } diff --git a/vendor/github.com/huaweicloud/golangsdk/openstack/sfs_turbo/v1/shares/results.go b/vendor/github.com/huaweicloud/golangsdk/openstack/sfs_turbo/v1/shares/results.go index a429af2d98..d4113885e8 100644 --- a/vendor/github.com/huaweicloud/golangsdk/openstack/sfs_turbo/v1/shares/results.go +++ b/vendor/github.com/huaweicloud/golangsdk/openstack/sfs_turbo/v1/shares/results.go @@ -59,6 +59,8 @@ type Turbo struct { PayModel string `json:"pay_model"` // Timestamp when the share was created CreatedAt time.Time `json:"-"` + // The enterprise project ID + EnterpriseProjectId string `json:"enterprise_project_id"` } func (r *Turbo) UnmarshalJSON(b []byte) error { diff --git a/vendor/modules.txt b/vendor/modules.txt index 584302a513..3b40e2306b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -257,7 +257,7 @@ github.com/hashicorp/terraform-svchost/auth github.com/hashicorp/terraform-svchost/disco # github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d github.com/hashicorp/yamux -# github.com/huaweicloud/golangsdk v0.0.0-20210329082007-ee3a1fd6c542 +# github.com/huaweicloud/golangsdk v0.0.0-20210401071036-b8be64ba4002 ## explicit github.com/huaweicloud/golangsdk github.com/huaweicloud/golangsdk/internal From dbb80914e3d9554d6d260d0df3b9736a5e4546de Mon Sep 17 00:00:00 2001 From: ShiChangkuo Date: Thu, 1 Apr 2021 15:55:27 +0800 Subject: [PATCH 2/2] fix tfprovider lint issue --- .../resource_huaweicloud_cce_cluster_v3.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/huaweicloud/resource_huaweicloud_cce_cluster_v3.go b/huaweicloud/resource_huaweicloud_cce_cluster_v3.go index 0efa97b969..13e666dc89 100644 --- a/huaweicloud/resource_huaweicloud_cce_cluster_v3.go +++ b/huaweicloud/resource_huaweicloud_cce_cluster_v3.go @@ -674,16 +674,14 @@ func waitForCCEClusterDelete(cceClient *golangsdk.ServiceClient, clusterId strin } func getCCEClusterIDFromJob(client *golangsdk.ServiceClient, jobID string) (string, error) { - // waiting for 30 seconds to avoid 401 response code - time.Sleep(30 * time.Second) - stateJob := &resource.StateChangeConf{ - Pending: []string{"Initializing"}, - Target: []string{"Running"}, - Refresh: waitForJobStatus(client, jobID), - Timeout: 5 * time.Minute, - Delay: 5 * time.Second, - PollInterval: 3 * time.Second, + Pending: []string{"Initializing"}, + Target: []string{"Running"}, + Refresh: waitForJobStatus(client, jobID), + Timeout: 5 * time.Minute, + // waiting for 35 seconds to avoid 401 response code + Delay: 35 * time.Second, + PollInterval: 5 * time.Second, } v, err := stateJob.WaitForState()