IBM-Cloud / terraform-provider-ibm

https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs
Mozilla Public License 2.0
339 stars 650 forks source link

ibm_is_vpn_gateway: provider crash during terraform apply #4898

Open toddgiguere opened 9 months ago

toddgiguere commented 9 months ago

Community Note

Terraform CLI and Terraform IBM Provider Version

Affected Resource(s)

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

resource "ibm_is_vpn_gateway" "gateway" {
  for_each       = local.vpn_gateway_map
  name           = "${var.prefix}-${each.key}"
  subnet         = each.value.subnet_id
  mode           = each.value.mode
  resource_group = each.value.resource_group == null ? null : local.resource_groups[each.value.resource_group]
  tags           = var.tags
  access_tags    = each.value.access_tags

  timeouts {
    delete = "1h"
  }
}

Part of larger DA project: https://github.com/terraform-ibm-modules/terraform-ibm-landing-zone/tree/main

Debug Output

module.vsi_landing_zone.module.landing_zone.ibm_is_vpn_gateway.gateway["management-gateway"]: Still creating... [3m10s elapsed]
 │ Error: Plugin did not respond
 │ 
 │   with module.vsi_landing_zone.module.landing_zone.ibm_is_vpn_gateway.gateway["management-gateway"],
 │   on ../../vpn.tf line 17, in resource "ibm_is_vpn_gateway" "gateway":
 │   17: resource "ibm_is_vpn_gateway" "gateway" {
 │ 
 │ The plugin encountered an error, and failed to respond to the
 │ plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may
 │ contain more details.

  Stack trace from the terraform-provider-ibm_v1.58.1 plugin:
 panic: runtime error: invalid memory address or nil pointer dereference
 [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x36ae0bd]

Panic Output

goroutine 2419 [running]:
github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/vpc.vpngwGet(0xc002421c80, {0x439a720?, 0xc0024ca000}, {0xc001af7cb0, 0x29})
    github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/vpc/resource_ibm_is_vpn_gateway.go:493 +0x99d
github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/vpc.resourceIBMISVPNGatewayRead(0xc002421c80, {0x439a720, 0xc0024ca000})
    github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/vpc/resource_ibm_is_vpn_gateway.go:424 +0xc8
github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/vpc.resourceIBMISVPNGatewayCreate(0x0?, {0x439a720, 0xc0024ca000})
    github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/vpc/resource_ibm_is_vpn_gateway.go:325 +0x13b
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0x4c74d70?, {0x4c74d70?, 0xc001b9ade0?}, 0xd?, {0x439a720?, 0xc0024ca000?})
    github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.0/helper/schema/resource.go:695 +0x178
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc001002ee0, {0x4c74d70, 0xc001b9ade0}, 0xc000d80270, 0xc002421800, {0x439a720, 0xc0024ca000})
    github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.0/helper/schema/resource.go:837 +0xa7a
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc0009644b0, {0x4c74d70?, 0xc001b9acc0?}, 0xc000894af0)
    github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.0/helper/schema/grpc_provider.go:1021 +0xe3c
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc0008ce640, {0x4c74d70?, 0xc001b9a660?}, 0xc00157d730)
    github.com/hashicorp/terraform-plugin-go@v0.14.0/tfprotov5/tf5server/server.go:818 +0x574
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x4205c20?, 0xc0008ce640}, {0x4c74d70, 0xc001b9a660}, 0xc00157d6c0, 0x0)
    github.com/hashicorp/terraform-plugin-go@v0.14.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:385 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000000960, {0x4c7cb40, 0xc00124e820}, 0xc0015f7560, 0xc001215740, 0x6a87720, 0x0)
    google.golang.org/grpc@v1.57.0/server.go:1360 +0xe13
google.golang.org/grpc.(*Server).handleStream(0xc000000960, {0x4c7cb40, 0xc00124e820}, 0xc0015f7560, 0x0)
    google.golang.org/grpc@v1.57.0/server.go:1737 +0xa1b
google.golang.org/grpc.(*Server).serveStreams.func1.1()
    google.golang.org/grpc@v1.57.0/server.go:982 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
    google.golang.org/grpc@v1.57.0/server.go:980 +0x18c

Error: The terraform-provider-ibm_v1.58.1 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.

TestRunVSIPatternWithHPCS 2023-10-31T06:19:27Z retry.go:99: Returning due to fatal error: FatalError{Underlying: error while running command: exit status 1; ╷
│ Error: Plugin did not respond

Expected Behavior

Apply without error

Actual Behavior

Cannot reproduce at will.

This panic error (provider crash) happens intermittently, and is not consistent. We have observed this error in our CI process, so the variables submitted to this terraform block are not changing between a successful run and one that causes this panic.

Steps to Reproduce

  1. terraform apply

Important Factoids

Can provide full terraform trace log if required (very large)

References

ocofaigh commented 9 months ago

Also facing this issue VERY frequently in the past few days when running the terraform code in here -> https://github.com/terraform-ibm-modules/terraform-ibm-landing-zone/tree/main/patterns

ujjwal-ibm commented 9 months ago

looking at it

ocofaigh commented 8 months ago

Looks like PR for this was merged https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4903 ?

ocofaigh commented 8 months ago

Looks like fix is in https://github.com/IBM-Cloud/terraform-provider-ibm/releases/tag/v1.60.0 - can we close this issue?

deepaksibm commented 4 months ago

As per above comment requesting to close the issue @sumitkumartiwari