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

invalid memory address or nil pointer dereference in cluster_rosa_classic_resource.go #45

Closed
cwe1ss opened this issue Apr 25, 2023 · 2 comments

Comments

@cwe1ss
Copy link

cwe1ss commented Apr 25, 2023

Hi! I tried to create a ROSA cluster by using the files from https://github.com/terraform-redhat/terraform-provider-ocm/tree/main/examples/create_rosa_cluster/create_rosa_sts_cluster/classic_sts/cluster but I encountered the following error.

It seems to point to this line. I noticed that the err variable isn't checked from line 750, so maybe sess is null?

I'm using the AWS CLI with SSO via AWS Identity Center and I'm using named profiles by setting the AWS_PROFILE environment variable. Could the Profile: "" in line 752 interfere with that and cause this issue here?

│ Error: Plugin did not respond
│
│ The plugin encountered an error, and failed to respond to the plugin6.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.

Stack trace from the terraform-provider-ocm_v1.0.1.exe plugin:

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

goroutine 33 [running]:
github.com/terraform-redhat/terraform-provider-ocm/provider.buildSession({0xc0005669e0, 0xc})
        github.com/terraform-redhat/terraform-provider-ocm/provider/cluster_rosa_classic_resource.go:763 +0x1ff
github.com/terraform-redhat/terraform-provider-ocm/provider.getRoleByARN({0xc0006163c0, 0x32}, {0xc0005669e0, 0xc})
        github.com/terraform-redhat/terraform-provider-ocm/provider/cluster_rosa_classic_resource.go:734 +0x19d
github.com/terraform-redhat/terraform-provider-ocm/provider.(*ClusterRosaClassicResource).validateAccountRoles(0xc000879200, {0x15462b0, 0xc0004f0580}, 0xc0000c42c0)
        github.com/terraform-redhat/terraform-provider-ocm/provider/cluster_rosa_classic_resource.go:675 +0x29b
github.com/terraform-redhat/terraform-provider-ocm/provider.(*ClusterRosaClassicResource).Create(_, {_, _}, {{{{0x1548be0, 0xc00089bec0}, {0x117f0c0, 0xc0008969f0}}, {0xc000887b60, 0x0, 0x0, ...}}, ...}, ...)      
        github.com/terraform-redhat/terraform-provider-ocm/provider/cluster_rosa_classic_resource.go:878 +0x13a
github.com/hashicorp/terraform-plugin-framework/tfsdk.(*server).applyResourceChange(0xc000324330, {0x15462b0, 0xc0004f0580}, 0xc000269540, 0xc0000f9988)
        github.com/hashicorp/terraform-plugin-framework@v0.5.0/tfsdk/serve.go:1070 +0x27f1
github.com/hashicorp/terraform-plugin-framework/tfsdk.(*server).ApplyResourceChange(0x15462b0?, {0x15462b0?, 0xc0004f04c0?}, 0xc000269540)
        github.com/hashicorp/terraform-plugin-framework@v0.5.0/tfsdk/serve.go:945 +0x98
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ApplyResourceChange(0xc000163f00, {0x1546358?, 0xc000887440?}, 0xc000224fc0)
        github.com/hashicorp/terraform-plugin-go@v0.5.0/tfprotov6/tf6server/server.go:604 +0x2ad
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ApplyResourceChange_Handler({0x12bc920?, 0xc000163f00}, {0x1546358, 0xc000887440}, 0xc0002008a0, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.5.0/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:381 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc00032f880, {0x1549400, 0xc0000ca480}, 0xc00039c100, 0xc000324660, 0x1d10f60, 0x0)
        google.golang.org/grpc@v1.32.0/server.go:1194 +0xc8f
google.golang.org/grpc.(*Server).handleStream(0xc00032f880, {0x1549400, 0xc0000ca480}, 0xc00039c100, 0x0)
        google.golang.org/grpc@v1.32.0/server.go:1517 +0xa1b
google.golang.org/grpc.(*Server).serveStreams.func1.2()
        google.golang.org/grpc@v1.32.0/server.go:859 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/grpc@v1.32.0/server.go:857 +0x28a

Error: The terraform-provider-ocm_v1.0.1.exe plugin crashed!
@cwe1ss
Copy link
Author

cwe1ss commented Apr 26, 2023

This happened because I was using the new(ish) sso_session-parameter in my profile file. AWS SDK for Go (v1) doesn't support that yet: aws/aws-sdk-go#4649

Using sso_start_url & sso_region directly in the profile instead fixed the issue.

I think this issue could still stay open because the error message was not helpful at all in finding this issue.

@nirarg
Copy link
Member

nirarg commented Oct 19, 2023

Hi @cwe1ss ,

I'm closing this issue as this is very old one
If you think this issue is still relevant (reproduce with v1.3.0 or v1.4.0), please feel free to reopen it

Best regards,
Nir

@nirarg nirarg closed this as completed Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants