diff --git a/ovh/resource_cloud_project_kube_nodepool.go b/ovh/resource_cloud_project_kube_nodepool.go index a506265fe..6f941fd90 100644 --- a/ovh/resource_cloud_project_kube_nodepool.go +++ b/ovh/resource_cloud_project_kube_nodepool.go @@ -154,7 +154,7 @@ func resourceCloudProjectKubeNodePool() *schema.Resource { Schema: map[string]*schema.Schema{ "metadata": { Description: "metadata", - Optional: true, + Required: true, Type: schema.TypeSet, MaxItems: 1, Set: CustomSchemaSetFunc(), @@ -162,20 +162,20 @@ func resourceCloudProjectKubeNodePool() *schema.Resource { Schema: map[string]*schema.Schema{ "finalizers": { Description: "finalizers", - Optional: true, + Required: true, Type: schema.TypeList, Elem: &schema.Schema{Type: schema.TypeString}, }, "labels": { Description: "labels", - Optional: true, + Required: true, Type: schema.TypeMap, Elem: &schema.Schema{Type: schema.TypeString}, Set: schema.HashString, }, "annotations": { Description: "annotations", - Optional: true, + Required: true, Type: schema.TypeMap, Elem: &schema.Schema{Type: schema.TypeString}, Set: schema.HashString, @@ -185,7 +185,7 @@ func resourceCloudProjectKubeNodePool() *schema.Resource { }, "spec": { Description: "spec", - Optional: true, + Required: true, Type: schema.TypeSet, MaxItems: 1, Set: CustomSchemaSetFunc(), @@ -193,12 +193,12 @@ func resourceCloudProjectKubeNodePool() *schema.Resource { Schema: map[string]*schema.Schema{ "unschedulable": { Description: "unschedulable", - Optional: true, + Required: true, Type: schema.TypeBool, }, "taints": { Description: "taints", - Optional: true, + Required: true, Type: schema.TypeList, Elem: &schema.Schema{ Type: schema.TypeMap, @@ -259,8 +259,8 @@ func resourceCloudProjectKubeNodePoolCreate(d *schema.ResourceData, meta interfa return err } - log.Printf("[DEBUG] Waiting for nodepool %s to be READY", res.Id) - err = waitForCloudProjectKubeNodePoolReady(config.OVHClient, serviceName, kubeId, res.Id, d.Timeout(schema.TimeoutCreate)) + log.Printf("[DEBUG] Waiting for nodepool %s to be READY or ERROR", res.Id) + err = waitForCloudProjectKubeNodePoolWithStateTarget(config.OVHClient, serviceName, kubeId, res.Id, d.Timeout(schema.TimeoutCreate), []string{"READY", "ERROR"}) if err != nil { return fmt.Errorf("timeout while waiting nodepool %s to be READY: %w", res.Id, err) } @@ -314,7 +314,7 @@ func resourceCloudProjectKubeNodePoolUpdate(d *schema.ResourceData, meta interfa } log.Printf("[DEBUG] Waiting for nodepool %s to be READY", d.Id()) - err = waitForCloudProjectKubeNodePoolReady(config.OVHClient, serviceName, kubeId, d.Id(), d.Timeout(schema.TimeoutUpdate)) + err = waitForCloudProjectKubeNodePoolWithStateTarget(config.OVHClient, serviceName, kubeId, d.Id(), d.Timeout(schema.TimeoutUpdate), []string{"READY"}) if err != nil { return fmt.Errorf("timeout while waiting nodepool %s to be READY: %w", d.Id(), err) } @@ -355,10 +355,10 @@ func cloudProjectKubeNodePoolExists(serviceName, kubeId, id string, client *ovh. return client.Get(endpoint, res) } -func waitForCloudProjectKubeNodePoolReady(client *ovh.Client, serviceName, kubeId, id string, timeout time.Duration) error { +func waitForCloudProjectKubeNodePoolWithStateTarget(client *ovh.Client, serviceName, kubeId, id string, timeout time.Duration, stateTargets []string) error { stateConf := &resource.StateChangeConf{ Pending: []string{"INSTALLING", "UPDATING", "REDEPLOYING", "RESIZING", "DOWNSCALING", "UPSCALING"}, - Target: []string{"READY"}, + Target: stateTargets, Refresh: func() (interface{}, string, error) { res := &CloudProjectKubeNodePoolResponse{} endpoint := fmt.Sprintf("/cloud/project/%s/kube/%s/nodepool/%s", serviceName, kubeId, id) diff --git a/ovh/resource_cloud_project_kube_nodepool_test.go b/ovh/resource_cloud_project_kube_nodepool_test.go index e58b66e0c..5c063e964 100644 --- a/ovh/resource_cloud_project_kube_nodepool_test.go +++ b/ovh/resource_cloud_project_kube_nodepool_test.go @@ -75,100 +75,113 @@ func testSweepCloudProjectKubeNodePool(region string) error { var testAccCloudProjectKubeNodePoolConfig = ` resource "ovh_cloud_project_kube" "cluster" { - service_name = "%s" - name = "%s" - region = "%s" - version = "%s" + service_name = "%s" + name = "%s" + region = "%s" + version = "%s" } resource "ovh_cloud_project_kube_nodepool" "pool" { - service_name = ovh_cloud_project_kube.cluster.service_name - kube_id = ovh_cloud_project_kube.cluster.id - name = ovh_cloud_project_kube.cluster.name - flavor_name = "b2-7" - desired_nodes = 1 - min_nodes = 0 - max_nodes = 1 - template { - metadata { - annotations = { - a1 = "av1" - } - finalizers = ["finalizer.extensions/v1beta1"] - labels = { - l1 = "lv1" - } - } - spec { - unschedulable = false - taints = [ - { - effect = "PreferNoSchedule" - key = "t1" - value = "tv1" - } - ] - } - } + service_name = ovh_cloud_project_kube.cluster.service_name + kube_id = ovh_cloud_project_kube.cluster.id + name = ovh_cloud_project_kube.cluster.name + flavor_name = "b2-7" + desired_nodes = 1 + min_nodes = 0 + max_nodes = 1 + template { + metadata { + annotations = { + a1 = "av1" + } + finalizers = ["finalizer.extensions/v1beta1"] + labels = { + l1 = "lv1" + } + } + spec { + unschedulable = false + taints = [ + { + effect = "PreferNoSchedule" + key = "t1" + value = "tv1" + } + ] + } + } } + ` var testAccCloudProjectKubeNodePoolConfigUpdated = ` resource "ovh_cloud_project_kube" "cluster" { - service_name = "%s" - name = "%s" - region = "%s" - version = "%s" + service_name = "%s" + name = "%s" + region = "%s" + version = "%s" } resource "ovh_cloud_project_kube_nodepool" "pool" { - service_name = ovh_cloud_project_kube.cluster.service_name - kube_id = ovh_cloud_project_kube.cluster.id - name = ovh_cloud_project_kube.cluster.name - flavor_name = "b2-7" - desired_nodes = 2 - min_nodes = 0 - max_nodes = 2 - template { - metadata { - annotations = { - a2 = "av2" - } - labels = { - l2 = "lv2" - } - } - } + service_name = ovh_cloud_project_kube.cluster.service_name + kube_id = ovh_cloud_project_kube.cluster.id + name = ovh_cloud_project_kube.cluster.name + flavor_name = "b2-7" + desired_nodes = 2 + min_nodes = 0 + max_nodes = 2 + template { + metadata { + annotations = { + a2 = "av2" + } + finalizers = [] + labels = { + l2 = "lv2" + } + } + spec { + unschedulable = false + taints = [] + } + } } + ` var testAccCloudProjectKubeNodePoolConfigUpdatedScaleToZero = ` resource "ovh_cloud_project_kube" "cluster" { - service_name = "%s" - name = "%s" - region = "%s" - version = "%s" + service_name = "%s" + name = "%s" + region = "%s" + version = "%s" } resource "ovh_cloud_project_kube_nodepool" "pool" { - service_name = ovh_cloud_project_kube.cluster.service_name - kube_id = ovh_cloud_project_kube.cluster.id - name = ovh_cloud_project_kube.cluster.name - flavor_name = "b2-7" - desired_nodes = 0 - min_nodes = 0 - max_nodes = 2 - template { - metadata { - annotations = { - a2 = "av2" - } - labels = { - l2 = "lv2" - } - } - } + service_name = ovh_cloud_project_kube.cluster.service_name + kube_id = ovh_cloud_project_kube.cluster.id + name = ovh_cloud_project_kube.cluster.name + flavor_name = "b2-7" + desired_nodes = 0 + min_nodes = 0 + max_nodes = 2 + template { + metadata { + annotations = { + a2 = "av2" + } + finalizers = [] + labels = { + l2 = "lv2" + } + } + spec { + unschedulable = false + taints = [] + } + } } + ` func TestAccCloudProjectKubeNodePool(t *testing.T) { @@ -218,9 +231,11 @@ func TestAccCloudProjectKubeNodePool(t *testing.T) { resource.TestCheckResourceAttr("ovh_cloud_project_kube_nodepool.pool", "desired_nodes", "1"), resource.TestCheckResourceAttr("ovh_cloud_project_kube_nodepool.pool", "min_nodes", "0"), resource.TestCheckResourceAttr("ovh_cloud_project_kube_nodepool.pool", "max_nodes", "1"), + resource.TestCheckResourceAttr("ovh_cloud_project_kube_nodepool.pool", "template.0.metadata.0.annotations.a1", "av1"), resource.TestCheckResourceAttr("ovh_cloud_project_kube_nodepool.pool", "template.0.metadata.0.finalizers.0", "finalizer.extensions/v1beta1"), resource.TestCheckResourceAttr("ovh_cloud_project_kube_nodepool.pool", "template.0.metadata.0.labels.l1", "lv1"), + resource.TestCheckResourceAttr("ovh_cloud_project_kube_nodepool.pool", "template.0.spec.0.taints.0.effect", "PreferNoSchedule"), resource.TestCheckResourceAttr("ovh_cloud_project_kube_nodepool.pool", "template.0.spec.0.taints.0.key", "t1"), resource.TestCheckResourceAttr("ovh_cloud_project_kube_nodepool.pool", "template.0.spec.0.taints.0.value", "tv1"), @@ -239,10 +254,13 @@ func TestAccCloudProjectKubeNodePool(t *testing.T) { resource.TestCheckResourceAttr("ovh_cloud_project_kube_nodepool.pool", "desired_nodes", "2"), resource.TestCheckResourceAttr("ovh_cloud_project_kube_nodepool.pool", "min_nodes", "0"), resource.TestCheckResourceAttr("ovh_cloud_project_kube_nodepool.pool", "max_nodes", "2"), + resource.TestCheckResourceAttr("ovh_cloud_project_kube_nodepool.pool", "template.0.metadata.0.annotations.a2", "av2"), resource.TestCheckResourceAttr("ovh_cloud_project_kube_nodepool.pool", "template.0.metadata.0.finalizers.#", "0"), resource.TestCheckResourceAttr("ovh_cloud_project_kube_nodepool.pool", "template.0.metadata.0.labels.l2", "lv2"), + resource.TestCheckResourceAttr("ovh_cloud_project_kube_nodepool.pool", "template.0.spec.0.taints.#", "0"), + resource.TestCheckResourceAttr("ovh_cloud_project_kube_nodepool.pool", "template.0.spec.0.unschedulable", "false"), ), }, { @@ -257,10 +275,13 @@ func TestAccCloudProjectKubeNodePool(t *testing.T) { resource.TestCheckResourceAttr("ovh_cloud_project_kube_nodepool.pool", "desired_nodes", "0"), resource.TestCheckResourceAttr("ovh_cloud_project_kube_nodepool.pool", "min_nodes", "0"), resource.TestCheckResourceAttr("ovh_cloud_project_kube_nodepool.pool", "max_nodes", "2"), + resource.TestCheckResourceAttr("ovh_cloud_project_kube_nodepool.pool", "template.0.metadata.0.annotations.a2", "av2"), resource.TestCheckResourceAttr("ovh_cloud_project_kube_nodepool.pool", "template.0.metadata.0.finalizers.#", "0"), resource.TestCheckResourceAttr("ovh_cloud_project_kube_nodepool.pool", "template.0.metadata.0.labels.l2", "lv2"), + resource.TestCheckResourceAttr("ovh_cloud_project_kube_nodepool.pool", "template.0.spec.0.taints.#", "0"), + resource.TestCheckResourceAttr("ovh_cloud_project_kube_nodepool.pool", "template.0.spec.0.unschedulable", "false"), ), }, { diff --git a/ovh/types_cloud_project_kube_nodepool.go b/ovh/types_cloud_project_kube_nodepool.go index 198b368ba..4068e7de4 100644 --- a/ovh/types_cloud_project_kube_nodepool.go +++ b/ovh/types_cloud_project_kube_nodepool.go @@ -3,8 +3,8 @@ package ovh import ( "bytes" "encoding/json" - "errors" "fmt" + "reflect" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/ovh/terraform-provider-ovh/ovh/helpers" @@ -32,9 +32,9 @@ type CloudProjectKubeNodePoolCreateOpts struct { type TaintEffectType int type Taint struct { - Effect TaintEffectType `json:"effect,omitempty"` - Key string `json:"key,omitempty"` - Value string `json:"value,omitempty"` + Effect TaintEffectType `json:"effect"` + Key string `json:"key"` + Value string `json:"value"` } type CloudProjectKubeNodePoolTemplateMetadata struct { @@ -49,8 +49,8 @@ type CloudProjectKubeNodePoolTemplateSpec struct { } type CloudProjectKubeNodePoolTemplate struct { - Metadata *CloudProjectKubeNodePoolTemplateMetadata `json:"metadata,omitempty"` - Spec *CloudProjectKubeNodePoolTemplateSpec `json:"spec,omitempty"` + Metadata CloudProjectKubeNodePoolTemplateMetadata `json:"metadata"` + Spec CloudProjectKubeNodePoolTemplateSpec `json:"spec"` } type CloudProjectKubeNodePoolUpdateOpts struct { @@ -94,90 +94,118 @@ func (opts *CloudProjectKubeNodePoolCreateOpts) FromResource(d *schema.ResourceD } func loadNodelPoolTemplateFromResource(i interface{}) (*CloudProjectKubeNodePoolTemplate, error) { + if i == nil { + return nil, nil + } + + // We need to initialize slices to empty slice instead of nil template := CloudProjectKubeNodePoolTemplate{ - Metadata: &CloudProjectKubeNodePoolTemplateMetadata{ - Annotations: map[string]string{}, - Finalizers: []string{}, - Labels: map[string]string{}, + Metadata: CloudProjectKubeNodePoolTemplateMetadata{ + Annotations: make(map[string]string), + Finalizers: make([]string, 0), + Labels: make(map[string]string), }, - Spec: &CloudProjectKubeNodePoolTemplateSpec{ - Taints: []Taint{}, + Spec: CloudProjectKubeNodePoolTemplateSpec{ + Taints: make([]Taint, 0), Unschedulable: false, }, } templateSet := i.(*schema.Set).List() - if len(templateSet) == 0 { - return nil, nil - } - templateObject := templateSet[0] - - // when updating the nested object template there is two objects, one is empty, take the not empty one - if len(templateSet) > 1 { - for _, to := range templateSet { - metadata := to.(map[string]interface{})["metadata"].(*schema.Set).List()[0] - annotations := metadata.(map[string]interface{})["annotations"].(map[string]interface{}) - labels := metadata.(map[string]interface{})["labels"].(map[string]interface{}) - finalizers := metadata.(map[string]interface{})["finalizers"].([]interface{}) - - spec := templateObject.(map[string]interface{})["spec"].(*schema.Set).List()[0] - taints := spec.(map[string]interface{})["taints"].([]interface{}) - unschedulable := spec.(map[string]interface{})["unschedulable"].(bool) - - if len(annotations) == 0 && len(labels) == 0 && len(finalizers) == 0 && len(taints) == 0 && unschedulable == false { - // is empty - } else { - templateObject = to - break - } - } - } - if len(templateSet) > 2 { - return nil, errors.New("resource template cannot have more than 2 elements") + if templateSet == nil || len(templateSet) == 0 { + return &template, nil } - metadataSet := templateObject.(map[string]interface{})["metadata"].(*schema.Set).List() - for _, meta := range metadataSet { - - annotations := meta.(map[string]interface{})["annotations"].(map[string]interface{}) - template.Metadata.Annotations = make(map[string]string) - for k, v := range annotations { - template.Metadata.Annotations[k] = v.(string) + // Due to this bug https://github.com/hashicorp/terraform-plugin-sdk/pull/1042 + // when updating the 'template' object there is two objects, one is empty, take the not empty one + templateObject := templateSet[0].(map[string]interface{}) // by default take the first one + for _, to := range templateSet { + var ( + annotations map[string]interface{} + labels map[string]interface{} + finalizers []interface{} + taints []interface{} + ) + + metadataSet := to.(map[string]interface{})["metadata"].(*schema.Set).List() + if len(metadataSet) > 0 { + metadata := metadataSet[0].(map[string]interface{}) + annotations = metadata["annotations"].(map[string]interface{}) + labels = metadata["labels"].(map[string]interface{}) + finalizers = metadata["finalizers"].([]interface{}) } - labels := meta.(map[string]interface{})["labels"].(map[string]interface{}) - template.Metadata.Labels = make(map[string]string) - for k, v := range labels { - template.Metadata.Labels[k] = v.(string) + specSet := to.(map[string]interface{})["spec"].(*schema.Set).List() + if len(specSet) > 0 { + spec := specSet[0].(map[string]interface{}) + taints = spec["taints"].([]interface{}) } - finalizers := meta.(map[string]interface{})["finalizers"].([]interface{}) - for _, finalizer := range finalizers { - template.Metadata.Finalizers = append(template.Metadata.Finalizers, finalizer.(string)) + if len(annotations) == 0 && len(labels) == 0 && len(finalizers) == 0 && len(taints) == 0 { + continue } + // We found the not empty object + templateObject = to.(map[string]interface{}) } - specSet := templateObject.(map[string]interface{})["spec"].(*schema.Set).List() - for _, spec := range specSet { + // metadata + { + metadataSet := templateObject["metadata"].(*schema.Set).List() + if len(metadataSet) > 0 { + metadata := metadataSet[0].(map[string]interface{}) + + // metadata.annotations + annotations := metadata["annotations"].(map[string]interface{}) + if len(annotations) > 0 { + for k, v := range annotations { + template.Metadata.Annotations[k] = v.(string) + } + } - taints := spec.(map[string]interface{})["taints"].([]interface{}) - for _, taint := range taints { - effectString := taint.(map[string]interface{})["effect"].(string) - effect := TaintEffecTypeToID[effectString] - if effect == NotATaint { - return nil, errors.New(fmt.Sprintf("Effect: %s is not a allowable taint %#v", effectString, TaintEffecTypeToID)) + // metadata.finalizers + finalizers := metadata["finalizers"].([]interface{}) + if len(finalizers) > 0 { + for _, finalizer := range finalizers { + template.Metadata.Finalizers = append(template.Metadata.Finalizers, finalizer.(string)) + } } - template.Spec.Taints = append(template.Spec.Taints, Taint{ - Effect: effect, - Key: taint.(map[string]interface{})["key"].(string), - Value: taint.(map[string]interface{})["value"].(string), - }) + // metadata.labels + labels := metadata["labels"].(map[string]interface{}) + if len(labels) > 0 { + for k, v := range labels { + template.Metadata.Labels[k] = v.(string) + } + } } + } - template.Spec.Unschedulable = spec.(map[string]interface{})["unschedulable"].(bool) + // spec + { + specSet := templateObject["spec"].(*schema.Set).List() + if len(specSet) > 0 { + spec := specSet[0].(map[string]interface{}) + + // spec.taints + taints := spec["taints"].([]interface{}) + for _, taint := range taints { + effectString := taint.(map[string]interface{})["effect"].(string) + effect := TaintEffecTypeToID[effectString] + if effect == NotATaint { + return nil, fmt.Errorf("effect: %s is not a allowable taint %#v", effectString, TaintEffecTypeToID) + } + + template.Spec.Taints = append(template.Spec.Taints, Taint{ + Effect: effect, + Key: taint.(map[string]interface{})["key"].(string), + Value: taint.(map[string]interface{})["value"].(string), + }) + } + // spec.unschedulable + template.Spec.Unschedulable = spec["unschedulable"].(bool) + } } return &template, nil @@ -271,64 +299,53 @@ func (v CloudProjectKubeNodePoolResponse) ToMap() map[string]interface{} { obj["up_to_date_nodes"] = v.UpToDateNodes obj["updated_at"] = v.UpdatedAt - var taints []map[string]interface{} - for _, taint := range v.Template.Spec.Taints { - t := map[string]interface{}{ - "effect": taint.Effect.String(), - "key": taint.Key, - "value": taint.Value, - } - - taints = append(taints, t) + emptyTemplateResponse := &CloudProjectKubeNodePoolTemplate{ + Metadata: CloudProjectKubeNodePoolTemplateMetadata{ + Annotations: make(map[string]string), + Finalizers: make([]string, 0), + Labels: make(map[string]string), + }, + Spec: CloudProjectKubeNodePoolTemplateSpec{ + Taints: make([]Taint, 0), + Unschedulable: false, + }, } - obj["template"] = []map[string]interface{}{ + // If the template is not nil and not empty, then we need to add it to the map + if v.Template != nil && !reflect.DeepEqual(v.Template, emptyTemplateResponse) { + obj["template"] = []map[string]interface{}{{}} + + // template.metadata { - "metadata": []map[string]interface{}{ - { - "finalizers": v.Template.Metadata.Finalizers, - "labels": v.Template.Metadata.Labels, - "annotations": v.Template.Metadata.Annotations, - }, - }, - "spec": []map[string]interface{}{ - { - "unschedulable": v.Template.Spec.Unschedulable, - "taints": taints, - }, - }, - }, - } + data := map[string]interface{}{ + "finalizers": v.Template.Metadata.Finalizers, + "labels": v.Template.Metadata.Labels, + "annotations": v.Template.Metadata.Annotations, + } - if len(obj["template"].([]map[string]interface{})[0]["metadata"].([]map[string]interface{})[0]["finalizers"].([]string)) == 0 { - obj["template"].([]map[string]interface{})[0]["metadata"].([]map[string]interface{})[0]["finalizers"] = nil - } - if len(obj["template"].([]map[string]interface{})[0]["metadata"].([]map[string]interface{})[0]["labels"].(map[string]string)) == 0 { - obj["template"].([]map[string]interface{})[0]["metadata"].([]map[string]interface{})[0]["labels"] = nil - } - if len(obj["template"].([]map[string]interface{})[0]["metadata"].([]map[string]interface{})[0]["annotations"].(map[string]string)) == 0 { - obj["template"].([]map[string]interface{})[0]["metadata"].([]map[string]interface{})[0]["annotations"] = nil - } - if obj["template"].([]map[string]interface{})[0]["metadata"].([]map[string]interface{})[0]["finalizers"] == nil && - obj["template"].([]map[string]interface{})[0]["metadata"].([]map[string]interface{})[0]["labels"] == nil && - obj["template"].([]map[string]interface{})[0]["metadata"].([]map[string]interface{})[0]["annotations"] == nil { - obj["template"].([]map[string]interface{})[0]["metadata"] = nil - } - if obj["template"].([]map[string]interface{})[0]["spec"].([]map[string]interface{})[0]["unschedulable"].(bool) == false { - obj["template"].([]map[string]interface{})[0]["spec"].([]map[string]interface{})[0]["unschedulable"] = nil - } - if len(obj["template"].([]map[string]interface{})[0]["spec"].([]map[string]interface{})[0]["taints"].([]map[string]interface{})) == 0 { - obj["template"].([]map[string]interface{})[0]["spec"].([]map[string]interface{})[0]["taints"] = nil - } + obj["template"].([]map[string]interface{})[0]["metadata"] = []map[string]interface{}{data} + } - if obj["template"].([]map[string]interface{})[0]["spec"].([]map[string]interface{})[0]["unschedulable"] == nil && - obj["template"].([]map[string]interface{})[0]["spec"].([]map[string]interface{})[0]["taints"] == nil { - obj["template"].([]map[string]interface{})[0]["spec"] = nil - } + // template.spec + { + data := map[string]interface{}{ + "unschedulable": v.Template.Spec.Unschedulable, + } - if obj["template"].([]map[string]interface{})[0]["metadata"] == nil && - obj["template"].([]map[string]interface{})[0]["spec"] == nil { - obj["template"] = nil + var taints []map[string]interface{} + for _, taint := range v.Template.Spec.Taints { + t := map[string]interface{}{ + "effect": taint.Effect.String(), + "key": taint.Key, + "value": taint.Value, + } + + taints = append(taints, t) + } + data["taints"] = taints + + obj["template"].([]map[string]interface{})[0]["spec"] = []map[string]interface{}{data} + } } return obj diff --git a/website/docs/r/cloud_project_kube_nodepool.html.markdown b/website/docs/r/cloud_project_kube_nodepool.html.markdown index b1695cb8d..5c43cc20c 100644 --- a/website/docs/r/cloud_project_kube_nodepool.html.markdown +++ b/website/docs/r/cloud_project_kube_nodepool.html.markdown @@ -39,7 +39,7 @@ resource "ovh_cloud_project_kube_nodepool" "pool" { k1 = "v1" k2 = "v2" } - finalizers = ["F1", "F2"] + finalizers = ["ovhcloud.com/v1beta1", "ovhcloud.com/v1"] labels = { k3 = "v3" k4 = "v4" @@ -75,13 +75,13 @@ The following arguments are supported: * `anti_affinity` - (Optional) should the pool use the anti-affinity feature. Default to `false`. **Changing this value recreates the resource.** * `autoscale` - (Optional) Enable auto-scaling for the pool. Default to `false`. * `template ` - (Optional) Managed Kubernetes nodepool template, which is a complex object constituted by two main nested objects: - * `metadata` - (Optional) Metadata of each node in the pool - * `annotations` - (Optional) Annotations to apply to each node - * `finalizers` - (Optional) Finalizers to apply to each node - * `labels` - (Optional) Labels to apply to each node - * `spec` - (Optional) Spec of each node in the pool - * `taints` - (Optional) Taints to apply to each node - * `unschedulable` - (Optional) If true, set nodes as un-schedulable + * `metadata` - Metadata of each node in the pool + * `annotations` - Annotations to apply to each node + * `finalizers` - Finalizers to apply to each node. A finalizer name must be fully qualified, e.g. kubernetes.io/pv-protection , where you prefix it with hostname of your service which is related to the controller responsible for the finalizer. + * `labels` - Labels to apply to each node + * `spec` - Spec of each node in the pool + * `taints` - Taints to apply to each node + * `unschedulable` - If true, set nodes as un-schedulable ## Attributes Reference