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.84k stars 9.19k forks source link

[Bug]: The terraform-provider-aws_v5.76.0_x5 plugin crashed! #40162

Open httzipdev opened 2 hours ago

httzipdev commented 2 hours ago

Terraform Core Version

v1.9.8

AWS Provider Version

v5.76.0

Affected Resource(s)

aws_cognito_user_pool

Expected Behavior

resource "aws_cognito_user_pool" "this" {
  name = "MyPool"

  schema {
    attribute_data_type = "String"
    name                = "email"
    required            = true
  }
  schema {
    attribute_data_type = "String"
    name                = "name"
    required            = false
    mutable             = true
  }
  schema {
    attribute_data_type = "String"
    name                = "ROLE_NAME"
    required            = false
    mutable             = true
  }

  auto_verified_attributes = ["email"]
}

First time apply: terraform apply

-> Success.

Second time: terraform apply

-> No changes

Actual Behavior

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

### Relevant Error/Panic Output Snippet

```shell
`
module.user_pool.aws_cognito_user_pool.this: Modifying... [id=eu-central-1_pvvk6A8ns]
╷
│ Error: Plugin did not respond
│ 
│   with module.user_pool.aws_cognito_user_pool.this,
│   on user-pool/main.tf line 1, in resource "aws_cognito_user_pool" "this":
│    1: resource "aws_cognito_user_pool" "this" {
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵

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

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

goroutine 83 [running]:
github.com/hashicorp/terraform-provider-aws/internal/service/cognitoidp.resourceUserPoolSchemaHash({0x0?, 0x0?})
        github.com/hashicorp/terraform-provider-aws/internal/service/cognitoidp/user_pool.go:2294 +0x70c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Set).hash(0x14000935540?, {0x0?, 0x0?})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/set.go:221 +0x34
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Set).add(0x14000aea8a0, {0x0, 0x0}, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/set.go:201 +0x6c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ConfigFieldReader).readSet(0x14001fde480, {0x14000b7cc00, 0x1, 0x1}, 0x140009352c0)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/field_reader_config.go:287 +0x298
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ConfigFieldReader).readField(0x14001fde480, {0x14000b7cc00, 0x1, 0x1}, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/field_reader_config.go:110 +0x320
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ConfigFieldReader).ReadField(0x11ad33a80?, {0x14000b7cc00?, 0x11779727a?, 0x6?})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/field_reader_config.go:32 +0x84
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*MultiLevelFieldReader).ReadFieldExact(0x14000b7cbf0?, {0x14000b7cc00, 0x1, 0x1}, {0x11779727a, 0x6})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/field_reader_multi.go:34 +0x78
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).get(0x14004063280, {0x14000b7cc00, 0x1, 0x1}, 0x0?)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/resource_data.go:551 +0xfc
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).getChange(0x14004063280, {0x11779753e?, 0x6?}, 0x1?, 0x12)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/resource_data.go:527 +0x150
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).diffChange(0x14002ed4bc8?, {0x11779753e?, 0x98?})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/resource_data.go:504 +0x44
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.diffSet(0x14001909d40, {0x11cd409a8, 0x140015a1230}, {0x11779753e, 0x6}, 0x140009352c0, 0x14002ed4f98, {0x11cd964e0, 0x14004063280}, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/schema.go:1412 +0x5c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.diff(0x14001909d40, {0x11cd409a8, 0x140015a1230}, {0x11779753e, 0x6}, 0x140009352c0, 0x14004063200, {0x11cd964e0, 0x14004063280}, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/schema.go:1134 +0x180
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.Diff(0x14001909d40, {0x11cd409a8, 0x140015a1230}, 0x14000d33860, 0x14001098fa0, 0x0, {0x0, 0x0}, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/schema.go:678 +0x298
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.diffFromValues({0x11cd409a8, 0x140015a1230}, {{{0x11cd40d68?, 0x14000d2e178?}}, {0x11ad30660?, 0x140017f65d0?}}, {{{0x11cd40d68?, 0x14000d2e2b0?}}, {0x11ad30660?, 0x140018268d0?}}, ...)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.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.35.0/helper/schema/shims.go:23
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0x14002dd0450, {0x11cd409a8?, 0x140015a0e70?}, 0x1400029ae10)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/grpc_provider.go:1095 +0x500
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).ApplyResourceChange(0x1400123ef00, {0x11cd409a8?, 0x1400152b8c0?}, 0x1400029ae10)
        github.com/hashicorp/terraform-plugin-mux@v0.17.0/tf5muxserver/mux_server_ApplyResourceChange.go:36 +0x184
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0x140017e1d60, {0x11cd409a8?, 0x14001502630?}, 0x14000374070)
        github.com/hashicorp/terraform-plugin-go@v0.25.0/tfprotov5/tf5server/server.go:865 +0x2a8
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x11c8aed80, 0x140017e1d60}, {0x11cd409a8, 0x14001502630}, 0x14004062000, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.25.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:611 +0x1c0
google.golang.org/grpc.(*Server).processUnaryRPC(0x140003a5c00, {0x11cd409a8, 0x140040cbdd0}, {0x11cdc05c0, 0x1400304a000}, 0x140021fde60, 0x14002e15d10, 0x1278303f8, 0x0)
        google.golang.org/grpc@v1.67.1/server.go:1394 +0xb64
google.golang.org/grpc.(*Server).handleStream(0x140003a5c00, {0x11cdc05c0, 0x1400304a000}, 0x140021fde60)
        google.golang.org/grpc@v1.67.1/server.go:1805 +0xb20
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        google.golang.org/grpc@v1.67.1/server.go:1029 +0x84
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 55
        google.golang.org/grpc@v1.67.1/server.go:1040 +0x13c

Terraform Configuration Files

(empty)

Steps to Reproduce

Run: terraform apply After completion:, run again: terraform apply

Debug Output


module.user_pool.aws_cognito_user_pool.this: Refreshing state... [id=eu-central-1_pvvk6A8ns]
module.user_pool_hosted_ui.aws_cognito_user_pool_domain.this: Refreshing state... [id=sysoo-hosted-ui-dev]
module.user_pool_hosted_ui.aws_cognito_user_pool_client.this: Refreshing state... [id=6m7r8lg991b2i2ur4qkmhbegdv]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # module.user_pool.aws_cognito_user_pool.this will be updated in-place
  ~ resource "aws_cognito_user_pool" "this" {
        id                         = "eu-central-1_pvvk6A8ns"
        name                       = "MyPool"
        tags                       = {}
        # (16 unchanged attributes hidden)

      - schema {
          - attribute_data_type      = "String" -> null
          - developer_only_attribute = false -> null
          - mutable                  = false -> null
          - name                     = "email" -> null
          - required                 = true -> null
        }
      - schema {
          - attribute_data_type      = "String" -> null
          - developer_only_attribute = false -> null
          - mutable                  = true -> null
          - name                     = "ROLE_NAME" -> null
          - required                 = false -> null

          - string_attribute_constraints {}
        }
      + schema {
          + attribute_data_type = "String"
          + mutable             = true
          + name                = "ROLE_NAME"
          + required            = false
        }
      + schema {
          + attribute_data_type = "String"
          + mutable             = true
          + name                = "name"
          + required            = false
        }
      + schema {
          + attribute_data_type = "String"
          + name                = "email"
          + required            = true
        }
      + schema {
        }

        # (5 unchanged blocks hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.
module.user_pool.aws_cognito_user_pool.this: Modifying... [id=eu-central-1_pvvk6A8ns]
╷

### Panic Output

````terraform
Plan: 0 to add, 1 to change, 0 to destroy.
module.user_pool.aws_cognito_user_pool.this: Modifying... [id=eu-central-1_pvvk6A8ns]
╷
│ Error: Plugin did not respond
│ 
│   with module.user_pool.aws_cognito_user_pool.this,
│   on user-pool/main.tf line 1, in resource "aws_cognito_user_pool" "this":
│    1: resource "aws_cognito_user_pool" "this" {
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵

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

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

goroutine 83 [running]:
github.com/hashicorp/terraform-provider-aws/internal/service/cognitoidp.resourceUserPoolSchemaHash({0x0?, 0x0?})
        github.com/hashicorp/terraform-provider-aws/internal/service/cognitoidp/user_pool.go:2294 +0x70c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Set).hash(0x14000935540?, {0x0?, 0x0?})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/set.go:221 +0x34
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Set).add(0x14000aea8a0, {0x0, 0x0}, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/set.go:201 +0x6c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ConfigFieldReader).readSet(0x14001fde480, {0x14000b7cc00, 0x1, 0x1}, 0x140009352c0)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/field_reader_config.go:287 +0x298
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ConfigFieldReader).readField(0x14001fde480, {0x14000b7cc00, 0x1, 0x1}, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/field_reader_config.go:110 +0x320
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ConfigFieldReader).ReadField(0x11ad33a80?, {0x14000b7cc00?, 0x11779727a?, 0x6?})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/field_reader_config.go:32 +0x84
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*MultiLevelFieldReader).ReadFieldExact(0x14000b7cbf0?, {0x14000b7cc00, 0x1, 0x1}, {0x11779727a, 0x6})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/field_reader_multi.go:34 +0x78
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).get(0x14004063280, {0x14000b7cc00, 0x1, 0x1}, 0x0?)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/resource_data.go:551 +0xfc
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).getChange(0x14004063280, {0x11779753e?, 0x6?}, 0x1?, 0x12)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/resource_data.go:527 +0x150
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).diffChange(0x14002ed4bc8?, {0x11779753e?, 0x98?})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/resource_data.go:504 +0x44
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.diffSet(0x14001909d40, {0x11cd409a8, 0x140015a1230}, {0x11779753e, 0x6}, 0x140009352c0, 0x14002ed4f98, {0x11cd964e0, 0x14004063280}, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/schema.go:1412 +0x5c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.diff(0x14001909d40, {0x11cd409a8, 0x140015a1230}, {0x11779753e, 0x6}, 0x140009352c0, 0x14004063200, {0x11cd964e0, 0x14004063280}, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/schema.go:1134 +0x180
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.Diff(0x14001909d40, {0x11cd409a8, 0x140015a1230}, 0x14000d33860, 0x14001098fa0, 0x0, {0x0, 0x0}, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/schema.go:678 +0x298
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.diffFromValues({0x11cd409a8, 0x140015a1230}, {{{0x11cd40d68?, 0x14000d2e178?}}, {0x11ad30660?, 0x140017f65d0?}}, {{{0x11cd40d68?, 0x14000d2e2b0?}}, {0x11ad30660?, 0x140018268d0?}}, ...)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.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.35.0/helper/schema/shims.go:23
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0x14002dd0450, {0x11cd409a8?, 0x140015a0e70?}, 0x1400029ae10)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/grpc_provider.go:1095 +0x500
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).ApplyResourceChange(0x1400123ef00, {0x11cd409a8?, 0x1400152b8c0?}, 0x1400029ae10)
        github.com/hashicorp/terraform-plugin-mux@v0.17.0/tf5muxserver/mux_server_ApplyResourceChange.go:36 +0x184
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0x140017e1d60, {0x11cd409a8?, 0x14001502630?}, 0x14000374070)
        github.com/hashicorp/terraform-plugin-go@v0.25.0/tfprotov5/tf5server/server.go:865 +0x2a8
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x11c8aed80, 0x140017e1d60}, {0x11cd409a8, 0x14001502630}, 0x14004062000, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.25.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:611 +0x1c0
google.golang.org/grpc.(*Server).processUnaryRPC(0x140003a5c00, {0x11cd409a8, 0x140040cbdd0}, {0x11cdc05c0, 0x1400304a000}, 0x140021fde60, 0x14002e15d10, 0x1278303f8, 0x0)
        google.golang.org/grpc@v1.67.1/server.go:1394 +0xb64
google.golang.org/grpc.(*Server).handleStream(0x140003a5c00, {0x11cdc05c0, 0x1400304a000}, 0x140021fde60)
        google.golang.org/grpc@v1.67.1/server.go:1805 +0xb20
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        google.golang.org/grpc@v1.67.1/server.go:1029 +0x84
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 55
        google.golang.org/grpc@v1.67.1/server.go:1040 +0x13c

Error: The terraform-provider-aws_v5.76.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 2 hours ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue