stackitcloud / terraform-provider-stackit

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

Value Conversion Error stackit_ske_cluster #110

Closed Passe-cc closed 1 year ago

Passe-cc commented 1 year ago

Hello

I encountered the following error when using the provider:

Error: Value Conversion Error │ │ with module.ske-cluster.stackit_ske_cluster.ske_cluster, │ on ../main.tf line 23, in resource "stackit_ske_cluster" "ske_cluster": │ 23: node_pools = var.node_pools │ │ An unexpected error was encountered trying to build a value. This is always an error in the provider. Please report the following to the provider developer: │ │ Received unknown value, however the target type cannot handle unknown values. Use the corresponding types package type or a custom type that handles unknown values. │ │ Path: node_pools │ Target Type: []ske.NodePool │ Suggested Type: basetypes.ListValue

Steps to Reproduce

  1. create a terraform module for stackit_ske_cluster

Resource:

resource "stackit_ske_cluster" "ske_cluster" {
  project_id         = var.project_id
  name               = var.name
  node_pools         = var.node_pools
  ...

variable:

variable "node_pools" {
  type = list(object({
    availability_zones = list(string)
    machine_type       = string
    maximum            = number
    minimum            = number
    name               = string
    os_version         = string
  }))
}

Module

module "ske-cluster" {
  source     = "<source>"
  project_id = "<project_id>"
  name       = "test-ske"
  node_pools = [
    {
      name               = "np-example"
      machine_type       = "c1.2"
      os_version         = "3510.2.7"
      minimum            = "2"
      maximum            = "3"
      availability_zones = ["eu01-3"]
    }
  ]
  1. run terraform init & terraform plan

Additional Information

hcsa73 commented 1 year ago

Hello, thanks for opening the issue!

The error seems to be related to how the values are handled internally in the provider. We'll be releasing a patch soon that fixes this. In the meanwhile, a workaround is to pass the value of node_pools directly (instead of as a variable), or to create variables for each of the node_pools fields and pass it that way

hcsa73 commented 1 year ago

This has been fixed in the v0.6.2 release