Closed nickbabkin closed 3 years ago
The issue is hidden somewhere here:
2021-09-29T18:20:24.666Z [WARN] Provider "registry.terraform.io/cloudflare/cloudflare" produced an invalid plan for module.zone_example_com.cloudflare_ruleset.default["0"], but we are tolerating it because it is using the legacy plugin SDK. The following problems may be the cause of any confusing errors from downstream operations:
can you please provide a simple reproduction case for this? i don't have the bandwidth to delve into this elaborate module to diagnose the issue. i suspect you're setting empty fields that shouldn't be set though.
@jacobbednarz I'll try to provide a simple reproduction.
A short summary: According to the logs, clearly something is wrong with action_parameters.products value. But as you see in the config, I'm not even providing it. This is super strange.
panic: interface conversion: interface {} is nil, not map[string]interface {}
FYI: I've linked an issue for cloudflare_firewall_rule
which also seems to have an issue with the parameter products
@nickbabkin i think there is a bit of confusion here as the issue isn't with the products attribute, that is just a log line saying it doesn't have a mapping associated which is fine. the backtrace shows your issue is that L665 which is related to categories and you are applying them as an empty list.
closing this off as we haven't managed to get a minimal reproduction test case. feel free to let me know if you get a test case and we can dig further into it.
Confirmation
Terraform and Cloudflare provider version
Terraform v1.0.6 on darwin_amd64
Affected resource(s)
cloudflare_ruleset
Terraform configuration files
Debug output
module.zone_example_com.cloudflare_ruleset.default["0"]: Creating... 2021-09-29T17:46:50.302Z [INFO] Starting apply for module.zone_example_com.cloudflare_ruleset.default["0"] 2021-09-29T17:46:50.303Z [DEBUG] module.zone_example_com.cloudflare_ruleset.default["0"]: applying the planned Create change 2021-09-29T17:46:50.304Z [INFO] provider.terraform-provider-cloudflare_v3.1.0: 2021/09/29 17:46:50 [DEBUG] unknown key encountered in buildRulesetRulesFromResource for action parameters: products: timestamp=2021-09-29T17:46:50.304Z 2021-09-29T17:46:50.306Z [DEBUG] provider.terraform-provider-cloudflare_v3.1.0: PANIC: interface conversion: interface {} is nil, not map[string]interface {} 2021-09-29T17:46:50.306Z [DEBUG] provider.terraform-provider-cloudflare_v3.1.0: 2021-09-29T17:46:50.306Z [DEBUG] provider.terraform-provider-cloudflare_v3.1.0: goroutine 55 [running]: 2021-09-29T17:46:50.306Z [DEBUG] provider.terraform-provider-cloudflare_v3.1.0: github.com/cloudflare/terraform-provider-cloudflare/cloudflare.buildRulesetRulesFromResource({0xc00063e240, 0x1d}, {0xe40580, 0xc0006d14b8}) 2021-09-29T17:46:50.306Z [DEBUG] provider.terraform-provider-cloudflare_v3.1.0: github.com/cloudflare/terraform-provider-cloudflare/cloudflare/resource_cloudflare_ruleset.go:665 +0x1ce7 2021-09-29T17:46:50.306Z [DEBUG] provider.terraform-provider-cloudflare_v3.1.0: github.com/cloudflare/terraform-provider-cloudflare/cloudflare.resourceCloudflareRulesetCreate(0x0, {0xfdb3c0, 0xc000146300}) 2021-09-29T17:46:50.306Z [DEBUG] provider.terraform-provider-cloudflare_v3.1.0: github.com/cloudflare/terraform-provider-cloudflare/cloudflare/resource_cloudflare_ruleset.go:341 +0x2d7 2021-09-29T17:46:50.306Z [DEBUG] provider.terraform-provider-cloudflare_v3.1.0: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).create(0xe9eb40, {0x1206248, 0xc000588100}, 0x2, {0xfdb3c0, 0xc000146300}) 2021-09-29T17:46:50.306Z [DEBUG] provider.terraform-provider-cloudflare_v3.1.0: github.com/hashicorp/terraform-plugin-sdk/v2@v2.7.1/helper/schema/resource.go:318 +0x178 2021-09-29T17:46:50.306Z [DEBUG] provider.terraform-provider-cloudflare_v3.1.0: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).Apply(0xc0001dce00, {0x1206248, 0xc000588100}, 0xc00063c3f0, 0xc0009ba560, {0xfdb3c0, 0xc000146300}) 2021-09-29T17:46:50.306Z [DEBUG] provider.terraform-provider-cloudflare_v3.1.0: github.com/hashicorp/terraform-plugin-sdk/v2@v2.7.1/helper/schema/resource.go:456 +0x871 2021-09-29T17:46:50.306Z [DEBUG] provider.terraform-provider-cloudflare_v3.1.0: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(GRPCProviderServer).ApplyResourceChange(0xc0005900d8, {0x1206248, 0xc000588100}, 0xc00062c910) 2021-09-29T17:46:50.306Z [DEBUG] provider.terraform-provider-cloudflare_v3.1.0: github.com/hashicorp/terraform-plugin-sdk/v2@v2.7.1/helper/schema/grpc_provider.go:955 +0x9aa 2021-09-29T17:46:50.306Z [DEBUG] provider.terraform-provider-cloudflare_v3.1.0: github.com/hashicorp/terraform-plugin-go/tfprotov5/server.(server).ApplyResourceChange(0xc000535ac0, {0x12062f0, 0xc0009e2000}, 0x0) 2021-09-29T17:46:50.306Z [DEBUG] provider.terraform-provider-cloudflare_v3.1.0: github.com/hashicorp/terraform-plugin-go@v0.3.1/tfprotov5/server/server.go:332 +0x6c 2021-09-29T17:46:50.306Z [DEBUG] provider.terraform-provider-cloudflare_v3.1.0: github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0xf9dbc0, 0xc000535ac0}, {0x12062f0, 0xc0009e2000}, 0xc000388360, 0x0) 2021-09-29T17:46:50.306Z [DEBUG] provider.terraform-provider-cloudflare_v3.1.0: github.com/hashicorp/terraform-plugin-go@v0.3.1/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:380 +0x170 2021-09-29T17:46:50.306Z [DEBUG] provider.terraform-provider-cloudflare_v3.1.0: google.golang.org/grpc.(Server).processUnaryRPC(0xc0006dba40, {0x1217c28, 0xc0002ae600}, 0xc000bb3560, 0xc00023e2a0, 0x18b0e60, 0x0) 2021-09-29T17:46:50.306Z [DEBUG] provider.terraform-provider-cloudflare_v3.1.0: google.golang.org/grpc@v1.40.0/server.go:1297 +0xccf 2021-09-29T17:46:50.306Z [DEBUG] provider.terraform-provider-cloudflare_v3.1.0: google.golang.org/grpc.(Server).handleStream(0xc0006dba40, {0x1217c28, 0xc0002ae600}, 0xc000bb3560, 0x0) 2021-09-29T17:46:50.306Z [DEBUG] provider.terraform-provider-cloudflare_v3.1.0: google.golang.org/grpc@v1.40.0/server.go:1626 +0xa2a 2021-09-29T17:46:50.306Z [DEBUG] provider.terraform-provider-cloudflare_v3.1.0: google.golang.org/grpc.(Server).serveStreams.func1.2() 2021-09-29T17:46:50.306Z [DEBUG] provider.terraform-provider-cloudflare_v3.1.0: google.golang.org/grpc@v1.40.0/server.go:941 +0x98 2021-09-29T17:46:50.306Z [DEBUG] provider.terraform-provider-cloudflare_v3.1.0: created by google.golang.org/grpc.(Server).serveStreams.func1 2021-09-29T17:46:50.306Z [DEBUG] provider.terraform-provider-cloudflare_v3.1.0: google.golang.org/grpc@v1.40.0/server.go:939 +0x294 2021-09-29T17:46:50.308Z [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing" 2021-09-29T17:46:50.308Z [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/cloudflare/cloudflare/3.1.0/linux_amd64/terraform-provider-cloudflare_v3.1.0 pid=241 error="exit status 2" 2021-09-29T17:46:50.308Z [ERROR] plugin.(*GRPCProvider).ApplyResourceChange: error="rpc error: code = Unavailable desc = transport is closing"
Panic output
Stack trace from the terraform-provider-cloudflare_v3.1.0 plugin:
panic: interface conversion: interface {} is nil, not map[string]interface {}
goroutine 55 [running]: github.com/cloudflare/terraform-provider-cloudflare/cloudflare.buildRulesetRulesFromResource({0xc00063e240, 0x1d}, {0xe40580, 0xc0006d14b8}) github.com/cloudflare/terraform-provider-cloudflare/cloudflare/resource_cloudflare_ruleset.go:665 +0x1ce7 github.com/cloudflare/terraform-provider-cloudflare/cloudflare.resourceCloudflareRulesetCreate(0x0, {0xfdb3c0, 0xc000146300}) github.com/cloudflare/terraform-provider-cloudflare/cloudflare/resource_cloudflare_ruleset.go:341 +0x2d7 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).create(0xe9eb40, {0x1206248, 0xc000588100}, 0x2, {0xfdb3c0, 0xc000146300}) github.com/hashicorp/terraform-plugin-sdk/v2@v2.7.1/helper/schema/resource.go:318 +0x178 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).Apply(0xc0001dce00, {0x1206248, 0xc000588100}, 0xc00063c3f0, 0xc0009ba560, {0xfdb3c0, 0xc000146300}) github.com/hashicorp/terraform-plugin-sdk/v2@v2.7.1/helper/schema/resource.go:456 +0x871 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(GRPCProviderServer).ApplyResourceChange(0xc0005900d8, {0x1206248, 0xc000588100}, 0xc00062c910) github.com/hashicorp/terraform-plugin-sdk/v2@v2.7.1/helper/schema/grpc_provider.go:955 +0x9aa github.com/hashicorp/terraform-plugin-go/tfprotov5/server.(server).ApplyResourceChange(0xc000535ac0, {0x12062f0, 0xc0009e2000}, 0x0) github.com/hashicorp/terraform-plugin-go@v0.3.1/tfprotov5/server/server.go:332 +0x6c github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0xf9dbc0, 0xc000535ac0}, {0x12062f0, 0xc0009e2000}, 0xc000388360, 0x0) github.com/hashicorp/terraform-plugin-go@v0.3.1/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:380 +0x170 google.golang.org/grpc.(Server).processUnaryRPC(0xc0006dba40, {0x1217c28, 0xc0002ae600}, 0xc000bb3560, 0xc00023e2a0, 0x18b0e60, 0x0) google.golang.org/grpc@v1.40.0/server.go:1297 +0xccf google.golang.org/grpc.(Server).handleStream(0xc0006dba40, {0x1217c28, 0xc0002ae600}, 0xc000bb3560, 0x0) google.golang.org/grpc@v1.40.0/server.go:1626 +0xa2a google.golang.org/grpc.(Server).serveStreams.func1.2() google.golang.org/grpc@v1.40.0/server.go:941 +0x98 created by google.golang.org/grpc.(Server).serveStreams.func1 google.golang.org/grpc@v1.40.0/server.go:939 +0x294
Error: The terraform-provider-cloudflare_v3.1.0 plugin crashed!
This is always indicative of a bug within the plugin. It would be immensely helpful if you could report the crash with the plugin's maintainers so that it can be fixed. The output above should help diagnose the issue.
╷ │ Error: Plugin did not respond │ │ with module.zone_example_com.cloudflare_ruleset.default["0"], │ on modules/zone/main.tf line 248, in resource "cloudflare_ruleset" "default": │ 248: resource "cloudflare_ruleset" "default" { │ │ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details. ╵ 2021-09-29T17:46:50.956Z [DEBUG] provider: plugin exited
Expected output
Resource added
Actual output
Panic
Steps to reproduce
Additional factoids
No response
References
No response