SchwarzIT / terraform-provider-stackit

Community-maintained STACKIT Terraform provider
Apache License 2.0
18 stars 6 forks source link

Unable to use Maintenance nested schema with Terraform #157

Closed chakarovs closed 1 year ago

chakarovs commented 1 year ago

Hello,

My team is trying to disable the kubernetes “Auto update“ feature in the maintenance section on both of the clusters in the project via Terraform using https://registry.terraform.io/providers/SchwarzIT/stackit/latest/docs/resources/kubernetes_cluster#nested-schema-for-maintenance

This snippet resides within the cluster section:

maintenance = {
    enable_kubernetes_version_updates    = false
    enable_machine_image_version_updates = false
    end                                  = "2023-07-12T23:45:00Z"
    start                                = "2023-07-12T23:30:00Z"
  }

This is the TF plan:

   # resource will be updated in-place
   ~ resource  {
  ...
       + maintenance                 = {
           + enable_kubernetes_version_updates    = false
           + enable_machine_image_version_updates = false
           + end                                  = "2023-07-12T23:45:00Z"
           + start                                = "2023-07-12T23:30:00Z"
         }

     }

And once applied, we receive the following error:

Error: failed during SKE create/update

 call error:
 HTTP status code: 400
 HTTP status message: Bad Request
 Server response: 
 URL:
 https://ske.api.eu01.stackit.cloud/v1/projects/{project-id}/clusters/{ourCluster}

Related to SHC-7284 (advised to open an issue here)

chakarovs commented 1 year ago

Provider version:

Finding schwarzit/stackit versions matching ">= 1.10.0"...
Finding terraform-provider-openstack/openstack versions matching "~> 1.48.0"...
do87 commented 1 year ago

The reason for the error is:

 {
│  "code": "InvalidArgument",
│  "details": "",
│  "message": "invalid input: cluster with name example: Invalid value: 15m0s: time window must not be smaller than 30m0s\n"
│ }

for example, this code worked:


resource "stackit_kubernetes_cluster" "example" {
  name                  = "example"
  kubernetes_project_id = var.project_id

  node_pools = [{
    name         = "example"
    machine_type = "c1.2"
  }]

  maintenance = {
    enable_kubernetes_version_updates    = false
    enable_machine_image_version_updates = false
    start                                = "0000-01-01T20:45:00Z"
    end                                  = "0000-01-01T23:45:00Z"
  }
}

i'll add the server response to the error returned from the provider

do87 commented 1 year ago

added to v1.22.0-rc3, will be released in v1.22.0