Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

terraform plan fails when no cluster is existent #668

Closed
tillepille opened this issue Jan 21, 2021 · 3 comments
Closed

terraform plan fails when no cluster is existent #668

tillepille opened this issue Jan 21, 2021 · 3 comments
Labels

Comments

@tillepille
Copy link

Terraform, Provider, Kubernetes and Helm Versions

Terraform version: 0.14.3
Provider version: 2.0.2
Kubernetes version: 1.19.3
Helm version: 3.5.0

Affected Resource(s)

  • helm_release

Terraform Configuration Files

Provider config

provider "helm" {
  kubernetes {
    host     = module.kubernetes.host
    username = module.kubernetes.username
    password = module.kubernetes.password

    client_certificate     = base64decode(module.kubernetes.client_certificate)
    client_key             = base64decode(module.kubernetes.client_key)
    cluster_ca_certificate = base64decode(module.kubernetes.cluster_ca_certificate)
  }
}

Module which has one helm_release inside

module "externaldns" {
  source      = "../../modules/k8s-deployments/externaldns"
  namespace   = "kube-system"
  values_file = file("helm_values/externaldns.yaml")

  azure_dns_tenantId        = var.azure_dns_tenantId
  azure_dns_subscriptionId  = var.azure_dns_subscriptionId
  azure_dns_resourceGroup   = var.azure_dns_resourceGroup
  azure_dns_aadClientId     = var.azure_dns_aadClientId
  azure_dns_aadClientSecret = var.azure_dns_aadClientSecret
}

the helm_release inside this module

resource "helm_release" "exernaldns" {
  name             = "externaldns"
  repository       = "https://charts.bitnami.com/bitnami"
  chart            = "external-dns"
  version          = "3.6.0"
  create_namespace = true
  namespace        = var.namespace

  values = [var.values_file]

  set {
    name  = "azure.tenantId"
    value = var.azure_dns_tenantId
  }
  set {
    name  = "azure.subscriptionId"
    value = var.azure_dns_subscriptionId
  }
  set {
    name  = "azure.resourceGroup"
    value = var.azure_dns_resourceGroup
  }
  set {
    name  = "azure.aadClientId"
    value = var.azure_dns_aadClientId
  }
  set {
    name  = "azure.aadClientSecret"
    value = var.azure_dns_aadClientSecret
  }
}

Debug Output

NOTE: In addition to Terraform debugging, please set HELM_DEBUG=1 to enable debugging info from helm.

Debug captured with TF_LOG=trace HELM_DEBUG=1 terraform plan > debug_output.txt 2>&1

https://gist.github.com/tillepille/39e4983ba588f399f9203e2375133b6a

Panic Output

Steps to Reproduce

Create new environment, state only contains a network at that point.

  1. terraform plan

Expected Behavior

plan should successfully run and produce the output that x helm releases have to be added.

Actual Behavior

terraform plan fails with

error: code = Unavailable desc = transport is closing

When there is a K8S Cluster already in place, the plan runs successfully.
When I comment out the modules (helm_releases), plan also runs successfully.

Important Factoids

References

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
@tillepille tillepille added the bug label Jan 21, 2021
@aareet
Copy link
Member

aareet commented Jan 21, 2021

2021/01/21 09:04:36 [TRACE] LoadSchemas: retrieving schema for provider type "registry.terraform.io/hashicorp/kubernetes-alpha"

It looks like you're using the kubernetes-alpha provider somewhere in your config? I think this may be the hidden issue. In its current state the kubernetes-alpha provider relies on server side planning, so it requires the cluster to be available at plan time. We are working to address this in hashicorp/terraform-provider-kubernetes-alpha#41, but it will take some time.

@tillepille
Copy link
Author

@aareet You're totally right, thank you for that hint!

@ghost
Copy link

ghost commented Feb 22, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Feb 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants