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.78k stars 9.14k forks source link

[Bug]: vpclattice.dataSourceServiceRead results in a panic #34321

Open shulin-sq opened 11 months ago

shulin-sq commented 11 months ago

Terraform Core Version

1.1.6

AWS Provider Version

5.24.0

Affected Resource(s)

Expected Behavior

https://awscli.amazonaws.com/v2/documentation/api/latest/reference/vpc-lattice/create-service-network-service-association.html

Actual Behavior

panic

Relevant Error/Panic Output Snippet

The plugin encountered an error, and failed to respond to the
--
842 | plugin.(*GRPCProvider).ReadDataSource call. The plugin logs may contain more
843 | details.
844 | Releasing state lock. This may take a few moments...
845 |  
846 | Stack trace from the terraform-provider-aws_v5.24.0_x5 plugin:
847 |  
848 | panic: runtime error: invalid memory address or nil pointer dereference
849 | [signal SIGSEGV: segmentation violation code=0x1 addr=0x48 pc=0xb148547]
850 |  
851 | goroutine 22 [running]:
852 | github.com/hashicorp/terraform-provider-aws/internal/service/vpclattice.dataSourceServiceRead({0xf3ad7e0, 0xc005c9d920}, 0x0?, {0xdf8a960?, 0xc0002beb40})
853 | github.com/hashicorp/terraform-provider-aws/internal/service/vpclattice/service_data_source.go:114 +0x1e7
854 | github.com/hashicorp/terraform-provider-aws/internal/provider.interceptedHandler[...].func1(0x0?, {0xdf8a960?, 0xc0002beb40?})
855 | github.com/hashicorp/terraform-provider-aws/internal/provider/intercept.go:111 +0x32d
856 | github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0xf3ad7e0?, {0xf3ad7e0?, 0xc005c9cfc0?}, 0xd?, {0xdf8a960?, 0xc0002beb40?})
857 | github.com/hashicorp/terraform-plugin-sdk/v2@v2.29.0/helper/schema/resource.go:790 +0x87
858 | github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).ReadDataApply(0xc0018d8380, {0xf3ad7e0, 0xc005c9cfc0}, 0xc005cc2400, {0xdf8a960, 0xc0002beb40})
859 | github.com/hashicorp/terraform-plugin-sdk/v2@v2.29.0/helper/schema/resource.go:1015 +0x150
860 | github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadDataSource(0xc001847c08, {0xf3ad7e0?, 0xc005c9cea0?}, 0xc005cae0c0)
861 | github.com/hashicorp/terraform-plugin-sdk/v2@v2.29.0/helper/schema/grpc_provider.go:1237 +0x38f
862 | github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).ReadDataSource(0xf3ad738?, {0xf3ad7e0?, 0xc005c9cb70?}, 0xc005cae0c0)
863 | github.com/hashicorp/terraform-plugin-mux@v0.12.0/tf5muxserver/mux_server_ReadDataSource.go:36 +0x1b5
864 | github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadDataSource(0xc0018a0000, {0xf3ad7e0?, 0xc005c9c1b0?}, 0xc005ca20f0)
865 | github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov5/tf5server/server.go:699 +0x403
866 | github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadDataSource_Handler({0xdd0db80?, 0xc0018a0000}, {0xf3ad7e0, 0xc005c9c1b0}, 0xc000cfa000, 0x0)
867 | github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:503 +0x170
868 | google.golang.org/grpc.(*Server).processUnaryRPC(0xc000754780, {0xf3bb400, 0xc0035be680}, 0xc005caa000, 0xc0029c0d80, 0x15948328, 0x0)
869 | google.golang.org/grpc@v1.58.2/server.go:1376 +0xdd2
870 | google.golang.org/grpc.(*Server).handleStream(0xc000754780, {0xf3bb400, 0xc0035be680}, 0xc005caa000, 0x0)
871 | google.golang.org/grpc@v1.58.2/server.go:1753 +0xa36
872 | google.golang.org/grpc.(*Server).serveStreams.func1.1()
873 | google.golang.org/grpc@v1.58.2/server.go:998 +0x98
874 | created by google.golang.org/grpc.(*Server).serveStreams.func1
875 | google.golang.org/grpc@v1.58.2/server.go:996 +0x18c
876 |  
877 | Error: The terraform-provider-aws_v5.24.0_x5 plugin crashed!
878 |  
879 | This is always indicative of a bug within the plugin. It would be immensely
880 | helpful if you could report the crash with the plugin's maintainers so that it
881 | can be fixed. The output above should help diagnose the issue.

Terraform Configuration Files

resource "aws_vpclattice_service_network" "lattice_sn" {
  name      = "test"
  auth_type = "NONE"
}

data "aws_vpclattice_service" "service" {
  service_identifier = var.arn
}

resource "aws_vpclattice_service_network_service_association" "example" {
  service_identifier         = data.aws_vpclattice_service.service.id
  service_network_identifier = aws_vpclattice_service_network.lattice_sn.id
}

terraform {
  required_version = "1.1.6"
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">= 5.24.0"
    }
}

Steps to Reproduce

terraform plan

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

No

github-actions[bot] commented 11 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

ewbankkit commented 11 months ago

https://github.com/hashicorp/terraform-provider-aws/blob/9289064b04ed744cb91c7078768b32d52ab4d671/internal/service/vpclattice/service_data_source.go#L85-L114