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

google_compute_router_peer panic on flattenNestedComputeRouterBgpPeerEnable #9891

Closed
jehiah opened this issue Aug 24, 2021 · 9 comments · Fixed by GoogleCloudPlatform/magic-modules#5133, hashicorp/terraform-provider-google-beta#3579 or #9940
Assignees

Comments

@jehiah
Copy link

jehiah commented Aug 24, 2021

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 me too comments, 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.
  • If an issue is assigned to the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.

Terraform Version

terraform --version
Terraform v1.0.5
on linux_amd64
+ provider registry.terraform.io/hashicorp/google v3.81.0
+ provider registry.terraform.io/hashicorp/google-beta v3.81.0
+ provider registry.terraform.io/hashicorp/kubernetes v2.4.1

Affected Resource(s)

  • google_compute_router_peer

Terraform Configuration Files

# The resource erroring is as follows (terraform is extensive and can't be shared in it's entirety)
#
resource "google_compute_router_peer" "peer_router01" {
  name                      = "peer-router01"
  project                   = google_project.prod.project_id
  router                    = google_compute_router.router01.name
  region                    = "us-east4"
  peer_ip_address           = "REDACTED"
  peer_asn                  = "REDACTED"
  advertised_route_priority = 100
  interface                 = google_compute_router_interface.router1_interface1_us_east4.name
}

Debug Output

Panic Output

terraform plan --target=google_compute_router_peer.peer_router01
google_project.gcp_prod: Refreshing state... [id=gcp-prod]
google_compute_network.prod: Refreshing state... [id=prod]
google_compute_router.router01: Refreshing state... [id=us-east4/router01]
google_compute_external_vpn_gateway.aws_external_gateway: Refreshing state... [id=projects/gcp-prod/global/externalVpnGateways/external-gateway]
google_compute_ha_vpn_gateway.ha_vpn_gateway: Refreshing state... [id=projects/gcp-prod/regions/us-east4/vpnGateways/gcp-ha-gateway]
google_compute_vpn_tunnel.tunnel1_us_east4: Refreshing state... [id=projects/gcp-prod/regions/us-east4/vpnTunnels/vpn-tunnel1-us-east4]
google_compute_router_interface.router1_interface1_us_east4: Refreshing state... [id=us-east4/router01/router1-interface1-us-east4]
google_compute_router_peer.peer_router01: Refreshing state... [id=projects/gcp-prod/regions/us-east4/routers/router01/peer-router01]
╷
│ Warning: Resource targeting is in effect
│ 
│ You are creating a plan with the -target option, which means that the result of this plan may not represent all of the changes requested by the current configuration.
│ 		
│ The -target option is not for routine use, and is provided only for exceptional situations such as recovering from errors or mistakes, or when Terraform specifically suggests to use it
│ as part of an error message.
╵
╷
│ Error: Plugin did not respond
│ 
│   with google_compute_router_peer.peer_router01,
│   on gcp_vpn.tf line 74, in resource "google_compute_router_peer" "peer_router01":
│   74: resource "google_compute_router_peer" "peer_router01" {
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ReadResource call. The plugin logs may contain more details.
╵

Stack trace from the terraform-provider-google_v3.81.0_x5 plugin:

panic: interface conversion: interface {} is nil, not string

goroutine 168 [running]:
github.com/hashicorp/terraform-provider-google/google.flattenNestedComputeRouterBgpPeerEnable(...)
	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-google/google/resource_compute_router_peer.go:670
github.com/hashicorp/terraform-provider-google/google.resourceComputeRouterBgpPeerRead(0xc0009ac080, 0x2e50ac0, 0xc00061ce00, 0x4214890, 0xc000032c00)
	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-google/google/resource_compute_router_peer.go:389 +0x15c5
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0xc000327c00, 0x3373480, 0xc000fe3280, 0xc0009ac080, 0x2e50ac0, 0xc00061ce00, 0x0, 0x0, 0x0)
	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.5.0/helper/schema/resource.go:335 +0x1ee
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc000327c00, 0x3373480, 0xc000fe3280, 0xc0002f5ab0, 0x2e50ac0, 0xc00061ce00, 0xc000d8a6a0, 0x0, 0x0, 0x0)
	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.5.0/helper/schema/resource.go:624 +0x1cb
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0xc00064af00, 0x3373480, 0xc000fe3280, 0xc000fe32c0, 0xc000fe3280, 0x40ba05, 0x2bee300)
	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.5.0/helper/schema/grpc_provider.go:575 +0x43b
