terraform-provider-google: Google provider latest version 4.42.0 is crashing

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

Affected Resource(s)

  • google_4.42.0

Terraform Configuration Files

# Copy-paste your Terraform configurations here.
#
# For large Terraform configs, please use a service like Dropbox and share a link to the ZIP file.
# For security, you can also encrypt the files using our GPG public key:
#    https://www.hashicorp.com/security
#
# If reproducing the bug involves modifying the config file (e.g., apply a config,
# change a value, apply the config again, see the bug), then please include both:
# * the version of the config before the change, and
# * the version of the config after the change.

Debug Output

Panic Output

Stack trace from the terraform-provider-google_v4.42.0_x5 plugin:

panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x24dcb65]

goroutine 1154 [running]: github.com/hashicorp/terraform-provider-google/google.flattenBucketLifecycleRuleCondition(0xc000c03340) github.com/hashicorp/terraform-provider-google/google/resource_storage_bucket.go:1083 +0x45 github.com/hashicorp/terraform-provider-google/google.flattenBucketLifecycle(0xc00159b400) github.com/hashicorp/terraform-provider-google/google/resource_storage_bucket.go:1067 +0x276 github.com/hashicorp/terraform-provider-google/google.setStorageBucket(0x2d59a8b?, 0x44?, 0xc0004b9dc0, {0xc0007c2cc0, 0x1c}, {0xc0003c6150, 0x65}) github.com/hashicorp/terraform-provider-google/google/resource_storage_bucket.go:1493 +0xf51 github.com/hashicorp/terraform-provider-google/google.resourceStorageBucketRead(0x7ff5b8a53d58?, {0x2cccd40?, 0xc000147000}) github.com/hashicorp/terraform-provider-google/google/resource_storage_bucket.go:732 +0x3a7 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0x3232400?, {0x3232400?, 0xc00111efc0?}, 0xd?, {0x2cccd40?, 0xc000147000?}) github.com/hashicorp/terraform-plugin-sdk/v2@v2.18.0/helper/schema/resource.go:712 +0x178 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc000c9b0a0, {0x3232400, 0xc00111efc0}, 0xc000718820, {0x2cccd40, 0xc000147000}) github.com/hashicorp/terraform-plugin-sdk/v2@v2.18.0/helper/schema/resource.go:1015 +0x585 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0xc000cba3c0, {0x3232400?, 0xc00111ef00?}, 0xc000566580) github.com/hashicorp/terraform-plugin-sdk/v2@v2.18.0/helper/schema/grpc_provider.go:613 +0x497 github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadResource(0xc00045e320, {0x3232400?, 0xc00111e8d0?}, 0xc0008539e0) github.com/hashicorp/terraform-plugin-go@v0.10.0/tfprotov5/tf5server/server.go:747 +0x41e github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler({0x2c5f7e0?, 0xc00045e320}, {0x3232400, 0xc00111e8d0}, 0xc000df90a0, 0x0) github.com/hashicorp/terraform-plugin-go@v0.10.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:349 +0x170 google.golang.org/grpc.(*Server).processUnaryRPC(0xc0000001e0, {0x32377e8, 0xc00070a680}, 0xc000e6ab40, 0xc000cb2de0, 0x4387e30, 0x0) google.golang.org/grpc@v1.50.1/server.go:1340 +0xd13 google.golang.org/grpc.(*Server).handleStream(0xc0000001e0, {0x32377e8, 0xc00070a680}, 0xc000e6ab40, 0x0) google.golang.org/grpc@v1.50.1/server.go:1713 +0xa1b google.golang.org/grpc.(*Server).serveStreams.func1.2() google.golang.org/grpc@v1.50.1/server.go:965 +0x98 created by google.golang.org/grpc.(*Server).serveStreams.func1 google.golang.org/grpc@v1.50.1/server.go:963 +0x28a

Error: The terraform-provider-google_v4.42.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

Actual Behavior

Steps to Reproduce

  1. terraform apply

Important Factoids

References

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 16
  • Comments: 22

Most upvoted comments

Preparing 4.42.1 release and running some tests now. If no errors occur in the tests, we’ll hopefully get it released by tomorrow.

Any way we could do a 4.42.1 or something in the next day since this is a crash?

Can the fix get merged and a new release cut today?

4.42.1 is out! Please let me know if the error still occurs.

Found a way to reproduce it with the following config:

locals {
  lifecycle_rules = [
    {
      action = "Delete"
    }
  ]
}

resource "google_storage_bucket" "bucket" {
  name                        = "test-bucket-creation-foobar"
  location                    = "US"
  uniform_bucket_level_access = true

  dynamic "lifecycle_rule" {
    for_each = local.lifecycle_rules
    content {
      action {
        type = lifecycle_rule.value.action
      }
      condition {
        days_since_noncurrent_time = 7
      }
    }
  }
}

terraform {
  required_providers {
    google = {
      version = "4.37.0"
    }
  }
}

Steps:

  1. Init and apply to create the bucket with version 4.37.0 (or lower)
  2. change the google provider version to 4.42.0 and re-init
  3. run terraform apply and receive
google_storage_bucket.bucket: Refreshing state... [id=test-bucket-creation-foobar]
β•·
β”‚ Error: Plugin did not respond
β”‚ 
β”‚   with google_storage_bucket.bucket,
β”‚   on main.tf line 13, in resource "google_storage_bucket" "bucket":
β”‚   13: resource "google_storage_bucket" "bucket" {
β”‚ 
β”‚ 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_v4.42.0_x5 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x30daa25]

goroutine 91 [running]:
github.com/hashicorp/terraform-provider-google/google.flattenBucketLifecycleRuleCondition(0xc000a9d420)
	github.com/hashicorp/terraform-provider-google/google/resource_storage_bucket.go:1083 +0x45
github.com/hashicorp/terraform-provider-google/google.flattenBucketLifecycle(0xc0005474a0)
	github.com/hashicorp/terraform-provider-google/google/resource_storage_bucket.go:1067 +0x276
github.com/hashicorp/terraform-provider-google/google.setStorageBucket(0x3958065?, 0x43?, 0xc00176e000, {0xc0012c59e0, 0x1b}, {0xc000eb0150, 0x65})
	github.com/hashicorp/terraform-provider-google/google/resource_storage_bucket.go:1493 +0xf51
github.com/hashicorp/terraform-provider-google/google.resourceStorageBucketRead(0x6093528?, {0x38cbba0?, 0xc000c03000})
	github.com/hashicorp/terraform-provider-google/google/resource_storage_bucket.go:732 +0x3a7
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0x3e30660?, {0x3e30660?, 0xc0008b55c0?}, 0xd?, {0x38cbba0?, 0xc000c03000?})
	github.com/hashicorp/terraform-plugin-sdk/v2@v2.18.0/helper/schema/resource.go:712 +0x178
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc000b3b180, {0x3e30660, 0xc0008b55c0}, 0xc000665450, {0x38cbba0, 0xc000c03000})
	github.com/hashicorp/terraform-plugin-sdk/v2@v2.18.0/helper/schema/resource.go:1015 +0x585
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0xc000111470, {0x3e30660?, 0xc0008ad5c0?}, 0xc000119f80)
	github.com/hashicorp/terraform-plugin-sdk/v2@v2.18.0/helper/schema/grpc_provider.go:613 +0x497
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadResource(0xc000564460, {0x3e30660?, 0xc0008ace40?}, 0xc0009f9680)
	github.com/hashicorp/terraform-plugin-go@v0.10.0/tfprotov5/tf5server/server.go:747 +0x41e
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler({0x385e520?, 0xc000564460}, {0x3e30660, 0xc0008ace40}, 0xc000ea88c0, 0x0)
	github.com/hashicorp/terraform-plugin-go@v0.10.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:349 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0000001e0, {0x3e35ac8, 0xc00064e680}, 0xc000a8ca20, 0xc000b54e10, 0x4f88f90, 0x0)
	google.golang.org/grpc@v1.50.1/server.go:1340 +0xd13
google.golang.org/grpc.(*Server).handleStream(0xc0000001e0, {0x3e35ac8, 0xc00064e680}, 0xc000a8ca20, 0x0)
	google.golang.org/grpc@v1.50.1/server.go:1713 +0xa1b
google.golang.org/grpc.(*Server).serveStreams.func1.2()
	google.golang.org/grpc@v1.50.1/server.go:965 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
	google.golang.org/grpc@v1.50.1/server.go:963 +0x28a

Error: The terraform-provider-google_v4.42.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.

The plugin.(*GRPCProvider).UpgradeResourceState request was cancelled. β•΅

Stack trace from the terraform-provider-google_v4.42.0_x5.exe plugin:

panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x0 pc=0x2ecb605]