vultr / terraform-provider-vultr

Terraform Vultr provider
https://www.terraform.io/docs/providers/vultr/
Mozilla Public License 2.0
193 stars 65 forks source link

Allow more than 1 "node_pools" blocks for "vultr_kubernetes" #215

Closed robcxyz closed 2 years ago

robcxyz commented 2 years ago

Is your feature request related to a problem? Please describe.

In the UI you are allowed to add more than one node pool for a VKE cluster but when using the terraform resource "vultr_kubernetes", I get this error when applying multiple.

No more than 1 "node_pools" blocks are allowed

Describe the solution you'd like

Allow more than one "node_pools" blocks to be specified.

Describe alternatives you've considered

None...

Additional context

Code wanting to run:

variable "node_pools" {
  type = list(object(
  {
    node_quantity = number
    plan          = string
    label         = string
  }))
}

resource "vultr_kubernetes" "this" {
  region  = var.region
  label   = var.cluster_label
  version = var.cluster_version

  dynamic "node_pools" {
    for_each = var.node_pools
    content {
      node_quantity = node_pools.value["node_quantity"]
      plan          = node_pools.value["plan"]
      label         = node_pools.value["label"]
    }
  }
}

Alternatively this fails for same reason:

resource "vultr_kubernetes" "this" {
  region  = var.region
  label   = var.cluster_label
  version = var.cluster_version

  node_pools {
    node_quantity = var.base_pool_quantity
    plan          = var.base_pool_plan
    label         = var.base_pool_label
  }

  node_pools {
    node_quantity = var.base_pool_quantity2
    plan          = var.base_pool_plan2
    label         = var.base_pool_label2
  }
}
ddymko commented 2 years ago

@robcxyz For additional nodepools you have to use vultr_kubernetes_node_pools.

https://registry.terraform.io/providers/vultr/vultr/latest/docs/resources/kubernetes_node_pools