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(container_node_pool): panic interface conversion on linux_node_config.sysctls #15941

Conversation

modular-magician
Copy link
Collaborator

Fixes: #15847

  • Add type assertion to extract empty values from linux_node_config.sysctls field
  • Clean up existing test case to only pass single sysctls parameter to be changed
  • Add test case to create a nodepool with empty linux_node_config.sysctls

Without the fix, the test case to create a nodepool with empty linux_node_config.sysctls will fail.

make testacc TEST=./google/services/container TESTARGS='-run=TestAccContainerNodePool_withLinuxNodeConfig'
TF_ACC=1 TF_SCHEMA_PANIC_ON_ERROR=1 go test ./google/services/container -v -run=TestAccContainerNodePool_withLinuxNodeConfig -timeout 240m -ldflags="-X=github.com/hashicorp/terraform-provider-google/version.ProviderVersion=acc"
=== RUN   TestAccContainerNodePool_withLinuxNodeConfig
=== PAUSE TestAccContainerNodePool_withLinuxNodeConfig
=== CONT  TestAccContainerNodePool_withLinuxNodeConfig
panic: interface conversion: interface {} is nil, not map[string]interface {}

goroutine 1276 [running]:
github.com/hashicorp/terraform-provider-google/google/services/container.expandLinuxNodeConfig(...)
	/Users/tsubasanagasawa/go/src/github.com/hashicorp/terraform-provider-google/google/services/container/node_config.go:927
github.com/hashicorp/terraform-provider-google/google/services/container.expandNodeConfig({0x1071ec840?, 0x14001a923d8?})
	/Users/tsubasanagasawa/go/src/github.com/hashicorp/terraform-provider-google/google/services/container/node_config.go:849 +0x1808
github.com/hashicorp/terraform-provider-google/google/services/container.expandNodePool(0x1079eb778?, {0x0, 0x0})
	/Users/tsubasanagasawa/go/src/github.com/hashicorp/terraform-provider-google/google/services/container/resource_container_node_pool.go:867 +0x2f8
github.com/hashicorp/terraform-provider-google/google/services/container.resourceContainerNodePoolCreate(0x140029c3380, {0x107989740?, 0x14000f32400?})
	/Users/tsubasanagasawa/go/src/github.com/hashicorp/terraform-provider-google/google/services/container/resource_container_node_pool.go:477 +0x120
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0x1079e2678?, {0x1079e2678?, 0x1400140e630?}, 0xd?, {0x107989740?, 0x14000f32400?})
	/Users/tsubasanagasawa/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.0/helper/schema/resource.go:695 +0x134
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0x140007ad500, {0x1079e2678, 0x1400140e630}, 0x140019cbc70, 0x140029c3200, {0x107989740, 0x14000f32400})
	/Users/tsubasanagasawa/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.0/helper/schema/resource.go:837 +0x888
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0x14000eab110, {0x1079e2678?, 0x1400140e570?}, 0x140024650e0)
	/Users/tsubasanagasawa/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.0/helper/schema/grpc_provider.go:1021 +0xb78
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.muxServer.ApplyResourceChange({0x140010720c0, 0x14001072120, {0x1400230eee0, 0x2, 0x2}, {0x0, 0x0, 0x0}, {0x0, 0x0, ...}, ...}, ...)
	/Users/tsubasanagasawa/go/pkg/mod/github.com/hashicorp/terraform-plugin-mux@v0.8.0/tf5muxserver/mux_server_ApplyResourceChange.go:27 +0xdc
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0x140024483c0, {0x1079e2678?, 0x140013d1d40?}, 0x1400196c770)
	/Users/tsubasanagasawa/go/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.14.3/tfprotov5/tf5server/server.go:818 +0x3bc
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x107904520?, 0x140024483c0}, {0x1079e2678, 0x140013d1d40}, 0x1400196c700, 0x0)
	/Users/tsubasanagasawa/go/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.14.3/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:385 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0x14000c22000, {0x1079eb898, 0x140027c7380}, 0x140019bdb00, 0x14001b552c0, 0x108f5a8e0, 0x0)
	/Users/tsubasanagasawa/go/pkg/mod/google.golang.org/grpc@v1.57.0/server.go:1360 +0xcb4
google.golang.org/grpc.(*Server).handleStream(0x14000c22000, {0x1079eb898, 0x140027c7380}, 0x140019bdb00, 0x0)
	/Users/tsubasanagasawa/go/pkg/mod/google.golang.org/grpc@v1.57.0/server.go:1737 +0x82c
google.golang.org/grpc.(*Server).serveStreams.func1.1()
	/Users/tsubasanagasawa/go/pkg/mod/google.golang.org/grpc@v1.57.0/server.go:982 +0x84
created by google.golang.org/grpc.(*Server).serveStreams.func1
	/Users/tsubasanagasawa/go/pkg/mod/google.golang.org/grpc@v1.57.0/server.go:980 +0x16c
FAIL	github.com/hashicorp/terraform-provider-google/google/services/container	331.318s
FAIL

Release Note Template for Downstream PRs (will be copied)

container: fixed an issue in `google_container_node_pool` where empty `linux_node_config.sysctls` would crash the provider

Derived from GoogleCloudPlatform/magic-modules#8981

…onfig.sysctls` (hashicorp#8981)

Co-authored-by: Shuya Ma <87669292+shuyama1@users.noreply.github.com>
Signed-off-by: Modular Magician <magic-modules@google.com>
@modular-magician modular-magician merged commit 77bda19 into hashicorp:main Sep 22, 2023
4 checks passed
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

panic: interface conversion: interface {} is nil, not map[string]interface {}
1 participant