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.61k stars 8.99k forks source link

[Bug]: The terraform-provider-aws_v5.49.0_x5 plugin crashed! #37422

Open vinay-20 opened 1 month ago

vinay-20 commented 1 month ago

Terraform Core Version

1.6.0

AWS Provider Version

5.49.0

Affected Resource(s)

aws_batch

Expected Behavior

This behaviour is seen on terraform cloud, while we are running terraform plan against the current infrastructure the plan should have identified the drift and completed the terraform plan successfully.

Actual Behavior

The plugin crashed while computing changes for aws batch, and this is seen in those workspace which has aws batch resource in it.

Relevant Error/Panic Output Snippet

Stack trace from the terraform-provider-aws_v5.49.0_x5 plugin:

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

goroutine 625 [running]:
github.com/hashicorp/terraform-provider-aws/internal/service/batch.needsJobDefUpdate(0xc0045e4a40)
github.com/hashicorp/terraform-provider-aws/internal/service/batch/job_definition.go:557 +0x1074
github.com/hashicorp/terraform-provider-aws/internal/service/batch.jobDefinitionCustomizeDiff({0x11cc35c0?, 0x1d97b3e0?}, 0xc0045e4a40, {0xe?, 0xc0020eedd0?})
github.com/hashicorp/terraform-provider-aws/internal/service/batch/job_definition.go:452 +0x3a
github.com/hashicorp/terraform-provider-aws/internal/service/batch.ResourceJobDefinition.Sequence.func23({0x14b36808, 0xc004c1e060}, 0xc0045e4a40, {0x12caafa0, 0xc0020eedd0})
github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/customdiff/compose.go:69 +0x84
github.com/hashicorp/terraform-provider-aws/internal/provider.New.(*wrappedResource).CustomizeDiff.func5({0x14b36808?, 0xc0045e7980?}, 0xc0045e4a40, {0x12caafa0, 0xc0020eedd0})
github.com/hashicorp/terraform-provider-aws/internal/provider/intercept.go:186 +0x63
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.Diff(0xc0010f3a70, {0x14b36808, 0xc0045e7980}, 0xc0045ef5f0, 0xc004b9c190, 0xc000011740, {0x12caafa0, 0xc0020eedd0}, 0x0)
github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/schema.go:698 +0x4b4
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).SimpleDiff(0x14b36c38?, {0x14b36808?, 0xc0045e7980?}, 0xc0045ef5f0, 0xc0045e79b0?, {0x12caafa0?, 0xc0020eedd0?})
github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource.go:962 +0xdb
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).PlanResourceChange(0xc00356c768, {0x14b36808?, 0xc0045e7890?}, 0xc00458b720)
github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/grpc_provider.go:798 +0x996
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).PlanResourceChange(0xc0019eaaf0, {0x14b36808?, 0xc0045e75c0?}, 0xc00458b720)
github.com/hashicorp/terraform-plugin-mux@v0.15.0/tf5muxserver/mux_server_PlanResourceChange.go:73 +0x2ad
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).PlanResourceChange(0xc000033d60, {0x14b36808?, 0xc0045e6de0?}, 0xc000b86b60)
github.com/hashicorp/terraform-plugin-go@v0.22.2/tfprotov5/tf5server/server.go:811 +0x3d0
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_PlanResourceChange_Handler({0x12a6a520, 0xc000033d60}, {0x14b36808, 0xc0045e6de0}, 0xc0045ba200, 0x0)
github.com/hashicorp/terraform-plugin-go@v0.22.2/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:500 +0x1a6
google.golang.org/grpc.(*Server).processUnaryRPC(0xc001a8c200, {0x14b36808, 0xc0045e6d50}, {0x14b811c0, 0xc000340780}, 0xc0045eaa20, 0xc0021a05d0, 0x1d8f0580, 0x0)
google.golang.org/grpc@v1.63.2/server.go:1369 +0xdf8
google.golang.org/grpc.(*Server).handleStream(0xc001a8c200, {0x14b811c0, 0xc000340780}, 0xc0045eaa20)
google.golang.org/grpc@v1.63.2/server.go:1780 +0xe8b
google.golang.org/grpc.(*Server).serveStreams.func2.1()
google.golang.org/grpc@v1.63.2/server.go:1019 +0x8b
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 30
google.golang.org/grpc@v1.63.2/server.go:1030 +0x125

Error: The terraform-provider-aws_v5.49.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.

Terraform Configuration Files

provider.tf

 terraform {
   required_providers {
     aws = {
       source  = "hashicorp/aws"
       version = "~> 5"
     }
   }

   cloud {
     organization = "Planview"
     workspaces {
       name = "<workspace_name>"
     }
   }
 }

batch.tf

 module "app-batch" {
   source  = "app.terraform.io/Planview/batch-fargate/github"
   version = "0.2.6"

  # """rest of the code.."""
 }

Steps to Reproduce

  1. terraform init
  2. terraform plan

Debug Output

Error: Request cancelled with module.app-batch.module.fargate-batch.aws_batch_job_definition.this["app-batch"] on .terraform/modules/app-batch.fargate-batch/main.tf line 265, in resource "aws_batch_job_definition" "this": resource "aws_batch_job_definition" "this" { The plugin.(*GRPCProvider).PlanResourceChange request was cancelled.

Panic Output

 Stack trace from the terraform-provider-aws_v5.49.0_x5 plugin:

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

 goroutine 835 [running]:
 github.com/hashicorp/terraform-provider-aws/internal/service/batch.needsJobDefUpdate(0xc002f65e40)
 github.com/hashicorp/terraform-provider-aws/internal/service/batch/job_definition.go:557 +0x1074
 github.com/hashicorp/terraform-provider-aws/internal/service/batch.jobDefinitionCustomizeDiff({0x11cc35c0?, 0x1d97b3e0?}, 0xc002f65e40, {0xe?, 0xc0022b6dd0?})
 github.com/hashicorp/terraform-provider-aws/internal/service/batch/job_definition.go:452 +0x3a
 github.com/hashicorp/terraform-provider-aws/internal/service/batch.ResourceJobDefinition.Sequence.func23({0x14b36808, 0xc00303df20}, 0xc002f65e40, {0x12caafa0, 0xc0022b6dd0})
 github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/customdiff/compose.go:69 +0x84
 github.com/hashicorp/terraform-provider-aws/internal/provider.New.(*wrappedResource).CustomizeDiff.func5({0x14b36808?, 0xc002ff3920?}, 0xc002f65e40, {0x12caafa0, 0xc0022b6dd0})
 github.com/hashicorp/terraform-provider-aws/internal/provider/intercept.go:186 +0x63
 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.Diff(0xc00110cbd0, {0x14b36808, 0xc002ff3920}, 0xc003028c30, 0xc00302a690, 0xc000010ac8, {0x12caafa0, 0xc0022b6dd0}, 0x0)
 github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/schema.go:698 +0x4b4
 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).SimpleDiff(0x14b36c38?, {0x14b36808?, 0xc002ff3920?}, 0xc003028c30, 0xc002ff3950?, {0x12caafa0?, 0xc0022b6dd0?})
 github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource.go:962 +0xdb
 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).PlanResourceChange(0xc003505170, {0x14b36808?, 0xc002ff3830?}, 0xc002f99c20)
 github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/grpc_provider.go:798 +0x996
 github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).PlanResourceChange(0xc0003a1570, {0x14b36808?, 0xc002ff3560?}, 0xc002f99c20)
 github.com/hashicorp/terraform-plugin-mux@v0.15.0/tf5muxserver/mux_server_PlanResourceChange.go:73 +0x2ad
 github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).PlanResourceChange(0xc0002c9860, {0x14b36808?, 0xc002ff2d80?}, 0xc0016d15e0)
 github.com/hashicorp/terraform-plugin-go@v0.22.2/tfprotov5/tf5server/server.go:811 +0x3d0
 github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_PlanResourceChange_Handler({0x12a6a520, 0xc0002c9860}, {0x14b36808, 0xc002ff2d80}, 0xc002f60a80, 0x0)
 github.com/hashicorp/terraform-plugin-go@v0.22.2/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:500 +0x1a6
 google.golang.org/grpc.(*Server).processUnaryRPC(0xc000335200, {0x14b36808, 0xc002ff2cf0}, {0x14b811c0, 0xc0011ae600}, 0xc003009200, 0xc00235e450, 0x1d8f0580, 0x0)
 google.golang.org/grpc@v1.63.2/server.go:1369 +0xdf8
 google.golang.org/grpc.(*Server).handleStream(0xc000335200, {0x14b811c0, 0xc0011ae600}, 0xc003009200)
 google.golang.org/grpc@v1.63.2/server.go:1780 +0xe8b
 google.golang.org/grpc.(*Server).serveStreams.func2.1()
 google.golang.org/grpc@v1.63.2/server.go:1019 +0x8b
 created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 57
 google.golang.org/grpc@v1.63.2/server.go:1030 +0x125

 Error: The terraform-provider-aws_v5.49.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.

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 1 month ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

flostadler commented 1 month ago

Hey, I think this could be a duplicate of the error I'm facing here: https://github.com/hashicorp/terraform-provider-aws/issues/37349