terraform-provider-kubernetes: Cannot Import Kubernetes Namespace

Cannot import Kubernetes namespaces. The import fails with an unclear error message.

Terraform Version and Provider Version

Terraform v0.13.4

  • provider registry.terraform.io/hashicorp/aws v3.3.0
  • provider registry.terraform.io/hashicorp/kubernetes v1.12.0
  • provider registry.terraform.io/hashicorp/local v1.4.0
  • provider registry.terraform.io/hashicorp/null v2.1.2
  • provider registry.terraform.io/hashicorp/random v2.3.0
  • provider registry.terraform.io/hashicorp/template v2.1.2

Affected Resource(s)

  • kubernetes_namespace
  • kubernetes_storage_class

Terraform Configuration Files

provider "kubernetes" {
  config_path      ="~/.kube/config"
  config_context   = "arn:aws:eks:eu-west-1:882501xxxxxx:cluster/eks-cluster"
}

resource "kubernetes_namespace" "namespace" {
  metadata {
    annotations = {
      name = "namespace"
    }

    labels = {
      istio-injection = "enabled"
    }

    name = "namespace"
  }
}

Debug Output

https://gist.github.com/CSimpiFoN/66add3ee5b1eb6e940b8ea419fdfb05a

Panic Output

Error: Invalid provider configuration

  on /path/to/provider.tf line 1:
   1: provider "kubernetes" {

The configuration for
provider["registry.terraform.io/hashicorp/kubernetes"].eks-cluster
depends on values that cannot be determined until apply.

Expected Behavior

What should have happened? The existing namespace should be imported into Terraform state

Actual Behavior

What actually happened? The namespace cannot be imported

Steps to Reproduce

  1. terraform import kubernetes_namespace.namespace namespace

Important Factoids

References

  • GH-1234

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

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 8
  • Comments: 30 (11 by maintainers)

Most upvoted comments