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

Fix kubernetes_auth_backend_role issues #305

Merged
merged 1 commit into from
Feb 20, 2019

Conversation

lawliet89
Copy link
Contributor

@lawliet89 lawliet89 commented Feb 14, 2019

  • Make bound_service_account_names, bound_service_account_namespaces
    and policies be of type schema.TypeSet
  • Simplify reading and setting of data to fix crashes
  • Add bound_cidrs and num_uses parameters to resource

Crash logs from before fix:


An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  ~ vault_kubernetes_auth_backend_role.default
      bound_service_account_names.2679715827:      "*" => ""
      bound_service_account_names.3405555451:      "" => "traefik"
      bound_service_account_namespaces.1971754988: "default" => ""
      bound_service_account_namespaces.2679715827: "" => "*"


Plan: 0 to add, 1 to change, 0 to destroy.

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

vault_kubernetes_auth_backend_role.default: Modifying... (ID: auth/kubernetes/role/default)
  bound_service_account_names.2679715827:      "*" => ""
  bound_service_account_names.3405555451:      "" => "traefik"
  bound_service_account_namespaces.1971754988: "default" => ""
  bound_service_account_namespaces.2679715827: "" => "*"

Error: Error applying plan:

1 error(s) occurred:

* vault_kubernetes_auth_backend_role.default: 1 error(s) occurred:

* vault_kubernetes_auth_backend_role.default: unexpected EOF

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.


panic: interface conversion: interface {} is *schema.Set, not []interface {}
2019-02-14T09:42:11.766+0800 [DEBUG] plugin.terraform-provider-vault: 
2019-02-14T09:42:11.766+0800 [DEBUG] plugin.terraform-provider-vault: goroutine 247 [running]:
2019-02-14T09:42:11.766+0800 [DEBUG] plugin.terraform-provider-vault: github.com/terraform-providers/terraform-provider-vault/vault.kubernetesAuthBackendRoleUpdate(0xc000205b90, 0xd258c0, 0xc0002057a0, 0x24, 0x14f0ca0)
2019-02-14T09:42:11.766+0800 [DEBUG] plugin.terraform-provider-vault: 	/home/yongwen/go/src/github.com/terraform-providers/terraform-provider-vault/vault/resource_kubernetes_auth_backend_role.go:202 +0xf96
2019-02-14T09:42:11.766+0800 [DEBUG] plugin.terraform-provider-vault: github.com/terraform-providers/terraform-provider-vault/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc00023bbc0, 0xc0005235e0, 0xc00041b740, 0xd258c0, 0xc0002057a0, 0x40d501, 0xc000063b80, 0x4c16dc)
2019-02-14T09:42:11.766+0800 [DEBUG] plugin.terraform-provider-vault: 	/home/yongwen/go/src/github.com/terraform-providers/terraform-provider-vault/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:199 +0x257
2019-02-14T09:42:11.766+0800 [DEBUG] plugin.terraform-provider-vault: github.com/terraform-providers/terraform-provider-vault/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc0001ae850, 0xc000523590, 0xc0005235e0, 0xc00041b740, 0xc0004c8380, 0x18, 0x7f953adb7b00)
2019-02-14T09:42:11.766+0800 [DEBUG] plugin.terraform-provider-vault: 	/home/yongwen/go/src/github.com/terraform-providers/terraform-provider-vault/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:259 +0x9c
2019-02-14T09:42:11.766+0800 [DEBUG] plugin.terraform-provider-vault: github.com/terraform-providers/terraform-provider-vault/vendor/github.com/hashicorp/terraform/plugin.(*ResourceProviderServer).Apply(0xc000576b60, 0xc00041b300, 0xc000490c70, 0x0, 0x0)
2019-02-14T09:42:11.766+0800 [DEBUG] plugin.terraform-provider-vault: 	/home/yongwen/go/src/github.com/terraform-providers/terraform-provider-vault/vendor/github.com/hashicorp/terraform/plugin/resource_provider.go:488 +0x57
2019-02-14T09:42:11.767+0800 [DEBUG] plugin.terraform-provider-vault: reflect.Value.call(0xc000124660, 0xc0001304a0, 0x13, 0xd3c0fb, 0x4, 0xc000063f18, 0x3, 0x3, 0xc000364c40, 0x14d5d80, ...)
2019-02-14T09:42:11.767+0800 [DEBUG] plugin.terraform-provider-vault: 	/usr/local/go/src/reflect/value.go:447 +0x454
2019-02-14T09:42:11.767+0800 [DEBUG] plugin.terraform-provider-vault: reflect.Value.Call(0xc000124660, 0xc0001304a0, 0x13, 0xc0004a8f18, 0x3, 0x3, 0xc000033fc0, 0xc0004a8f40, 0x9e4434)
2019-02-14T09:42:11.767+0800 [DEBUG] plugin.terraform-provider-vault: 	/usr/local/go/src/reflect/value.go:308 +0xa4
2019-02-14T09:42:11.767+0800 [DEBUG] plugin.terraform-provider-vault: net/rpc.(*service).call(0xc000405d80, 0xc0005226e0, 0xc00012e6a8, 0xc00012e6c0, 0xc0002cc180, 0xc0005529c0, 0xbc78e0, 0xc00041b300, 0x16, 0xbc7920, ...)
2019-02-14T09:42:11.767+0800 [DEBUG] plugin.terraform-provider-vault: 	/usr/local/go/src/net/rpc/server.go:384 +0x14e
2019-02-14T09:42:11.767+0800 [DEBUG] plugin.terraform-provider-vault: created by net/rpc.(*Server).ServeCodec
2019-02-14T09:42:11.767+0800 [DEBUG] plugin.terraform-provider-vault: 	/usr/local/go/src/net/rpc/server.go:481 +0x47e
2019/02/14 09:42:11 [TRACE] root: eval: *terraform.EvalWriteState
2019/02/14 09:42:11 [TRACE] root: eval: *terraform.EvalApplyProvisioners
2019/02/14 09:42:11 [TRACE] root: eval: *terraform.EvalIf
2019/02/14 09:42:11 [TRACE] root: eval: *terraform.EvalWriteState
2019-02-14T09:42:11.769+0800 [DEBUG] plugin: plugin process exited: path=/home/yongwen/.terraform.d/plugins/terraform-provider-vault
2019/02/14 09:42:11 [TRACE] root: eval: *terraform.EvalWriteDiff
2019/02/14 09:42:11 [TRACE] root: eval: *terraform.EvalApplyPost
2019/02/14 09:42:11 [ERROR] root: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:

