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]: Empty retry_strategy of aws_batch_job_definition causes panics #37349

Open
flostadler opened this issue May 8, 2024 · 3 comments · May be fixed by #37500
Open

[Bug]: Empty retry_strategy of aws_batch_job_definition causes panics #37349

flostadler opened this issue May 8, 2024 · 3 comments · May be fixed by #37500
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/batch Issues and PRs that pertain to the batch service.

Comments

@flostadler
Copy link

Terraform Core Version

1.5.7

AWS Provider Version

5.48.0

Affected Resource(s)

Creating an aws_batch_job_definition with an empty retry_strategy block causes panics after the first apply. Every operation (plan/apply/destroy) after the first apply causes a panic.

Expected Behavior

No panic should be raised and plan/apply/destroy should function without errors.

Actual Behavior

All operations after the first apply crash with a panic.

Relevant Error/Panic Output Snippet

aws_batch_job_definition.example: Refreshing state... [id=arn:aws:batch:us-west-2:616138583583:job-definition/florian-test-job-definition2:1]
╷
│ Error: Plugin did not respond
│
│   with aws_batch_job_definition.example,
│   on main.tf line 16, in resource "aws_batch_job_definition" "example":
│   16: resource "aws_batch_job_definition" "example" {
│
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).PlanResourceChange call. The plugin logs may contain more details.
╵

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

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

goroutine 357 [running]:
github.com/hashicorp/terraform-provider-aws/internal/service/batch.needsJobDefUpdate(0x14003f35340)
	github.com/hashicorp/terraform-provider-aws/internal/service/batch/job_definition.go:537 +0x1004
github.com/hashicorp/terraform-provider-aws/internal/service/batch.jobDefinitionCustomizeDiff({0x11441ab20?, 0x11e290e20?}, 0x14003f35340, {0xe?, 0x1400206f930?})
	github.com/hashicorp/terraform-provider-aws/internal/service/batch/job_definition.go:452 +0x44
github.com/hashicorp/terraform-provider-aws/internal/service/batch.ResourceJobDefinition.Sequence.func23({0x115668648, 0x14002e952c0}, 0x14003f35340, {0x115417e00, 0x1400206f930})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/customdiff/compose.go:69 +0x80
github.com/hashicorp/terraform-provider-aws/internal/provider.New.(*wrappedResource).CustomizeDiff.func5({0x115668648?, 0x140029d9080?}, 0x14003f35340, {0x115417e00, 0x1400206f930})
	github.com/hashicorp/terraform-provider-aws/internal/provider/intercept.go:186 +0x68
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.Diff(0x14001092ff0, {0x115668648, 0x140029d9080}, 0x140029b16c0, 0x140049f1450, 0x1400000d7e8, {0x115417e00, 0x1400206f930}, 0x0)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/schema.go:698 +0x3b8
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).SimpleDiff(0x115668a78?, {0x115668648?, 0x140029d9080?}, 0x140029b16c0, 0x140029d90b0?, {0x115417e00?, 0x1400206f930?})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:962 +0x9c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).PlanResourceChange(0x140049de360, {0x115668648?, 0x140029d8f90?}, 0x140049f0af0)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:798 +0x824
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).PlanResourceChange(0x1400193d180, {0x115668648?, 0x140029d8cc0?}, 0x140049f0af0)
	github.com/hashicorp/[email protected]/tf5muxserver/mux_server_PlanResourceChange.go:73 +0x250
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).PlanResourceChange(0x14000307a40, {0x115668648?, 0x140029d8300?}, 0x1400193d8f0)
	github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:811 +0x2b4
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_PlanResourceChange_Handler({0x1151d4b60, 0x14000307a40}, {0x115668648, 0x140029d8300}, 0x14000adac80, 0x0)
	github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:500 +0x1c0
google.golang.org/grpc.(*Server).processUnaryRPC(0x1400166a200, {0x115668648, 0x140029d8270}, {0x1156afd98, 0x140002d3c80}, 0x140029cc480, 0x1400210e6f0, 0x11e200d40, 0x0)
	google.golang.org/[email protected]/server.go:1369 +0xb58
google.golang.org/grpc.(*Server).handleStream(0x1400166a200, {0x1156afd98, 0x140002d3c80}, 0x140029cc480)
	google.golang.org/[email protected]/server.go:1780 +0xb20
google.golang.org/grpc.(*Server).serveStreams.func2.1()
	google.golang.org/[email protected]/server.go:1019 +0x8c
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 49
	google.golang.org/[email protected]/server.go:1030 +0x13c

Error: The terraform-provider-aws_v5.48.0_x5 plugin crashed!

Terraform Configuration Files

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "5.48.0"
    }
  }

  required_version = ">= 1.2.0"
}

provider "aws" {
  region  = "us-west-2"
}

