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

Pod spec with an empty env_from block causes crash #850

Closed
rsalmond opened this issue May 22, 2020 · 2 comments
Closed

Pod spec with an empty env_from block causes crash #850

rsalmond opened this issue May 22, 2020 · 2 comments

Comments

@rsalmond
Copy link
Contributor

rsalmond commented May 22, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version and Provider Version

$ terraform version
Terraform v0.12.25
+ provider.kubernetes v1.11.3

Affected Resource(s)

Terraform Configuration Files

resource "kubernetes_pod" "test" {
  metadata {
    name      = "terraform-example"
  }

  spec {
    container {
      image = "nginx:1.7.9"
      name  = "example"

      env {
        name  = "environment"
        value = "test"
      }

      env_from {}

    }
  }
}

Debug Output

Panic Output

https://gist.github.com/rsalmond/5a2a1359d26ee8fe30b4aea5fe79fbc1

Expected Behavior

What should have happened?

Throw a helpful error message.

Actual Behavior

What actually happened?

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

kubernetes_pod.test: Creating...

Error: rpc error: code = Unavailable desc = transport is closing


panic: interface conversion: interface {} is nil, not map[string]interface {}
2020-05-22T16:56:52.190-0600 [DEBUG] plugin.terraform-provider-kubernetes_v1.11.3_x4:
2020-05-22T16:56:52.190-0600 [DEBUG] plugin.terraform-provider-kubernetes_v1.11.3_x4: goroutine 26 [running]:
2020-05-22T16:56:52.190-0600 [DEBUG] plugin.terraform-provider-kubernetes_v1.11.3_x4: github.com/terraform-providers/terraform-provider-kubernetes/kubernetes.expandContainerEnvFrom(0xc000aedac0, 0x1, 0x1, 0x8, 0xc0005f7708, 0x1, 0x0, 0x0)
2020-05-22T16:56:52.190-0600 [DEBUG] plugin.terraform-provider-kubernetes_v1.11.3_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-kubernetes/kubernetes/structures_container.go:758 +0x6b2
2020-05-22T16:56:52.190-0600 [DEBUG] plugin.terraform-provider-kubernetes_v1.11.3_x4: github.com/terraform-providers/terraform-provider-kubernetes/kubernetes.expandContainers(0xc000aeda80, 0x1, 0x1, 0x9, 0xc0005f72a8, 0x0, 0x0, 0x0)
2020-05-22T16:56:52.190-0600 [DEBUG] plugin.terraform-provider-kubernetes_v1.11.3_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-kubernetes/kubernetes/structures_container.go:456 +0xcd7
2020-05-22T16:56:52.190-0600 [DEBUG] plugin.terraform-provider-kubernetes_v1.11.3_x4: github.com/terraform-providers/terraform-provider-kubernetes/kubernetes.expandPodSpec(0xc000aed9d0, 0x1, 0x1, 0x2455200, 0xc0005d5a40, 0x1)
2020-05-22T16:56:52.190-0600 [DEBUG] plugin.terraform-provider-kubernetes_v1.11.3_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-kubernetes/kubernetes/structures_pod.go:447 +0x12e7
2020-05-22T16:56:52.190-0600 [DEBUG] plugin.terraform-provider-kubernetes_v1.11.3_x4: github.com/terraform-providers/terraform-provider-kubernetes/kubernetes.resourceKubernetesPodCreate(0xc00056af50, 0x26341e0, 0xc0007a2640, 0x2, 0x38c0f00)
2020-05-22T16:56:52.190-0600 [DEBUG] plugin.terraform-provider-kubernetes_v1.11.3_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-kubernetes/kubernetes/resource_kubernetes_pod.go:58 +0x1a2
2020-05-22T16:56:52.190-0600 [DEBUG] plugin.terraform-provider-kubernetes_v1.11.3_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).Apply(0xc00033c680, 0xc000212230, 0xc000a08ec0, 0x26341e0, 0xc0007a2640, 0x251e001, 0xc00019d8a8, 0xc000a97620)
2020-05-22T16:56:52.190-0600 [DEBUG] plugin.terraform-provider-kubernetes_v1.11.3_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-kubernetes/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/resource.go:305 +0x365
2020-05-22T16:56:52.190-0600 [DEBUG] plugin.terraform-provider-kubernetes_v1.11.3_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).Apply(0xc00071f080, 0xc0006238e0, 0xc000212230, 0xc000a08ec0, 0xc0002794c8, 0xc00000e420, 0x2520520)
2020-05-22T16:56:52.190-0600 [DEBUG] plugin.terraform-provider-kubernetes_v1.11.3_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-kubernetes/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/provider.go:294 +0x99
2020-05-22T16:56:52.190-0600 [DEBUG] plugin.terraform-provider-kubernetes_v1.11.3_x4: github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ApplyResourceChange(0xc000788168, 0x2afc180, 0xc00024a2d0, 0xc000200840, 0xc000788168, 0xc00024a2d0, 0xc000a2da48)
2020-05-22T16:56:52.190-0600 [DEBUG] plugin.terraform-provider-kubernetes_v1.11.3_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-kubernetes/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin/grpc_provider.go:885 +0x8b4
2020-05-22T16:56:52.190-0600 [DEBUG] plugin.terraform-provider-kubernetes_v1.11.3_x4: github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0x26d3c40, 0xc000788168, 0x2afc180, 0xc00024a2d0, 0xc0002007e0, 0x0, 0x2afc180, 0xc00024a2d0, 0xc000569800, 0x7a9)
2020-05-22T16:56:52.190-0600 [DEBUG] plugin.terraform-provider-kubernetes_v1.11.3_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-kubernetes/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5/tfplugin5.pb.go:3189 +0x217
2020-05-22T16:56:52.190-0600 [DEBUG] plugin.terraform-provider-kubernetes_v1.11.3_x4: google.golang.org/grpc.(*Server).processUnaryRPC(0xc00078e160, 0x2b11d80, 0xc000702d80, 0xc000d88000, 0xc0006b5740, 0x387d080, 0x0, 0x0, 0x0)
2020-05-22T16:56:52.190-0600 [DEBUG] plugin.terraform-provider-kubernetes_v1.11.3_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-kubernetes/vendor/google.golang.org/grpc/server.go:995 +0x460
2020-05-22T16:56:52.190-0600 [DEBUG] plugin.terraform-provider-kubernetes_v1.11.3_x4: google.golang.org/grpc.(*Server).handleStream(0xc00078e160, 0x2b11d80, 0xc000702d80, 0xc000d88000, 0x0)
2020-05-22T16:56:52.190-0600 [DEBUG] plugin.terraform-provider-kubernetes_v1.11.3_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-kubernetes/vendor/google.golang.org/grpc/server.go:1275 +0xd3d
2020-05-22T16:56:52.190-0600 [DEBUG] plugin.terraform-provider-kubernetes_v1.11.3_x4: google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc000516230, 0xc00078e160, 0x2b11d80, 0xc000702d80, 0xc000d88000)
2020-05-22T16:56:52.190-0600 [DEBUG] plugin.terraform-provider-kubernetes_v1.11.3_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-kubernetes/vendor/google.golang.org/grpc/server.go:710 +0xa1
2020-05-22T16:56:52.190-0600 [DEBUG] plugin.terraform-provider-kubernetes_v1.11.3_x4: created by google.golang.org/grpc.(*Server).serveStreams.func1
2020-05-22T16:56:52.190-0600 [DEBUG] plugin.terraform-provider-kubernetes_v1.11.3_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-kubernetes/vendor/google.golang.org/grpc/server.go:708 +0xa1
2020-05-22T16:56:52.193-0600 [DEBUG] plugin: plugin process exited: path=/tmp/.terraform/plugins/darwin_amd64/terraform-provider-kubernetes_v1.11.3_x4 pid=83744 error="exit status 2"
2020/05/22 16:56:52 [DEBUG] kubernetes_pod.test: apply errored, but we're indicating that via the Error pointer rather than returning it: rpc error: code = Unavailable desc = transport is closing
2020/05/22 16:56:52 [TRACE] <root>: eval: *terraform.EvalMaybeTainted
2020/05/22 16:56:52 [TRACE] EvalMaybeTainted: kubernetes_pod.test encountered an error during creation, so it is now marked as tainted
2020/05/22 16:56:52 [TRACE] <root>: eval: *terraform.EvalWriteState
2020/05/22 16:56:52 [TRACE] EvalWriteState: removing state object for kubernetes_pod.test
2020/05/22 16:56:52 [TRACE] <root>: eval: *terraform.EvalApplyProvisioners
2020/05/22 16:56:52 [TRACE] EvalApplyProvisioners: kubernetes_pod.test has no state, so skipping provisioners
2020/05/22 16:56:52 [TRACE] <root>: eval: *terraform.EvalMaybeTainted
2020/05/22 16:56:52 [TRACE] EvalMaybeTainted: kubernetes_pod.test encountered an error during creation, so it is now marked as tainted
2020/05/22 16:56:52 [TRACE] <root>: eval: *terraform.EvalWriteState
2020/05/22 16:56:52 [TRACE] EvalWriteState: removing state object for kubernetes_pod.test
2020/05/22 16:56:52 [TRACE] <root>: eval: *terraform.EvalIf
2020/05/22 16:56:52 [TRACE] <root>: eval: *terraform.EvalIf
2020/05/22 16:56:52 [TRACE] <root>: eval: *terraform.EvalWriteDiff
2020/05/22 16:56:52 [TRACE] <root>: eval: *terraform.EvalApplyPost
2020/05/22 16:56:52 [ERROR] <root>: eval: *terraform.EvalApplyPost, err: rpc error: code = Unavailable desc = transport is closing
2020/05/22 16:56:52 [ERROR] <root>: eval: *terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing
2020/05/22 16:56:52 [TRACE] [walkApply] Exiting eval tree: kubernetes_pod.test
2020/05/22 16:56:52 [TRACE] vertex "kubernetes_pod.test": visit complete
2020/05/22 16:56:52 [TRACE] dag/walk: upstream of "meta.count-boundary (EachMode fixup)" errored, so skipping
2020/05/22 16:56:52 [TRACE] dag/walk: upstream of "provider.kubernetes (close)" errored, so skipping
2020/05/22 16:56:52 [TRACE] dag/walk: upstream of "root" errored, so skipping
2020/05/22 16:56:52 [TRACE] statemgr.Filesystem: not making a backup, because the new snapshot is identical to the old
2020/05/22 16:56:52 [TRACE] statemgr.Filesystem: no state changes since last snapshot
2020/05/22 16:56:52 [TRACE] statemgr.Filesystem: writing snapshot at terraform.tfstate
2020/05/22 16:56:52 [TRACE] statemgr.Filesystem: removing lock metadata file .terraform.tfstate.lock.info
2020/05/22 16:56:52 [TRACE] statemgr.Filesystem: unlocking terraform.tfstate using fcntl flock
2020-05-22T16:56:52.209-0600 [DEBUG] plugin: plugin exited



!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Terraform crashed! This is always indicative of a bug within Terraform.
A crash log has been placed at "crash.log" relative to your current
working directory. It would be immensely helpful if you could please
report the crash with Terraform[1] so that we can fix this.

When reporting bugs, please include your terraform version. That
information is available on the first line of crash.log. You can also
get it by running 'terraform --version' on the command line.

SECURITY WARNING: the "crash.log" file that was created may contain
sensitive information that must be redacted before it is safe to share
on the issue tracker.

[1]: https://github.com/hashicorp/terraform/issues

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Steps to Reproduce

  1. terraform apply

Important Factoids

@dak1n1
Copy link
Contributor

dak1n1 commented Mar 10, 2021

The empty PodSpec blocks now report an error instead of crashing:

        Error: Missing required argument
        The argument "name" is required, but no definition was found.

I'll close this issue for now. Feel free to reopen if it's still a problem.

@dak1n1 dak1n1 closed this as completed Mar 10, 2021
@ghost
Copy link

ghost commented Apr 9, 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 👉 [email protected]. Thanks!

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

No branches or pull requests

3 participants