hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.87k stars 9.21k forks source link

aws_lakeformation_permissions plugin crashes with transport error in 0.15.4 #19518

Closed varadhvi closed 2 years ago

varadhvi commented 3 years ago

Attempting to run aws_lakeformation_permissions plugin in order to provide access to a role for a database through Lakeformation

data "aws_lakeformation_permissions" "test" {
  principal =  "arn:aws:iam::${var.account_id}:role/${var.aws_iam_readonly_role}"
  database {
    name       =  "sampledb"
    catalog_id =  var.account_id
  }
}

Output

terraform apply
╷
│ Error: Plugin did not respond
│ 
│   with data.aws_lakeformation_permissions.test,
│   on consumer_access.tf line 32, in data "aws_lakeformation_permissions" "test":
│   32: data "aws_lakeformation_permissions" "test" {
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ReadDataSource call. The plugin logs may contain more details.
╵

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

panic: runtime error: index out of range [0] with length 0

goroutine 107 [running]:
github.com/terraform-providers/terraform-provider-aws/aws.dataSourceAwsLakeFormationPermissionsRead(0xc00096e580, 0x6c6f040, 0xc00272a600, 0xbb4acf0, 0xc000701b00)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-aws/aws/data_source_aws_lakeformation_permissions.go:289 +0x210c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0xc00047a1c0, 0x84ff548, 0xc000977ac0, 0xc00096e580, 0x6c6f040, 0xc00272a600, 0x0, 0x0, 0x0)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.6.1/helper/schema/resource.go:335 +0x1ee
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).ReadDataApply(0xc00047a1c0, 0x84ff548, 0xc000977ac0, 0xc001f93c80, 0x6c6f040, 0xc00272a600, 0xc00272a600, 0xc001f93c80, 0x0, 0x0)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.6.1/helper/schema/resource.go:558 +0xfd
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadDataSource(0xc00011ef18, 0x84ff548, 0xc000977ac0, 0xc001f939e0, 0xc000977ac0, 0x100b665, 0x7532c60)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.6.1/helper/schema/grpc_provider.go:1105 +0x4d6
github.com/hashicorp/terraform-plugin-go/tfprotov5/server.(*server).ReadDataSource(0xc00209cda0, 0x84ff5f0, 0xc000977ac0, 0xc0007bea50, 0xc00209cda0, 0xc0022bea80, 0xc0027c1ba0)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.3.0/tfprotov5/server/server.go:247 +0xe5
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadDataSource_Handler(0x77ee4a0, 0xc00209cda0, 0x84ff5f0, 0xc0022bea80, 0xc00194a960, 0x0, 0x84ff5f0, 0xc0022bea80, 0xc00097c000, 0x127)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.3.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:416 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc00023d500, 0x85203f8, 0xc001507b00, 0xc000924d00, 0xc000891890, 0xbb0a4f0, 0x0, 0x0, 0x0)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.32.0/server.go:1194 +0x52b
google.golang.org/grpc.(*Server).handleStream(0xc00023d500, 0x85203f8, 0xc001507b00, 0xc000924d00, 0x0)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.32.0/server.go:1517 +0xd0c
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc00156a930, 0xc00023d500, 0x85203f8, 0xc001507b00, 0xc000924d00)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.32.0/server.go:859 +0xab
created by google.golang.org/grpc.(*Server).serveStreams.func1
        /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.32.0/server.go:857 +0x1fd

Error: The terraform-provider-aws_v3.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.
ewbankkit commented 3 years ago

Relevant code:

https://github.com/hashicorp/terraform-provider-aws/blob/d7e16d776d9f9e13945513caf46aa3cab8578442/aws/data_source_aws_lakeformation_permissions.go#L289

Related:

varadhvi commented 3 years ago

any update on this please @ewbankkit ?

jackbatzner commented 3 years ago

Can you try out v 3.39 of the provider and see if this is resolved @varadhvi ?

justinretzolk commented 2 years ago

Hey @varadhvi 👋 It looks like this was resolved in AWS Provider version 3.39.0. Given that's the case, I'll mark this issue as resolved. If you feel I've done this in error, please do let me know.

github-actions[bot] commented 2 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.