terraform-provider-kubernetes icon indicating copy to clipboard operation
terraform-provider-kubernetes copied to clipboard

Error: Value Conversion Error

Open gberenice opened this issue 11 months ago • 1 comments

Terraform Version, Provider Version and Kubernetes Version

Terraform version: 1.7
Kubernetes provider version: v2.27.0
Kubernetes version: 1.25

Affected Resource(s)

  • provider configuration

Terraform Configuration Files

module "eks_cluster" {
  source                       = "cloudposse/eks-cluster/aws"
  version                      = "2.9.0"
  region                       = var.region
  vpc_id                       = module.vpc.vpc_id
  subnet_ids                   = module.subnets.public_subnet_ids
  kubernetes_version           = var.kubernetes_version
  local_exec_interpreter       = var.local_exec_interpreter
  oidc_provider_enabled        = var.oidc_provider_enabled
  enabled_cluster_log_types    = var.enabled_cluster_log_types
  cluster_log_retention_period = var.cluster_log_retention_period

  # data auth has problems destroying the auth-map
  kube_data_auth_enabled = false
  kube_exec_auth_enabled = true

  context = module.this.context
}

Steps to Reproduce

  1. terraform apply when creating new clusters

Expected Behavior

Apply succeeded.

Actual Behavior

│ Error: Value Conversion Error
│ 
│   with module.eks_cluster.provider["registry.terraform.io/hashicorp/kubernetes"],
│   on .terraform/modules/eks_cluster/auth.tf line 96, in provider "kubernetes":
│   96: provider "kubernetes" {
│ 
│ 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: exec
│ Target Type: []struct { APIVersion basetypes.StringValue
│ "tfsdk:\"api_version\""; Command basetypes.StringValue "tfsdk:\"command\"";
│ Env map[string]basetypes.StringValue "tfsdk:\"env\""; Args
│ []basetypes.StringValue "tfsdk:\"args\"" }
│ Suggested Type: basetypes.ListValue
╵}

Important Factoids

A workaround is to pin the Kubernetes provider to 2.24.0.

References

  • This issue is opened because the original one GH-2388 was closed by the author, but there was no fix released.

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

gberenice avatar Mar 11 '24 17:03 gberenice

I got the same error in the latest release v2.29.0

Thank you for documenting that 2.24.0 works as that unblocked us.

There were a lot of changes between https://github.com/hashicorp/terraform-provider-kubernetes/compare/v2.24.0...v2.25.0

cc'ing the contributors from 2.25.0: @arybolovlev @jrhouston @andremarianiello @BBBmau @wonko (sorry for the ping but this seems like a bad regression if you folks are unaware)

nitrocode avatar May 03 '24 16:05 nitrocode

Seeing this in 2.33 as well.

venkatamutyala avatar Nov 13 '24 19:11 venkatamutyala

Thanks to all for the information in this issue thread.

Our Kubernetes provider is pinned to 2.24.0 as described here to get around this for now.

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.76"
    }
    kubernetes = {
      source  = "hashicorp/kubernetes"
      version = "2.24.0"
    }
  }
}

Any updates are appreciated.

bwmills avatar Nov 18 '24 21:11 bwmills