resource "aws_batch_job_definition" "example" {
  name = "test-job-definition"
  type = "container"

  retry_strategy {
    
  }
  container_properties = <<EOT
{
  "command": [
    "ls",
    "-la"
  ],
  "image": "busybox",
  "resourceRequirements": [
    {
      "type": "VCPU",
      "value": "4"
    },
    {
      "type": "MEMORY",
      "value": "512"
    }
  ],
  "volumes": [
    {
      "host": {
        "sourcePath": "/tmp"
      },
      "name": "tmp"
    }
  ],
  "environment": [
    {
      "name": "VARNAME",
      "value": "VARVAL"
    }
  ],
  "mountPoints": [
    {
      "sourceVolume": "tmp",
      "containerPath": "/tmp",
      "readOnly": false
    }
  ],
  "ulimits": [
    {
      "hardLimit": 1024,
      "name": "nofile",
      "softLimit": 1024
    }
  ]
}
EOT
}

Steps to Reproduce

  1. terraform apply (this works)
  2. terraform plan (observe panic)

Debug Output

2024-05-08T17:51:45.719+0200 [INFO]  Terraform version: 1.5.7
2024-05-08T17:51:45.720+0200 [DEBUG] using github.com/hashicorp/go-tfe v1.26.0
2024-05-08T17:51:45.720+0200 [DEBUG] using github.com/hashicorp/hcl/v2 v2.16.2
2024-05-08T17:51:45.720+0200 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.0
2024-05-08T17:51:45.720+0200 [DEBUG] using github.com/zclconf/go-cty v1.12.2
2024-05-08T17:51:45.720+0200 [INFO]  Go runtime version: go1.21.1
2024-05-08T17:51:45.720+0200 [INFO]  CLI args: []string{"terraform", "apply"}
2024-05-08T17:51:45.720+0200 [DEBUG] Attempting to open CLI config file: /Users/flo/.terraformrc
2024-05-08T17:51:45.720+0200 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2024-05-08T17:51:45.721+0200 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2024-05-08T17:51:45.721+0200 [DEBUG] ignoring non-existing provider search directory /Users/flo/.terraform.d/plugins
2024-05-08T17:51:45.721+0200 [DEBUG] ignoring non-existing provider search directory /Users/flo/Library/Application Support/io.terraform/plugins
2024-05-08T17:51:45.721+0200 [DEBUG] ignoring non-existing provider search directory /Library/Application Support/io.terraform/plugins
2024-05-08T17:51:45.724+0200 [INFO]  CLI command args: []string{"apply"}
2024-05-08T17:51:45.727+0200 [DEBUG] New state was assigned lineage "eb067e59-bf38-8575-455c-cd6c50610a6c"
2024-05-08T17:51:45.968+0200 [DEBUG] checking for provisioner in "."
2024-05-08T17:51:45.971+0200 [DEBUG] checking for provisioner in "/opt/homebrew/bin"
2024-05-08T17:51:45.972+0200 [INFO]  backend/local: starting Apply operation
2024-05-08T17:51:45.976+0200 [DEBUG] created provider logger: level=debug
2024-05-08T17:51:45.976+0200 [INFO]  provider: configuring client automatic mTLS
2024-05-08T17:51:45.983+0200 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/hashicorp/aws/5.48.0/darwin_arm64/terraform-provider-aws_v5.48.0_x5 args=[.terraform/providers/registry.terraform.io/hashicorp/aws/5.48.0/darwin_arm64/terraform-provider-aws_v5.48.0_x5]
2024-05-08T17:51:45.992+0200 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/hashicorp/aws/5.48.0/darwin_arm64/terraform-provider-aws_v5.48.0_x5 pid=88620
2024-05-08T17:51:45.993+0200 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/hashicorp/aws/5.48.0/darwin_arm64/terraform-provider-aws_v5.48.0_x5
2024-05-08T17:51:46.111+0200 [INFO]  provider.terraform-provider-aws_v5.48.0_x5: configuring server automatic mTLS: timestamp=2024-05-08T17:51:46.111+0200
2024-05-08T17:51:46.116+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: plugin address: network=unix address=/var/folders/qb/q9rbqmxn1jqdfps720v2s9h80000gn/T/plugin19539374 timestamp=2024-05-08T17:51:46.116+0200
2024-05-08T17:51:46.116+0200 [DEBUG] provider: using plugin: version=5
2024-05-08T17:51:46.411+0200 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-05-08T17:51:46.414+0200 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/hashicorp/aws/5.48.0/darwin_arm64/terraform-provider-aws_v5.48.0_x5 pid=88620
2024-05-08T17:51:46.414+0200 [DEBUG] provider: plugin exited
2024-05-08T17:51:46.414+0200 [DEBUG] Building and walking validate graph
2024-05-08T17:51:46.415+0200 [DEBUG] ProviderTransformer: "aws_batch_job_definition.example" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/hashicorp/aws"]
2024-05-08T17:51:46.416+0200 [DEBUG] ReferenceTransformer: "aws_batch_job_definition.example" references: []
2024-05-08T17:51:46.416+0200 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/hashicorp/aws\"]" references: []
2024-05-08T17:51:46.416+0200 [DEBUG] Starting graph walk: walkValidate
2024-05-08T17:51:46.417+0200 [DEBUG] created provider logger: level=debug
2024-05-08T17:51:46.417+0200 [INFO]  provider: configuring client automatic mTLS
2024-05-08T17:51:46.419+0200 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/hashicorp/aws/5.48.0/darwin_arm64/terraform-provider-aws_v5.48.0_x5 args=[.terraform/providers/registry.terraform.io/hashicorp/aws/5.48.0/darwin_arm64/terraform-provider-aws_v5.48.0_x5]
2024-05-08T17:51:46.427+0200 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/hashicorp/aws/5.48.0/darwin_arm64/terraform-provider-aws_v5.48.0_x5 pid=88621
2024-05-08T17:51:46.427+0200 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/hashicorp/aws/5.48.0/darwin_arm64/terraform-provider-aws_v5.48.0_x5
2024-05-08T17:51:46.491+0200 [INFO]  provider.terraform-provider-aws_v5.48.0_x5: configuring server automatic mTLS: timestamp=2024-05-08T17:51:46.491+0200
2024-05-08T17:51:46.495+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: plugin address: address=/var/folders/qb/q9rbqmxn1jqdfps720v2s9h80000gn/T/plugin3398169604 network=unix timestamp=2024-05-08T17:51:46.495+0200
2024-05-08T17:51:46.495+0200 [DEBUG] provider: using plugin: version=5
2024-05-08T17:51:46.768+0200 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-05-08T17:51:46.776+0200 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/hashicorp/aws/5.48.0/darwin_arm64/terraform-provider-aws_v5.48.0_x5 pid=88621
2024-05-08T17:51:46.776+0200 [DEBUG] provider: plugin exited
2024-05-08T17:51:46.776+0200 [INFO]  backend/local: apply calling Plan
2024-05-08T17:51:46.776+0200 [DEBUG] Building and walking plan graph for NormalMode
2024-05-08T17:51:46.777+0200 [DEBUG] ProviderTransformer: "aws_batch_job_definition.example (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/hashicorp/aws"]
2024-05-08T17:51:46.777+0200 [DEBUG] ReferenceTransformer: "aws_batch_job_definition.example (expand)" references: []
2024-05-08T17:51:46.777+0200 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/hashicorp/aws\"]" references: []
2024-05-08T17:51:46.777+0200 [DEBUG] Starting graph walk: walkPlan
2024-05-08T17:51:46.777+0200 [DEBUG] created provider logger: level=debug
2024-05-08T17:51:46.777+0200 [INFO]  provider: configuring client automatic mTLS
2024-05-08T17:51:46.779+0200 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/hashicorp/aws/5.48.0/darwin_arm64/terraform-provider-aws_v5.48.0_x5 args=[.terraform/providers/registry.terraform.io/hashicorp/aws/5.48.0/darwin_arm64/terraform-provider-aws_v5.48.0_x5]
2024-05-08T17:51:46.788+0200 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/hashicorp/aws/5.48.0/darwin_arm64/terraform-provider-aws_v5.48.0_x5 pid=88622
2024-05-08T17:51:46.788+0200 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/hashicorp/aws/5.48.0/darwin_arm64/terraform-provider-aws_v5.48.0_x5
2024-05-08T17:51:46.849+0200 [INFO]  provider.terraform-provider-aws_v5.48.0_x5: configuring server automatic mTLS: timestamp=2024-05-08T17:51:46.849+0200
2024-05-08T17:51:46.853+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: plugin address: address=/var/folders/qb/q9rbqmxn1jqdfps720v2s9h80000gn/T/plugin2608156965 network=unix timestamp=2024-05-08T17:51:46.853+0200
2024-05-08T17:51:46.853+0200 [DEBUG] provider: using plugin: version=5
2024-05-08T17:51:47.117+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: Configuring Terraform AWS Provider: tf_mux_provider=*schema.GRPCProviderServer tf_provider_addr=registry.terraform.io/hashicorp/aws @caller=github.com/hashicorp/terraform-provider-aws/internal/conns/config.go:143 tf_rpc=ConfigureProvider @module=aws tf_req_id=7d4e9a3b-ceca-e8ca-d7bb-685ce874a9a8 timestamp=2024-05-08T17:51:47.117+0200
2024-05-08T17:51:47.117+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: Resolving credentials provider: tf_mux_provider=*schema.GRPCProviderServer tf_provider_addr=registry.terraform.io/hashicorp/aws tf_req_id=7d4e9a3b-ceca-e8ca-d7bb-685ce874a9a8 tf_rpc=ConfigureProvider @caller=github.com/hashicorp/aws-sdk-go-base/[email protected]/logging/tf_logger.go:47 @module=aws.aws-base timestamp=2024-05-08T17:51:47.117+0200
2024-05-08T17:51:47.117+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: Using profile: tf_provider_addr=registry.terraform.io/hashicorp/aws tf_rpc=ConfigureProvider tf_aws.profile=pulumi-dev-sandbox @module=aws.aws-base tf_aws.profile.source=envvar tf_mux_provider=*schema.GRPCProviderServer tf_req_id=7d4e9a3b-ceca-e8ca-d7bb-685ce874a9a8 @caller=github.com/hashicorp/aws-sdk-go-base/[email protected]/logging/tf_logger.go:47 timestamp=2024-05-08T17:51:47.117+0200
2024-05-08T17:51:47.117+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: Loading configuration: @caller=github.com/hashicorp/aws-sdk-go-base/[email protected]/logging/tf_logger.go:47 @module=aws.aws-base tf_rpc=ConfigureProvider tf_mux_provider=*schema.GRPCProviderServer tf_provider_addr=registry.terraform.io/hashicorp/aws tf_req_id=7d4e9a3b-ceca-e8ca-d7bb-685ce874a9a8 timestamp=2024-05-08T17:51:47.117+0200
2024-05-08T17:51:47.118+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: Retrieving credentials: tf_mux_provider=*schema.GRPCProviderServer tf_provider_addr=registry.terraform.io/hashicorp/aws tf_req_id=7d4e9a3b-ceca-e8ca-d7bb-685ce874a9a8 @caller=github.com/hashicorp/aws-sdk-go-base/[email protected]/logging/tf_logger.go:47 @module=aws.aws-base tf_rpc=ConfigureProvider timestamp=2024-05-08T17:51:47.118+0200
2024-05-08T17:51:47.119+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: HTTP Request Sent: rpc.service=SSO @caller=github.com/hashicorp/aws-sdk-go-base/[email protected]/logging/tf_logger.go:47 rpc.method=GetRoleCredentials net.peer.name=portal.sso.us-west-2.amazonaws.com rpc.system=aws-api tf_mux_provider=*schema.GRPCProviderServer tf_req_id=7d4e9a3b-ceca-e8ca-d7bb-685ce874a9a8 tf_rpc=ConfigureProvider @module=aws.aws-base http.user_agent="APN/1.0 HashiCorp/1.0 Terraform/1.5.7 (+https://www.terraform.io) terraform-provider-aws/5.48.0 (+https://registry.terraform.io/providers/hashicorp/aws) aws-sdk-go-v2/1.26.1 os/macos lang/go#1.22.0 md/GOOS#darwin md/GOARCH#arm64 api/sso#1.20.5" http.request.header.amz_sdk_invocation_id=729c8671-b128-4ee8-a87e-7a63345b2d1f http.request.header.amz_sdk_request="attempt=1; max=3" http.url=https://portal.sso.us-west-2.amazonaws.com/federation/credentials?account_id=616138583583&role_name=AdministratorAccess tf_aws.sdk=aws-sdk-go-v2 tf_provider_addr=registry.terraform.io/hashicorp/aws http.method=GET http.request.body= http.request.header.x_amz_sso_bearer_token=aoaAAAAAGY71bM8GcVO_yraiF5-Hi94p9kSzBt3GrHCnO-QZh2Ouv85EltWi34BeqnY49YSSeh1NCKFxpvQxcSD7gBkd1:MGQCMFZ6qKb7IYKw/n0Rmg1vkAc9N5DEaOXJoLAdBLfJD56+onLb+1P8QNQTe5bWgiBE+wIwNLfR6IJyzRYR0V8oeMKkE/0lxV0tewZnzhzp4VevDZoF4ktzSoapkt/L0eV7XBoR tf_aws.signing_region= aws.region=us-west-2 timestamp=2024-05-08T17:51:47.119+0200
2024-05-08T17:51:47.947+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: HTTP Response Received: aws.region=us-west-2 tf_req_id=7d4e9a3b-ceca-e8ca-d7bb-685ce874a9a8 tf_rpc=ConfigureProvider @caller=github.com/hashicorp/aws-sdk-go-base/[email protected]/logging/tf_logger.go:47 http.response.header.date="Wed, 08 May 2024 15:51:47 GMT" rpc.service=SSO tf_aws.sdk=aws-sdk-go-v2 http.status_code=200 tf_aws.signing_region= tf_provider_addr=registry.terraform.io/hashicorp/aws http.response.header.content_type=application/json http.response.header.x_amzn_requestid=389f28d7-d6e1-4aba-ade0-e096859fc3a2 http.response_content_length=1072 http.response.header.access_control_expose_headers=[RequestId, x-amzn-RequestId] http.response.header.cache_control=no-cache http.response.header.requestid=389f28d7-d6e1-4aba-ade0-e096859fc3a2 tf_mux_provider=*schema.GRPCProviderServer @module=aws.aws-base http.duration=826 rpc.method=GetRoleCredentials rpc.system=aws-api http.response.body="{"roleCredentials":{"accessKeyId":"ASIA************3F6H","secretAccessKey":"VZLL********************************7pDx","sessionToken":"IQoJb3JpZ2luX2VjEJj//////////wEaCXVzLXdlc3QtMiJGMEQCIGOjhJTiy/vE3Zs19c4ONj6ef25DTDyhoAhJRCv0V+bGAiA5J465ilRvD7mOvO4lvsupiitdZgkYlhroZdzIZMgBziqMAwjx//////////8BEAIaDDYxNjEzODU4MzU4MyIMuo1QZSxrXh9qgTz3KuACDI7ql2ag2TN5CFgKnc+tWBMeWmvGUuxAtJrX9Lk9e7wmWJP+0OrN6LQBEWT6ip5s7IB4AcaAeAiCyfOIHOJvt4VRsUVYbjujyZGneOeTJB/6MWnFEsTBhC+KYlD4T8fZIY3dmATu7SX8tPST7twZOWLQAnF6XY9XUHeCTOjMQbfiYiH9BItTRgaSnBvugj5DL4cM4D+Yg61wxiNpIV+E9lPYR1ALNEDQy49bBS/uRdJu/mFdIV9CEOMGeFrlCYUn/d/HfBCJH1gw5paOyjCmXUMkG9pMWj4ycQ+JJQuhHcIT7nTP5jo8sGeyOdIszqFa/Z1z5T8nA9bCCeZ3a/tT/SJvPKXt+91ifjsyOqJk+MtckcU/OujtDmcgX6MwV3y7DARspKoZRD+E0CJGRXSg7llPlsl10QmRv6PMFt+lKjHha8cEL9BXE/A/dVIQjEtV7fUiBBnSK3YCAxxIjhInnDCTv+6xBjqnAaPpSyD8Aj7DqQVHemftdSEksGKzYkpYasc5zNgssv51ssW9swrJg8cBzQZ/AfYWnhGt4+wvmLHC+/+Rd6/Q0nM/TVd6hLBbVPHjvhBP5GefKNRIVp87RbXDauUHtGNm1d0OKzYpweAsXeGNk0OZ3U+pMM24PzXlToQ1i0JNyga+D50Qm7/l3CVmFABJgckB0x7GyauvFx5G4DFNiqB3vYjSKAiV7ZaV","expiration":1715212306000}}
" http.response.header.server="AWS SSO" timestamp=2024-05-08T17:51:47.946+0200
2024-05-08T17:51:47.947+0200 [INFO]  provider.terraform-provider-aws_v5.48.0_x5: Retrieved credentials: tf_rpc=ConfigureProvider @module=aws.aws-base tf_aws.credentials_source=SSOProvider tf_mux_provider=*schema.GRPCProviderServer tf_provider_addr=registry.terraform.io/hashicorp/aws @caller=github.com/hashicorp/aws-sdk-go-base/[email protected]/logging/tf_logger.go:39 tf_req_id=7d4e9a3b-ceca-e8ca-d7bb-685ce874a9a8 timestamp=2024-05-08T17:51:47.947+0200
2024-05-08T17:51:47.947+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: Loading configuration: @caller=github.com/hashicorp/aws-sdk-go-base/[email protected]/logging/tf_logger.go:47 tf_mux_provider=*schema.GRPCProviderServer tf_provider_addr=registry.terraform.io/hashicorp/aws tf_req_id=7d4e9a3b-ceca-e8ca-d7bb-685ce874a9a8 @module=aws.aws-base tf_rpc=ConfigureProvider timestamp=2024-05-08T17:51:47.947+0200
2024-05-08T17:51:47.948+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: Creating AWS SDK v1 session: @module=aws tf_mux_provider=*schema.GRPCProviderServer @caller=github.com/hashicorp/terraform-provider-aws/internal/conns/config.go:167 tf_provider_addr=registry.terraform.io/hashicorp/aws tf_req_id=7d4e9a3b-ceca-e8ca-d7bb-685ce874a9a8 tf_rpc=ConfigureProvider timestamp=2024-05-08T17:51:47.947+0200
2024-05-08T17:51:47.949+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: Retrieving AWS account details: @caller=github.com/hashicorp/terraform-provider-aws/internal/conns/config.go:182 tf_mux_provider=*schema.GRPCProviderServer @module=aws tf_provider_addr=registry.terraform.io/hashicorp/aws tf_req_id=7d4e9a3b-ceca-e8ca-d7bb-685ce874a9a8 tf_rpc=ConfigureProvider timestamp=2024-05-08T17:51:47.949+0200
2024-05-08T17:51:47.949+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: Retrieving caller identity from STS: tf_mux_provider=*schema.GRPCProviderServer tf_provider_addr=registry.terraform.io/hashicorp/aws tf_req_id=7d4e9a3b-ceca-e8ca-d7bb-685ce874a9a8 tf_rpc=ConfigureProvider @caller=github.com/hashicorp/aws-sdk-go-base/[email protected]/logging/tf_logger.go:47 @module=aws.aws-base timestamp=2024-05-08T17:51:47.949+0200
2024-05-08T17:51:47.951+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: HTTP Request Sent: http.request.header.x_amz_date=20240508T155147Z rpc.service=STS @caller=github.com/hashicorp/aws-sdk-go-base/[email protected]/logging/tf_logger.go:47 http.method=POST http.request.body="Action=GetCallerIdentity&Version=2011-06-15
" @module=aws.aws-base http.url=https://sts.us-west-2.amazonaws.com/ rpc.method=GetCallerIdentity net.peer.name=sts.us-west-2.amazonaws.com tf_mux_provider=*schema.GRPCProviderServer tf_rpc=ConfigureProvider http.request.header.amz_sdk_invocation_id=5150b475-4464-4863-a5ca-cf359499ecfe aws.region=us-west-2 tf_aws.signing_region= tf_req_id=7d4e9a3b-ceca-e8ca-d7bb-685ce874a9a8 http.request.header.amz_sdk_request="attempt=1; max=25" rpc.system=aws-api http.request.header.authorization="AWS4-HMAC-SHA256 Credential=ASIA************3F6H/20240508/us-west-2/sts/aws4_request, SignedHeaders=amz-sdk-invocation-id;amz-sdk-request;content-length;content-type;host;x-amz-date;x-amz-security-token, Signature=*****" http.request_content_length=43 http.user_agent="APN/1.0 HashiCorp/1.0 Terraform/1.5.7 (+https://www.terraform.io) terraform-provider-aws/5.48.0 (+https://registry.terraform.io/providers/hashicorp/aws) aws-sdk-go-v2/1.26.1 os/macos lang/go#1.22.0 md/GOOS#darwin md/GOARCH#arm64 api/sts#1.28.6" tf_aws.sdk=aws-sdk-go-v2 http.request.header.content_type=application/x-www-form-urlencoded http.request.header.x_amz_security_token=***** tf_provider_addr=registry.terraform.io/hashicorp/aws timestamp=2024-05-08T17:51:47.951+0200
2024-05-08T17:51:48.736+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: HTTP Response Received: @module=aws.aws-base http.response.body="<GetCallerIdentityResponse xmlns="https://sts.amazonaws.com/doc/2011-06-15/">
  <GetCallerIdentityResult>
    <Arn>arn:aws:sts::616138583583:assumed-role/AWSReservedSSO_AdministratorAccess_224e23fb315b65cb/[email protected]</Arn>
    <UserId>AROA*************UXEV:[email protected]</UserId>
    <Account>616138583583</Account>
  </GetCallerIdentityResult>
  <ResponseMetadata>
    <RequestId>36da6997-ab48-462f-a51d-deba52f09906</RequestId>
  </ResponseMetadata>
</GetCallerIdentityResponse>
" rpc.system=aws-api @caller=github.com/hashicorp/aws-sdk-go-base/[email protected]/logging/tf_logger.go:47 rpc.service=STS tf_rpc=ConfigureProvider http.response.header.date="Wed, 08 May 2024 15:51:48 GMT" rpc.method=GetCallerIdentity tf_aws.sdk=aws-sdk-go-v2 tf_aws.signing_region= http.response.header.content_type=text/xml http.response.header.x_amzn_requestid=36da6997-ab48-462f-a51d-deba52f09906 http.response_content_length=494 http.status_code=200 aws.region=us-west-2 http.duration=784 tf_mux_provider=*schema.GRPCProviderServer tf_provider_addr=registry.terraform.io/hashicorp/aws tf_req_id=7d4e9a3b-ceca-e8ca-d7bb-685ce874a9a8 timestamp=2024-05-08T17:51:48.735+0200
2024-05-08T17:51:48.736+0200 [INFO]  provider.terraform-provider-aws_v5.48.0_x5: Retrieved caller identity from STS: tf_rpc=ConfigureProvider @caller=github.com/hashicorp/aws-sdk-go-base/[email protected]/logging/tf_logger.go:39 @module=aws.aws-base tf_mux_provider=*schema.GRPCProviderServer tf_provider_addr=registry.terraform.io/hashicorp/aws tf_req_id=7d4e9a3b-ceca-e8ca-d7bb-685ce874a9a8 timestamp=2024-05-08T17:51:48.736+0200
2024-05-08T17:51:48.740+0200 [DEBUG] ReferenceTransformer: "aws_batch_job_definition.example" references: []
aws_batch_job_definition.example: Refreshing state... [id=arn:aws:batch:us-west-2:616138583583:job-definition/test-job-definition:1]
2024-05-08T17:51:48.748+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: HTTP Request Sent: net.peer.name=batch.us-west-2.amazonaws.com tf_mux_provider=*schema.GRPCProviderServer tf_provider_addr=registry.terraform.io/hashicorp/aws tf_rpc=ReadResource http.request.header.x_amz_security_token=***** http.request_content_length=96 http.request.header.content_type=application/json http.url=https://batch.us-west-2.amazonaws.com/v1/describejobdefinitions rpc.method=DescribeJobDefinitions tf_resource_type=aws_batch_job_definition aws.region=us-west-2 http.flavor=1.1 rpc.system=aws-api tf_req_id=72406dd2-1b69-1326-4198-c66642831338 rpc.service=Batch @caller=github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/[email protected]/logger.go:109 http.method=POST http.request.body="{"jobDefinitions":["arn:aws:batch:us-west-2:616138583583:job-definition/test-job-definition:1"]}
" http.request.header.authorization="AWS4-HMAC-SHA256 Credential=ASIA************3F6H/20240508/us-west-2/batch/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date;x-amz-security-token, Signature=*****" @module=aws tf_aws.sdk=aws-sdk-go http.request.header.x_amz_date=20240508T155148Z http.user_agent="APN/1.0 HashiCorp/1.0 Terraform/1.5.7 (+https://www.terraform.io) terraform-provider-aws/5.48.0 (+https://registry.terraform.io/providers/hashicorp/aws) aws-sdk-go/1.52.0 (go1.22.0; darwin; arm64)" timestamp=2024-05-08T17:51:48.748+0200
2024-05-08T17:51:49.403+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: HTTP Response Received: http.response.body="{
  "jobDefinitions" : [ {
    "jobDefinitionName" : "test-job-definition",
    "jobDefinitionArn" : "arn:aws:batch:us-west-2:616138583583:job-definition/test-job-definition:1",
    "revision" : 1,
    "status" : "ACTIVE",
    "type" : "container",
    "parameters" : { },
    "containerProperties" : {
      "image" : "busybox",
      "command" : [ "ls", "-la" ],
      "volumes" : [ {
        "host" : {
          "sourcePath" : "/tmp"
        },
        "name" : "tmp"
      } ],
      "environment" : [ {
        "name" : "VARNAME",
        "value" : "VARVAL"
      } ],
      "mountPoints" : [ {
        "containerPath" : "/tmp",
        "readOnly" : false,
        "sourceVolume" : "tmp"
      } ],
      "ulimits" : [ {
        "hardLimit" : 1024,
        "name" : "nofile",
        "softLimit" : 1024
      } ],
      "resourceRequirements" : [ {
        "value" : "4",
        "type" : "VCPU"
      }, {
        "value" : "512",
        "type" : "MEMORY"
      } ],
      "secrets" : [ ]
    },
    "tags" : { },
    "propagateTags" : false,
    "containerOrchestrationType" : "ECS"
  } ]
}
" http.response.header.date="Wed, 08 May 2024 15:51:49 GMT" http.response.header.x_amz_apigw_id=XdXfXHLvvHcELgA= http.response_content_length=1099 tf_mux_provider=*schema.GRPCProviderServer http.response.header.x_amzn_requestid=edf4bc94-b27c-4ca3-a5f2-be0e95e770fd http.response.header.content_type=application/json aws.region=us-west-2 http.response.header.access_control_allow_origin=* http.response.header.access_control_expose_headers=X-amzn-errortype,X-amzn-requestid,X-amzn-errormessage,X-amzn-trace-id,X-amz-apigw-id,date http.response.header.x_amzn_trace_id=Root=1-663b9f95-42bbbce05eea234828a6fb28 rpc.system=aws-api tf_req_id=72406dd2-1b69-1326-4198-c66642831338 @caller=github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/[email protected]/logger.go:157 http.duration=654 rpc.service=Batch @module=aws rpc.method=DescribeJobDefinitions http.status_code=200 tf_rpc=ReadResource tf_aws.sdk=aws-sdk-go tf_provider_addr=registry.terraform.io/hashicorp/aws tf_resource_type=aws_batch_job_definition timestamp=2024-05-08T17:51:49.403+0200
2024-05-08T17:51:49.417+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: panic: interface conversion: interface {} is nil, not map[string]interface {}
2024-05-08T17:51:49.417+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5:
2024-05-08T17:51:49.417+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: goroutine 29 [running]:
2024-05-08T17:51:49.418+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: github.com/hashicorp/terraform-provider-aws/internal/service/batch.needsJobDefUpdate(0x14003ea0380)
2024-05-08T17:51:49.418+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: 	github.com/hashicorp/terraform-provider-aws/internal/service/batch/job_definition.go:537 +0x1004
2024-05-08T17:51:49.418+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: github.com/hashicorp/terraform-provider-aws/internal/service/batch.jobDefinitionCustomizeDiff({0x1169c6b20?, 0x12083ce20?}, 0x14003ea0380, {0xe?, 0x140025615f0?})
2024-05-08T17:51:49.418+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: 	github.com/hashicorp/terraform-provider-aws/internal/service/batch/job_definition.go:452 +0x44
2024-05-08T17:51:49.418+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: github.com/hashicorp/terraform-provider-aws/internal/service/batch.ResourceJobDefinition.Sequence.func23({0x117c14648, 0x14001e138f0}, 0x14003ea0380, {0x1179c3e00, 0x140025615f0})
2024-05-08T17:51:49.418+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: 	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/customdiff/compose.go:69 +0x80
2024-05-08T17:51:49.418+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: github.com/hashicorp/terraform-provider-aws/internal/provider.New.(*wrappedResource).CustomizeDiff.func5({0x117c14648?, 0x14001dd76b0?}, 0x14003ea0380, {0x1179c3e00, 0x140025615f0})
2024-05-08T17:51:49.418+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: 	github.com/hashicorp/terraform-provider-aws/internal/provider/intercept.go:186 +0x68
2024-05-08T17:51:49.418+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.Diff(0x14001125290, {0x117c14648, 0x14001dd76b0}, 0x14001dc1a00, 0x1400376e320, 0x14000a477b8, {0x1179c3e00, 0x140025615f0}, 0x0)
2024-05-08T17:51:49.418+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: 	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/schema.go:698 +0x3b8
2024-05-08T17:51:49.418+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).SimpleDiff(0x117c14a78?, {0x117c14648?, 0x14001dd76b0?}, 0x14001dc1a00, 0x14001dd76e0?, {0x1179c3e00?, 0x140025615f0?})
2024-05-08T17:51:49.418+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: 	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:962 +0x9c
2024-05-08T17:51:49.418+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).PlanResourceChange(0x14003ff8798, {0x117c14648?, 0x14001dd75c0?}, 0x140037678b0)
2024-05-08T17:51:49.418+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: 	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:798 +0x824
2024-05-08T17:51:49.418+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).PlanResourceChange(0x14001816a10, {0x117c14648?, 0x14001dd72f0?}, 0x140037678b0)
2024-05-08T17:51:49.418+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: 	github.com/hashicorp/[email protected]/tf5muxserver/mux_server_PlanResourceChange.go:73 +0x250
2024-05-08T17:51:49.418+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).PlanResourceChange(0x1400074de00, {0x117c14648?, 0x14001dd6930?}, 0x14000f8a8c0)
2024-05-08T17:51:49.418+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: 	github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:811 +0x2b4
2024-05-08T17:51:49.418+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_PlanResourceChange_Handler({0x117780b60, 0x1400074de00}, {0x117c14648, 0x14001dd6930}, 0x14001814680, 0x0)
2024-05-08T17:51:49.418+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: 	github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:500 +0x1c0
2024-05-08T17:51:49.418+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: google.golang.org/grpc.(*Server).processUnaryRPC(0x14000f7e200, {0x117c14648, 0x14001dd68a0}, {0x117c5bd98, 0x14000267080}, 0x14001ddb200, 0x140026006f0, 0x1207acd40, 0x0)
2024-05-08T17:51:49.418+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: 	google.golang.org/[email protected]/server.go:1369 +0xb58
2024-05-08T17:51:49.418+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: google.golang.org/grpc.(*Server).handleStream(0x14000f7e200, {0x117c5bd98, 0x14000267080}, 0x14001ddb200)
2024-05-08T17:51:49.418+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: 	google.golang.org/[email protected]/server.go:1780 +0xb20
2024-05-08T17:51:49.418+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: google.golang.org/grpc.(*Server).serveStreams.func2.1()
2024-05-08T17:51:49.418+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: 	google.golang.org/[email protected]/server.go:1019 +0x8c
2024-05-08T17:51:49.418+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 49
2024-05-08T17:51:49.418+0200 [DEBUG] provider.terraform-provider-aws_v5.48.0_x5: 	google.golang.org/[email protected]/server.go:1030 +0x13c
2024-05-08T17:51:49.430+0200 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-05-08T17:51:49.430+0200 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/hashicorp/aws/5.48.0/darwin_arm64/terraform-provider-aws_v5.48.0_x5 pid=88622 error="exit status 2"
2024-05-08T17:51:49.431+0200 [ERROR] plugin.(*GRPCProvider).PlanResourceChange: error="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-05-08T17:51:49.431+0200 [ERROR] vertex "aws_batch_job_definition.example" error: Plugin did not respond
2024-05-08T17:51:49.431+0200 [ERROR] vertex "aws_batch_job_definition.example (expand)" error: Plugin did not respond

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

@flostadler flostadler added the bug Addresses a defect in current functionality. label May 8, 2024
Copy link

github-actions bot commented May 8, 2024

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added crash Results from or addresses a Terraform crash or kernel panic. service/batch Issues and PRs that pertain to the batch service. labels May 8, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label May 8, 2024
@flostadler
Copy link
Author

I started working on a fix for this

@DanielRieske
Copy link
Contributor

@flostadler thank you for reporting this, let me know if you need any help with the fix.

@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label May 13, 2024
flostadler added a commit to flostadler/terraform-provider-aws that referenced this issue May 14, 2024
Computing whether a Batch JobDefinition has a diff panics if the `retry_strategy` is empty.
This is a valid configuration because all properties of `retry_strategy` are optional.

This patch fixes that by adding the missing nil checks for the retry strategy.

Fixes hashicorp#37349
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/batch Issues and PRs that pertain to the batch service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants