banzaicloud / terraform-provider-k8s

Kubernetes Terraform provider with support for raw manifests
https://registry.terraform.io/providers/banzaicloud/k8s
MIT License
135 stars 30 forks source link

*terraform.EvalApplyPost, err: rpc error: code = Unavailable desc = transport is closing #48

Closed dkirrane closed 4 years ago

dkirrane commented 4 years ago

Describe the bug [ERROR] module.istio: eval: *terraform.EvalApplyPost, err: rpc error: code = Unavailable desc = transport is closing

crash.log

2020/05/15 17:45:18 [TRACE] module.istio: eval: *terraform.EvalApplyPost
2020/05/15 17:45:18 [ERROR] module.istio: eval: *terraform.EvalApplyPost, err: rpc error: code = Unavailable desc = transport is closing
2020/05/15 17:45:18 [ERROR] module.istio: eval: *terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing
2020/05/15 17:45:18 [TRACE] [walkApply] Exiting eval tree: module.istio.k8s_manifest.istio_install[0]
2020/05/15 17:45:18 [TRACE] vertex "module.istio.k8s_manifest.istio_install[0]": visit complete
2020/05/15 17:45:18 [TRACE] dag/walk: upstream of "module.istio.provider.k8s (close)" errored, so skipping
2020/05/15 17:45:18 [TRACE] dag/walk: upstream of "module.istio.null_resource.istio_verify[0]" errored, so skipping
2020/05/15 17:45:18 [TRACE] dag/walk: upstream of "meta.count-boundary (EachMode fixup)" errored, so skipping
2020/05/15 17:45:18 [TRACE] dag/walk: upstream of "provisioner.local-exec (close)" errored, so skipping
2020/05/15 17:45:18 [TRACE] dag/walk: upstream of "provider.null (close)" errored, so skipping
2020/05/15 17:45:18 [TRACE] dag/walk: upstream of "root" errored, so skipping
2020/05/15 17:45:18 [TRACE] statemgr.Filesystem: have already backed up original terraform.tfstate to terraform.tfstate.backup on a previous write
2020-05-15T17:45:18.357+0100 [DEBUG] plugin: plugin process exited: path=C:\Users\me\AppData\Roaming\terraform.d\plugins\windows_amd64\terraform-provider-k8s_v0.7.6.exe pid=23612 error="exit status 2"

Steps to reproduce the issue: My module uses the following:

provider "k8s" {
  load_config_file = "false"
  config_path      = "${path.module}/tmp/.kube/config"
}

data "local_file" "istio_manifest" {
  filename = "${path.module}/tmp/istio-manifest.yaml"
}

# kubectl apply -f generated-manifest.yaml --kubeconfig=.kube/config
resource "k8s_manifest" "istio_install" {
  content = data.local_file.istio_manifest.content
}

istio-manifest.yaml https://gist.github.com/dkirrane/69f39adf86fea56de01cff3ca64413da

bonifaido commented 4 years ago

The main issue is here that we are not supporting multi-resource YAML files as have been described previously in https://github.com/banzaicloud/terraform-provider-k8s/issues/7 You will have to use the workaround in the issue.

I will fix the provider to detect this case rather than panicking.