github.com/hashicorp/terraform-plugin-go/tfprotov5/server.(*server).ReadResource(0xc000cd0180, 0x3373528, 0xc000fe3280, 0xc000afc900, 0xc000cd0180, 0xc000aeac30, 0xc000877ba0)
	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.2.1/tfprotov5/server/server.go:298 +0x105
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler(0x2d9d240, 0xc000cd0180, 0x3373528, 0xc000aeac30, 0xc000afc8a0, 0x0, 0x3373528, 0xc000aeac30, 0xc000a7cb40, 0x219)
	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.2.1/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:344 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000443180, 0x33adb98, 0xc0000bfe00, 0xc000afeb40, 0xc000821140, 0x41d21d0, 0x0, 0x0, 0x0)
	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.38.0/server.go:1286 +0x52b
google.golang.org/grpc.(*Server).handleStream(0xc000443180, 0x33adb98, 0xc0000bfe00, 0xc000afeb40, 0x0)
	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.38.0/server.go:1609 +0xd0c
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc00063e510, 0xc000443180, 0x33adb98, 0xc0000bfe00, 0xc000afeb40)
	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.38.0/server.go:934 +0xab
created by google.golang.org/grpc.(*Server).serveStreams.func1
	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.38.0/server.go:932 +0x1fd

Error: The terraform-provider-google_v3.81.0_x5 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.

Expected Behavior

Plan output w/o any changes

Actual Behavior

google provider panic's

Steps to Reproduce

  1. terraform plan --target=google_compute_router_peer.peer_router01

Important Factoids

I encountered this when attempting to upgrade from v0.13.5 to v1.0.5. terraform produced a clean plan on v0.13.5 but panics when planning against this resource.

References

@Tfmenard
Copy link

The error only occurs on 3.81.0 as the panic is caused by a function introduced in 3.81.0 and seems to only occur for some resources that were created at least 90d back.
GoogleCloudPlatform/magic-modules#5063
https://github.com/hashicorp/terraform-provider-google/pull/9776/files#diff-896b820fb17f7590acf4ac0ca66d70dc3b57329054987a0296f46ae23b0ee86cR669

If you encounter this error, move to a provider version <3.81.0 or move to >=3.82.0 which should have the fix
GoogleCloudPlatform/magic-modules#5133

@jehiah
Copy link
Author

jehiah commented Aug 30, 2021

Thank you @Tfmenard

@seankhliao
Copy link

@Tfmenard I think we're still seeing this on 3.82.0 ?

The plugin.(*GRPCProvider).UpgradeResourceState request was cancelled.

Stack trace from the terraform-provider-google_v3.82.0_x5 plugin:

panic: interface conversion: interface {} is nil, not string

goroutine 1987 [running]:
github.com/hashicorp/terraform-provider-google/google.flattenNestedComputeRouterBgpPeerEnable(...)
 /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-google/google/resource_compute_router_peer.go:670
github.com/hashicorp/terraform-provider-google/google.resourceComputeRouterBgpPeerRead(0xc000129580, 0x2f3f180, 0xc000446300, 0x436d5d0, 0xc00037c000)
 /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-google/google/resource_compute_router_peer.go:389 +0x15c5
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0xc00089d340, 0x3477c20, 0xc001128180, 0xc000129580, 0x2f3f180, 0xc000446300, 0x0, 0x0, 0x0)
 /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.5.0/helper/schema/resource.go:335 +0x1ee
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc00089d340, 0x3477c20, 0xc001128180, 0xc00037ad20, 0x2f3f180, 0xc000446300, 0xc000287430, 0x0, 0x0, 0x0)
 /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.5.0/helper/schema/resource.go:624 +0x1cb
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0xc00000d050, 0x3477c20, 0xc001128180, 0xc001128200, 0xc001128180, 0x40ba05, 0x2cd9260)
 /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.5.0/helper/schema/grpc_provider.go:575 +0x43b
github.com/hashicorp/terraform-plugin-go/tfprotov5/server.(*server).ReadResource(0xc0007336c0, 0x3477cc8, 0xc001128180, 0xc000414de0, 0xc0007336c0, 0xc001351a40, 0xc000749ba0)
 /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.2.1/tfprotov5/server/server.go:298 +0x105
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler(0x2e8a020, 0xc0007336c0, 0x3477cc8, 0xc001351a40, 0xc000414d20, 0x0, 0x3477cc8, 0xc001351a40, 0xc0009fd400, 0x254)
 /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.2.1/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:344 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0001fe540, 0x34b3fb8, 0xc000603800, 0xc000cbe5a0, 0xc0006fc540, 0x432ab50, 0x0, 0x0, 0x0)
 /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.38.0/server.go:1286 +0x52b
google.golang.org/grpc.(*Server).handleStream(0xc0001fe540, 0x34b3fb8, 0xc000603800, 0xc000cbe5a0, 0x0)
 /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.38.0/server.go:1609 +0xd0c
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc00028d880, 0xc0001fe540, 0x34b3fb8, 0xc000603800, 0xc000cbe5a0)
 /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.38.0/server.go:934 +0xab
created by google.golang.org/grpc.(*Server).serveStreams.func1
 /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.38.0/server.go:932 +0x1fd

Error: The terraform-provider-google_v3.82.0_x5 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.

@lzahorka
Copy link

lzahorka commented Sep 7, 2021

We are also seeing this issue in the newest version.

Stack trace from the terraform-provider-google_v3.82.0_x5 plugin: panic: interface conversion: interface {} is nil, not string goroutine 593 [running]: github.com/hashicorp/terraform-provider-google/google.flattenNestedComputeRouterBgpPeerEnable(...) /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-google/google/resource_compute_router_peer.go:670 github.com/hashicorp/terraform-provider-google/google.resourceComputeRouterBgpPeerRead(0xc000dfe500, 0x2f3f180, 0xc000444e00, 0x436d5d0, 0xc000100c00) /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-google/google/resource_compute_router_peer.go:389 +0x15c5 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0xc0002eb880, 0x3477c20, 0xc0007709c0, 0xc000dfe500, 0x2f3f180, 0xc000444e00, 0x0, 0x0, 0x0) /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.5.0/helper/schema/resource.go:335 +0x1ee github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc0002eb880, 0x3477c20, 0xc0007709c0, 0xc00109ce70, 0x2f3f180, 0xc000444e00, 0xc000144f38, 0x0, 0x0, 0x0) /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.5.0/helper/schema/resource.go:624 +0x1cb github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0xc00067aa68, 0x3477c20, 0xc0007709c0, 0xc000770a00, 0xc0007709c0, 0x40ba05, 0x2cd9260) /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.5.0/helper/schema/grpc_provider.go:575 +0x43b github.com/hashicorp/terraform-plugin-go/tfprotov5/server.(*server).ReadResource(0xc001209b40, 0x3477cc8, 0xc0007709c0, 0xc000763c20, 0xc001209b40, 0xc0006f3560, 0xc000483ba0) /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.2.1/tfprotov5/server/server.go:298 +0x105 github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler(0x2e8a020, 0xc001209b40, 0x3477cc8, 0xc0006f3560, 0xc000763b60, 0x0, 0x3477cc8, 0xc0006f3560, 0xc0011ae000, 0x270) /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.2.1/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:344 +0x214 google.golang.org/grpc.(*Server).processUnaryRPC(0xc00023a540, 0x34b3fb8, 0xc000103500, 0xc0005e85a0, 0xc00059c4e0, 0x432ab50, 0x0, 0x0, 0x0) /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.38.0/server.go:1286 +0x52b google.golang.org/grpc.(*Server).handleStream(0xc00023a540, 0x34b3fb8, 0xc000103500, 0xc0005e85a0, 0x0) /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.38.0/server.go:1609 +0xd0c google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc00004e2a0, 0xc00023a540, 0x34b3fb8, 0xc000103500, 0xc0005e85a0) /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.38.0/server.go:934 +0xab created by google.golang.org/grpc.(*Server).serveStreams.func1 /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.38.0/server.go:932 +0x1fd Error: The terraform-provider-google_v3.82.0_x5 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.

@aclaypool
Copy link

aclaypool commented Sep 7, 2021

Also still seeing this issue on 3.82

Stack trace from the terraform-provider-google_v3.82.0_x5 plugin:

panic: interface conversion: interface {} is nil, not string

@joe-a-t
Copy link

joe-a-t commented Sep 9, 2021

@jehiah @Tfmenard @edwardmedia Can one of you please re-open this issue since it is still appearing in 3.82?

@jehiah
Copy link
Author

jehiah commented Sep 9, 2021

This fix was not actually included in v3.82, but is in v3.83

v3.82.0...v3.83.0

@joe-a-t
Copy link

joe-a-t commented Sep 10, 2021

Everything looks good on 3.83, thanks!

@github-actions
Copy link

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 have found a problem that seems similar to this, 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 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.