particuleio / terraform-scaleway-kapsule

Terraform module to deploy a Scaleway Kapsule Kubernetes Cluster
https://registry.terraform.io/modules/particuleio/kapsule/scaleway/latest
Apache License 2.0
15 stars 9 forks source link

Error realted to usage of `list` function #9

Closed thomasboni closed 2 years ago

thomasboni commented 3 years ago

Hello,

An error occurs when I try to apply my configuration with auto_upgrade option. It's realted to the call to function list that isn't available anymore.

Here my kapsulte.tf file:

module "kapsule" {

  source  = "particuleio/kapsule/scaleway"
  version = "~>3.0.1"

  auto_upgrade = {
    enable = true
    maintenance_window_start_hour = 21
    maintenance_window_day = "any"
  }

  cluster_name    = "****"
  cluster_description = "****"

  cni_plugin = "cilium"
  delete_additional_resources = false 

  kubernetes_version = "1.21"

  node_pools = {
    r2devops = {
      name               = "default"
      node_type          = "DEV1-M"
      size               = 2
      min_size           = 2
      max_size           = 5
      autoscaling        = true
      autohealing        = true
      container_runtime  = "docker"
    }
  }
  region          = "****"
  tags = ["****", "****"]
  project_id = "****"
}

And the output when I run terrraform apply :

➜  scw-k8s git:(2-bootstrap-iac) ✗ terraform apply
2021/07/14 10:49:04 [DEBUG] POST https://gitlab.com/api/v4/projects/****/terraform/state/****/lock
Acquiring state lock. This may take a few moments...
2021/07/14 10:49:05 [DEBUG] GET https://gitlab.com/api/v4/projects/*****/terraform/state/****
╷
│ Error: Error in function call
│ 
│   on .terraform/modules/kapsule/cluster.tf line 27, in resource "scaleway_k8s_cluster" "this":
│   27:     for_each = local.auto_upgrade["enable"] ? list("auto_upgrade") : []
│ 
│ Call to function "list" failed: the "list" function was deprecated in Terraform v0.12 and is no longer available;
│ use tolist([ ... ]) syntax to write a literal list.
╵
2021/07/14 10:49:07 [DEBUG] DELETE https://gitlab.com/api/v4/projects/****/terraform/state/****/lock
Releasing state lock. This may take a few moments...
ArchiFleKs commented 2 years ago

This has been fixed in the latest releases