crossplane-contrib / provider-upjet-gcp

GCP Provider for Crossplane.
https://marketplace.upbound.io/providers/upbound/provider-family-gcp/
Apache License 2.0
69 stars 76 forks source link

[Bug]: Generator crashes with invalid memory address or nil pointer dereference when updating to terraform-provider-google v6.10.0 #656

Open rickard-von-essen opened 2 weeks ago

rickard-von-essen commented 2 weeks ago

Is there an existing issue for this?

Affected Resource(s)

All

Resource MRs required to reproduce the bug

No response

Steps to Reproduce

  1. Change Makefile to use v 6.10.0 of the terraform-provider-google
diff --git a/Makefile b/Makefile
index 6212c055..606ab03b 100644
--- a/Makefile
+++ b/Makefile
@@ -11,7 +11,7 @@ PROJECT_NAME := provider-$(PROVIDER_NAME)
 PROJECT_REPO := github.com/upbound/$(PROJECT_NAME)

 export TERRAFORM_VERSION := 1.5.5
-export TERRAFORM_PROVIDER_VERSION := 5.44.2
+export TERRAFORM_PROVIDER_VERSION := 6.10.0
 export TERRAFORM_PROVIDER_SOURCE := hashicorp/google
 export TERRAFORM_PROVIDER_REPO ?= https://github.com/hashicorp/terraform-provider-google
 export TERRAFORM_DOCS_PATH ?= website/docs/r
  1. Regenerate make clean generate

What happened?

It fails with panic: runtime error: invalid memory address or nil pointer dereference

Relevant Error Output Snippet

go run github.com/crossplane/upjet/cmd/scraper -n hashicorp/terraform-provider-google -r ../.work/terraform-provider-google/website/docs/r -o ../config/provider-metadata.yaml --prelude-xpath //text()[contains(., "subcategory")] --resource-prefix google
go run ../cmd/generator/main.go ..
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x103628a08]

goroutine 1 [running]:
github.com/crossplane/upjet/pkg/schema/traverser.AccessSchema({0x1078e1de0?, 0x0?}, {0x1400348feb0?, 0x1, 0x140030877c8?}, {0x140030877b8, 0x1, 0x1})
        /Users/ext.rickard.von/.asdf/installs/go/1.23.1/packages/pkg/mod/github.com/crossplane/upjet@v1.4.1-0.20241007154751-5cdf36996e4a/pkg/schema/traverser/access.go:39 +0x188
github.com/crossplane/upjet/pkg/schema/traverser.(*maxItemsSync).VisitResource(0x0?, 0x14003489c20)
        /Users/ext.rickard.von/.asdf/installs/go/1.23.1/packages/pkg/mod/github.com/crossplane/upjet@v1.4.1-0.20241007154751-5cdf36996e4a/pkg/schema/traverser/maxitemssync.go:42 +0xb0
github.com/crossplane/upjet/pkg/schema/traverser.(*ResourceNode).Accept(...)
        /Users/ext.rickard.von/.asdf/installs/go/1.23.1/packages/pkg/mod/github.com/crossplane/upjet@v1.4.1-0.20241007154751-5cdf36996e4a/pkg/schema/traverser/traverse.go:83
github.com/crossplane/upjet/pkg/schema/traverser.traverse(0x14003087af8?, {{0x105fcbe5f, 0x2f}, 0x0, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}}, ...)
        /Users/ext.rickard.von/.asdf/installs/go/1.23.1/packages/pkg/mod/github.com/crossplane/upjet@v1.4.1-0.20241007154751-5cdf36996e4a/pkg/schema/traverser/traverse.go:116 +0x3d0
github.com/crossplane/upjet/pkg/schema/traverser.Traverse(...)
        /Users/ext.rickard.von/.asdf/installs/go/1.23.1/packages/pkg/mod/github.com/crossplane/upjet@v1.4.1-0.20241007154751-5cdf36996e4a/pkg/schema/traverser/traverse.go:31
github.com/crossplane/upjet/pkg/schema/traverser.TFResourceSchema.Traverse(0x1062ab820?, {0x14003087e18, 0x1, 0x1})
        /Users/ext.rickard.von/.asdf/installs/go/1.23.1/packages/pkg/mod/github.com/crossplane/upjet@v1.4.1-0.20241007154751-5cdf36996e4a/pkg/schema/traverser/traverse.go:151 +0xf0
github.com/upbound/provider-gcp/config.GetProvider({0x16d94de1a?, 0x14000162010?}, 0x1)
        /Users/ext.rickard.von/src/provider-upjet-gcp/config/registry.go:147 +0xb0
main.main()
        /Users/ext.rickard.von/src/provider-upjet-gcp/cmd/generator/main.go:36 +0x618
exit status 2
apis/generate.go:26: running "go": exit status 1
12:26:09 [FAIL]
make[1]: *** [go.generate] Error 1
make: *** [generate] Error 2

Crossplane Version

N/A

Provider Version

f90cbe5ef5d6d701b99cc4446b1f1a215afd9c52

Kubernetes Version

N/A

Kubernetes Distribution

N/A

Additional Info

This is required to update some new or updated resources only available in later terraform-provider-google.

rickard-von-essen commented 2 weeks ago
Screenshot 2024-11-10 at 16 36 31
s = nill
k = "sign_in"
rickard-von-essen commented 2 weeks ago

Probably related to the changes in https://github.com/hashicorp/terraform-provider-google/pull/15876/