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

[BUG] Provider crashing upon apply when connecting over SSH #213

Closed
jfranklin-andros opened this issue Sep 19, 2024 · 2 comments
Closed
Labels
bug Something isn't working untriaged

Comments

@jfranklin-andros
Copy link

jfranklin-andros commented Sep 19, 2024

What is the bug?

Attempting to instantiate the opensearch provider plugin to create opensearch_roles and opensearch_roles_mappings over SSH tunnel results in the plugin crashing with the following error:

panic: interface conversion: interface {} is nil, not map[string]interface {}

goroutine 15 [running]:
github.com/opensearch-project/terraform-provider-opensearch/provider.tenantPermissionsHash({0x0?, 0x0?})
        github.com/opensearch-project/terraform-provider-opensearch/provider/util.go:392 +0x37c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Set).hash(0x14000565180?, {0x0?, 0x0?})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/set.go:221 +0x34
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Set).add(0x1400088d500, {0x0, 0x0}, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/set.go:201 +0x70
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ConfigFieldReader).readSet(0x1400056e1e0, {0x1400057ad10, 0x1, 0x1}, 0x14000564dc0)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/field_reader_config.go:287 +0x298
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ConfigFieldReader).readField(0x1400056e1e0, {0x1400057ad10, 0x1, 0x1}, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/field_reader_config.go:110 +0x320
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ConfigFieldReader).ReadField(0x1015380e0?, {0x1400057ad10?, 0x100ee49d6?, 0x6?})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/field_reader_config.go:32 +0x88
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*MultiLevelFieldReader).ReadFieldExact(0x1400057ad00?, {0x1400057ad10, 0x1, 0x1}, {0x100ee49d6, 0x6})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/field_reader_multi.go:34 +0x78
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).get(0x1400012b580, {0x1400057ad10, 0x1, 0x1}, 0x0?)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource_data.go:551 +0x104
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).getChange(0x1400012b580, {0x100ef16fd?, 0x12?}, 0x1?, 0x12)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource_data.go:527 +0x150
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).diffChange(0x14000060bb8?, {0x100ef16fd?, 0x14000060b90?})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource_data.go:504 +0x48
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.diffSet(0x14000569a70, {0x10169ca38, 0x1400098bd70}, {0x100ef16fd, 0x12}, 0x14000564dc0, 0x140000610b8, {0x1016a06c0, 0x1400012b580}, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/schema.go:1412 +0x5c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.diff(0x14000569a70, {0x10169ca38, 0x1400098bd70}, {0x100ef16fd, 0x12}, 0x14000564dc0, 0x1400012b500, {0x1016a06c0, 0x1400012b580}, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/schema.go:1134 +0x180
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.Diff(0x14000569a70, {0x10169ca38, 0x1400098bd70}, 0x1400015dc70, 0x14000141590, 0x0, {0x0, 0x0}, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/schema.go:678 +0x298
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.diffFromValues({0x10169ca38, 0x1400098bd70}, {{{0x10169ccd8?, 0x1400013c2a0?}}, {0x0?, 0x0?}}, {{{0x10169ccd8?, 0x1400013c2e0?}}, {0x101534f00?, 0x14000568de0?}}, ...)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/shims.go:46 +0x208
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.DiffFromValues(...)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/shims.go:23
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0x1400054a438, {0x10169ca38?, 0x1400098bcb0?}, 0x140001412c0)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/grpc_provider.go:1018 +0x500
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0x1400052a6e0, {0x10169ca38?, 0x1400098b4d0?}, 0x140004853b0)
        github.com/hashicorp/terraform-plugin-go@v0.22.2/tfprotov5/tf5server/server.go:846 +0x2b4
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x1016457c0, 0x1400052a6e0}, {0x10169ca38, 0x1400098b4d0}, 0x1400012b180, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.22.2/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:518 +0x1c0
google.golang.org/grpc.(*Server).processUnaryRPC(0x140001a8e00, {0x10169ca38, 0x1400098b440}, {0x1016a18e0, 0x1400081c180}, 0x140005607e0, 0x140008059e0, 0x101e4dcf8, 0x0)
        google.golang.org/grpc@v1.63.2/server.go:1369 +0xb58
google.golang.org/grpc.(*Server).handleStream(0x140001a8e00, {0x1016a18e0, 0x1400081c180}, 0x140005607e0)
        google.golang.org/grpc@v1.63.2/server.go:1780 +0xb20
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        google.golang.org/grpc@v1.63.2/server.go:1019 +0x8c
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 43
        google.golang.org/grpc@v1.63.2/server.go:1030 +0x13c

How can one reproduce the bug?

Plan/apply Opensearch over SSH using host override in the plugin provider:

provider "opensearch" {
  url           = "https://localhost:1053"
  host_override = local.opensearch_domain
  username      = module.searchcluster[0].admin_username
  password      = module.searchcluster[0].admin_password
  # Must be disabled for basic auth
  sign_aws_requests = false
  insecure          = true
}

What is the expected behavior?

A clear and concise description of what you expected to happen.
Apply goes through successfully.

What is your host/environment?

Operating system, version.

Do you have any screenshots?

If applicable, add screenshots to help explain your problem.

Do you have any additional context?

I am able to connect over this SSH tunnel to the opensearch cluster, so I'm doubtful the tunnel is the issue here. I do get the same error when trying to connect without a tunnel.

@jfranklin-andros jfranklin-andros added bug Something isn't working untriaged labels Sep 19, 2024
@jfranklin-andros
Copy link
Author

This happens in both 2.3.0 and 2.3.1 versions of the plugin, any guidance would be appreciated.

@jfranklin-andros
Copy link
Author

Turns out this was poor error handling on the plugin part and there was a syntax error with one of the roles tenants permissions. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working untriaged
Projects
Status: ✅ Done
Development

No branches or pull requests

1 participant