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

Terraform import for routingtable fails #2580

Closed
soumypau1 opened this issue May 5, 2021 · 1 comment · Fixed by #2583
Closed

Terraform import for routingtable fails #2580

soumypau1 opened this issue May 5, 2021 · 1 comment · Fixed by #2583
Labels
service/VPC Infrastructure Issues related to the VPC Infrastructure

Comments

@soumypau1
Copy link

soumypau1 commented May 5, 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 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 CLI and Terraform IBM Provider Version

Terraform v0.15.0
on linux_amd64

  • provider registry.terraform.io/ibm-cloud/ibm v1.24.0

Affected Resource(s)

ibm_is_vpc_routing_table

Terraform Configuration Files

We have accidentally lost the terraform state file and trying to regenerate the state by executing terraform import.
While importing is working for VPC, subnet etc, importing of routing table is failing.

Per the error message, its a bug in the plugin.

terraform import module.msp-hec-pa-vpc.ibm_is_vpc_routing_table.rt-msp-hec-pa-1 r010-7b19b66d-9cc6-43a2-a774-f7f1cae6fa40
module.msp-hec-pa-vpc.ibm_is_vpc_routing_table.rt-msp-hec-pa-1: Importing from ID "r010-7b19b66d-9cc6-43a2-a774-f7f1cae6fa40"...
module.msp-hec-pa-vpc.ibm_is_vpc_routing_table.rt-msp-hec-pa-1: Import prepared!
  Prepared ibm_is_vpc_routing_table for import
module.msp-hec-pa-vpc.ibm_is_vpc_routing_table.rt-msp-hec-pa-1: Refreshing state... [id=r010-7b19b66d-9cc6-43a2-a774-f7f1cae6fa40]

Stack trace from the terraform-provider-ibm_v1.24.0 plugin:

panic: runtime error: index out of range [1] with length 1

goroutine 101 [running]:
github.com/IBM-Cloud/terraform-provider-ibm/ibm.resourceIBMISVPCRoutingTableExists(0xc0000bdf00, 0x2b0a8e0, 0xc000fdb800, 0x0, 0x0, 0x1)
	github.com/IBM-Cloud/terraform-provider-ibm/ibm/resource_ibm_is_vpc_routing_table.go:311 +0x478
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc00092c000, 0x2fc8020, 0xc00028a000, 0xc0001693b0, 0x2b0a8e0, 0xc000fdb800, 0xc00000e9b8, 0x0, 0x0, 0x0)
	github.com/hashicorp/terraform-plugin-sdk/v2@v2.4.4/helper/schema/resource.go:544 +0x3d5
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0xc0005098e0, 0x2fc8020, 0xc00028a000, 0xc00028a040, 0xc00028a000, 0x2973640, 0x2a30760)
	github.com/hashicorp/terraform-plugin-sdk/v2@v2.4.4/helper/schema/grpc_provider.go:575 +0x43b
github.com/hashicorp/terraform-plugin-go/tfprotov5/server.(*server).ReadResource(0xc000c186a0, 0x2fc8020, 0xc00028a000, 0xc001080840, 0xc000c186a0, 0xc0002047b0, 0xc000c3aba0)
	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(0x2a30760, 0xc000c186a0, 0x2fc80e0, 0xc0002047b0, 0xc0010807e0, 0x0, 0x2fc80e0, 0xc0002047b0, 0xc0001da380, 0x1ad)
	github.com/hashicorp/terraform-plugin-go@v0.2.1/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:344 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc00082e380, 0x2fe4520, 0xc000568300, 0xc0000b2a00, 0xc000969bc0, 0x3eb6810, 0x0, 0x0, 0x0)
	google.golang.org/grpc@v1.32.0/server.go:1194 +0x522
google.golang.org/grpc.(*Server).handleStream(0xc00082e380, 0x2fe4520, 0xc000568300, 0xc0000b2a00, 0x0)
	google.golang.org/grpc@v1.32.0/server.go:1517 +0xd05
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc0003d15c0, 0xc00082e380, 0x2fe4520, 0xc000568300, 0xc0000b2a00)
	google.golang.org/grpc@v1.32.0/server.go:859 +0xa5
created by google.golang.org/grpc.(*Server).serveStreams.func1
	google.golang.org/grpc@v1.32.0/server.go:857 +0x1fd

Error: The terraform-provider-ibm_v1.24.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
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ReadResource call. The plugin logs may contain more details.<!---
Please provide a link to a GitHub Gist containing the complete debug output. Please do NOT paste the debug output in the issue; just paste a link to the Gist.

To obtain the debug output, see the [Terraform documentation on debugging](https://www.terraform.io/docs/internals/debugging.html).
--->

### Panic Output

<!--- If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the `crash.log`. --->

### Expected Behavior

State is imported

### Actual Behavior

Terraform plugin crashes

### Steps to Reproduce

Create a VPC, sunet and routing table. 
Import the routing table

1. `terraform apply`

### Important Factoids

<!--- Are there anything atypical about your accounts that we should know? For example: Running in EC2 Classic? --->

### References

https://medium.com/@abtreece/recovering-terraform-state-69c9966db71e

* #0000
@kavya498 kavya498 added the service/VPC Infrastructure Issues related to the VPC Infrastructure label May 6, 2021
@kavya498
Copy link
Collaborator

kavya498 commented May 6, 2021

@soumypau1 ,
looks like id that you are using is incorrect
It should be a combination of vpcID and routing table ID

please refer https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/is_vpc_routing_table#import

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service/VPC Infrastructure Issues related to the VPC Infrastructure
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants