stackitcloud / terraform-provider-stackit

The official Terraform provider for STACKIT
https://registry.terraform.io/providers/stackitcloud/stackit
Apache License 2.0
42 stars 14 forks source link

SKE Cluster: maxSurge and maxUnavailable cannot both be 0 #530

Closed tim-hiqs closed 2 weeks ago

tim-hiqs commented 1 month ago

Hi everyone,

I am trying to create a SKE cluster, which results in the following error during terraform apply

│ Error: Error creating/updating cluster
│ 
│   with stackit_ske_cluster.ske,
│   on kubernetes.tf line 1, in resource "stackit_ske_cluster" "ske":
│    1: resource "stackit_ske_cluster" "ske" ***
│ 
│ Calling API: 400 Bad Request, status code 400, Body:
│ ***"code":"InvalidArgument","message":"1 error occurred:\n\t* invalid input:
│ nodepool \"cpu-optimized\": maxSurge and maxUnavailable cannot both be
│ 0\n\n","details":""***

I would expect maxSurge and maxUnavailable not to interfere with the cluster creation, as it is an Optional parameter

Resource config used:

resource "stackit_ske_cluster" "ske" {
  project_id             = var.stackit_project_id
  name                   = "generic"
  kubernetes_version_min = "1.29.7"
  node_pools             = [
    {
      name               = "cpu-optimized"
      machine_type       = "c1.2"
      os_version_min     = "3815.2.5"
      minimum            = 1
      maximum            = 2
      availability_zones = ["eu01-3"]
      volume_size        = 100
      volume_type        = "storage_premium_perf0"
    }
  ]
  maintenance = {
    enable_kubernetes_version_updates    = true
    enable_machine_image_version_updates = true
    start                                = "01:00:00Z"
    end                                  = "02:00:00Z"
  }
  extensions = {
    argus = {
      enabled           = true
      argus_instance_id = data.stackit_observability_instance.argus.instance_id
    }
  }
}

Terraform version used: "0.31.1"

Notes: Adding the parameters maxSurge and maxUnavailable directly does not change anything

Any help is appreciated, thanks!

Slm0n87 commented 1 month ago

Same for me with existing terraform code without one of the parameters. But I could add for example max_surge = 1 into the node_pools block to resolve this issue.
Note that the parameter in the API is different than for the terraform resource.
Nevertheless it feels like an unintentional error.

vicentepinto98 commented 1 month ago

Hi, thanks for reporting the issue. There were some new validations introduced recently by SKE that we are addressing. We'll update here once a bugfix is released.

tim-hiqs commented 1 month ago

Adding max_surge = 1 is the temporary fix, the cluster was created, thanks!

Slm0n87 commented 3 weeks ago

We just updated the provider to latest version v0.32.0 and the issue is gone.

GokceGK commented 2 weeks ago

Hi,

as mentioned in the above comment, this issue has been fixed.

The condition is still valid, maxSurge and maxUnavailable cannot both be 0 at the same time. SKE has improved the validation. In documentation, the descriptions have been extended with this information.

https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/resources/ske_cluster#max_surge