* vault_kubernetes_auth_backend_role.default: unexpected EOF
2019/02/14 09:42:11 [ERROR] root: eval: *terraform.EvalSequence, err: 1 error(s) occurred:

* vault_kubernetes_auth_backend_role.default: unexpected EOF
2019/02/14 09:42:11 [TRACE] [walkApply] Exiting eval tree: vault_kubernetes_auth_backend_role.default
2019/02/14 09:42:11 [TRACE] dag/walk: upstream errored, not walking "provider.vault (close)"
2019/02/14 09:42:11 [TRACE] dag/walk: upstream errored, not walking "meta.count-boundary (count boundary fixup)"
2019/02/14 09:42:11 [TRACE] dag/walk: upstream errored, not walking "root"
2019/02/14 09:42:11 [TRACE] Preserving existing state lineage "87674e15-1efd-97bb-1cab-a0729d6f37d0"
2019/02/14 09:42:11 [TRACE] Preserving existing state lineage "87674e15-1efd-97bb-1cab-a0729d6f37d0"
2019/02/14 09:42:11 [TRACE] Preserving existing state lineage "87674e15-1efd-97bb-1cab-a0729d6f37d0"
2019/02/14 09:42:11 [DEBUG] plugin: waiting for all plugin processes to complete...
2019-02-14T09:42:11.942+0800 [WARN ] plugin: error closing client during Kill: err="connection is shut down"
2019-02-14T09:42:11.943+0800 [DEBUG] plugin.terraform-provider-google_v2.0.0_x4: 2019/02/14 09:42:11 [ERR] plugin: plugin server: accept unix /tmp/plugin860840262: use of closed network connection
2019-02-14T09:42:11.943+0800 [DEBUG] plugin.terraform-provider-kubernetes_v1.5.0_x4: 2019/02/14 09:42:11 [ERR] plugin: plugin server: accept unix /tmp/plugin740257392: use of closed network connection
2019-02-14T09:42:11.943+0800 [DEBUG] plugin.terraform-provider-template_v2.0.0_x4: 2019/02/14 09:42:11 [ERR] plugin: plugin server: accept unix /tmp/plugin104656643: use of closed network connection
2019-02-14T09:42:11.945+0800 [DEBUG] plugin: plugin process exited: path=/home/yongwen/work/infrastructure/environments/staging/vault_config/.terragrunt-cache/QarM9UgOMAHjDA94UF_k1VXDZEM/21U6kA8AebSiwWAB3d83O_5MaYo/modules/vault_config/.terraform/plugins/linux_amd64/terraform-provider-template_v2.0.0_x4
2019-02-14T09:42:11.947+0800 [DEBUG] plugin: plugin process exited: path=/home/yongwen/work/infrastructure/environments/staging/vault_config/.terragrunt-cache/QarM9UgOMAHjDA94UF_k1VXDZEM/21U6kA8AebSiwWAB3d83O_5MaYo/modules/vault_config/.terraform/plugins/linux_amd64/terraform-provider-google_v2.0.0_x4
2019-02-14T09:42:11.949+0800 [DEBUG] plugin: plugin process exited: path=/home/yongwen/work/infrastructure/environments/staging/vault_config/.terragrunt-cache/QarM9UgOMAHjDA94UF_k1VXDZEM/21U6kA8AebSiwWAB3d83O_5MaYo/modules/vault_config/.terraform/plugins/linux_amd64/terraform-provider-kubernetes_v1.5.0_x4



!!!!!!!!!!!!!!!!!!!!!!!!!!! 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.

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

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!
[terragrunt] 2019/02/14 09:42:11 Hit multiple errors:
exit status 1

- Make `bound_service_account_names`, `bound_service_account_namespaces`
and `policies` be of type schema.TypeSet
- Simplify reading and setting of data to fix crashes
- Add `bound_cidrs` and `num_uses` parameters to resource
Copy link
Contributor

@tyrannosaurus-becks tyrannosaurus-becks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lawliet89 this looks great! Thank you for working on it.

I just have a couple of questions due to my being rather unfamiliar with this resource.

@tyrannosaurus-becks tyrannosaurus-becks self-assigned this Feb 20, 2019
Copy link
Contributor

@tyrannosaurus-becks tyrannosaurus-becks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lawliet89 thanks for circling back around and answering my questions here. Much appreciated!

@tyrannosaurus-becks tyrannosaurus-becks merged commit 64dfb8b into hashicorp:master Feb 20, 2019
dandandy pushed a commit to dandandy/terraform-provider-vault that referenced this pull request Jun 17, 2021
Fix `kubernetes_auth_backend_role` issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants