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]: The terraform-provider-aws_v5.73.0_x5 plugin crashed! when applying changes to aws_cognito_user_pool resource #39992

Closed
Mehmet-Kalich opened this issue Nov 3, 2024 · 13 comments · Fixed by #40195
Assignees
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/cognitoidp Issues and PRs that pertain to the cognitoidp service.
Milestone

Comments

@Mehmet-Kalich
Copy link

Mehmet-Kalich commented Nov 3, 2024

Terraform Core Version

v1.9.8

AWS Provider Version

v5.73.0

Affected Resource(s)

only the aws_cognito_user_pool resource

Expected Behavior

as there were some out of state changes made in the AWS cognito console to the schema of a user pool, the terraform was applied to bring the user pool back into state with the configured terraform.

Actual Behavior

Instead an error returned saying "Plugin did not respond" which mentions:

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

Relevant Error/Panic Output Snippet

│ Error: Plugin did not respond
│ 
│   with aws_cognito_user_pool.pool,
│   on cognito_main.tf line 1, in resource "aws_cognito_user_pool" "pool":
│    1: resource "aws_cognito_user_pool" "pool" {
│ 
│ 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.73.0_x5 plugin:

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

goroutine 69 [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 +0x7c5
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Set).hash(0xc0022e6a00?, {0x0?, 0x0?})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/set.go:221 +0x26
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Set).add(0xc00234e200, {0x0, 0x0}, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/set.go:201 +0x85
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ConfigFieldReader).readSet(0xc00232e150, {0xc002354830, 0x1, 0x1}, 0xc0022e63c0)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/field_reader_config.go:287 +0x35e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ConfigFieldReader).readField(0xc00232e150, {0xc002354830, 0x1, 0x1}, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/field_reader_config.go:110 +0x429
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ConfigFieldReader).ReadField(0x170afb80?, {0xc002354830?, 0x18d6960d?, 0x6?})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/field_reader_config.go:32 +0xac
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*MultiLevelFieldReader).ReadFieldExact(0xc002354820?, {0xc002354830, 0x1, 0x1}, {0x18d6960d, 0x6})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/field_reader_multi.go:34 +0x99
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).get(0xc00062a180, {0xc002354830, 0x1, 0x1}, 0x0?)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource_data.go:551 +0x12f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).getChange(0xc00062a180, {0x18d698dd?, 0x6?}, 0x1?, 0x12)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource_data.go:527 +0x1c7
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).diffChange(0x168d3d60?, {0x18d698dd?, 0x25cb1880?})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource_data.go:504 +0x6a
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.diffSet(0xc0022bd8c0, {0x1b1757e8, 0xc00128f890}, {0x18d698dd, 0x6}, 0xc0022e63c0, 0xc002e79010, {0x1b1c9da0, 0xc00062a180}, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/schema.go:1412 +0x74
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.diff(0xc0022bd8c0, {0x1b1757e8, 0xc00128f890}, {0x18d698dd, 0x6}, 0xc0022e63c0, 0xc00062a100, {0x1b1c9da0, 0xc00062a180}, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/schema.go:1134 +0x25a
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.Diff(0xc0022bd8c0, {0x1b1757e8, 0xc00128f890}, 0xc000b3eb60, 0xc00135b680, 0x0, {0x0, 0x0}, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/schema.go:678 +0x332
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.diffFromValues({0x1b1757e8, 0xc00128f890}, {{{0x1b175ba8?, 0xc000920030?}}, {0x170ac8e0?, 0xc001dce540?}}, {{{0x1b175ba8, 0xc000920138}}, {0x170ac8e0, 0xc001dcf4a0}}, ...)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/shims.go:46 +0x265
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.DiffFromValues(...)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/shims.go:23
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc002d903f0, {0x1b1757e8?, 0xc00128f7d0?}, 0xc001175d60)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1093 +0x67a
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).ApplyResourceChange(0xc001a01b20, {0x1b1757e8?, 0xc00128f500?}, 0xc001175d60)
        github.com/hashicorp/[email protected]/tf5muxserver/mux_server_ApplyResourceChange.go:36 +0x193
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc000664e60, {0x1b1757e8?, 0xc00128eb40?}, 0xc0008a64d0)
        github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:865 +0x3bc
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x18b8fe60, 0xc000664e60}, {0x1b1757e8, 0xc00128eb40}, 0xc00031f200, 0x0)
        github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:545 +0x1a6
google.golang.org/grpc.(*Server).processUnaryRPC(0xc001a39000, {0x1b1757e8, 0xc00128eab0}, {0x1b1f2800, 0xc00203a9c0}, 0xc00128dc20, 0xc002e697a0, 0x25c5b298, 0x0)
        google.golang.org/[email protected]/server.go:1394 +0xe2b
google.golang.org/grpc.(*Server).handleStream(0xc001a39000, {0x1b1f2800, 0xc00203a9c0}, 0xc00128dc20)
        google.golang.org/[email protected]/server.go:1805 +0xe8b
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        google.golang.org/[email protected]/server.go:1029 +0x7f
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 55
        google.golang.org/[email protected]/server.go:1040 +0x125

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

resource "aws_cognito_user_pool" "pool" {
  name = "${var.user_pool_name}-${var.env}"

  username_attributes = [
    "email",
  ]

  password_policy {
    minimum_length                   = 12
    require_lowercase                = true
    require_uppercase                = true
    require_numbers                  = true
    require_symbols                  = true
    temporary_password_validity_days = 7
  }

  admin_create_user_config {
    allow_admin_create_user_only = false
  }

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

    cloudflare = {
      source  = "cloudflare/cloudflare"
      version = "~> 4.0"
    }
  }
}

Steps to Reproduce

  1. Create user pool
  2. Change the attributes of the user pool in AWS so that it reflects these changes in the terraform:
  # aws_cognito_user_pool.pool will be updated in-place
  ~ resource "aws_cognito_user_pool" "pool" {
        id                         = ""
        name                       = ""
        tags                       = {}
        # (16 unchanged attributes hidden)

      - schema {
          - attribute_data_type      = "String" -> null
          - developer_only_attribute = false -> null
          - mutable                  = true -> null
          - name                     = "sf_account_id" -> null
          - required                 = false -> null

          - string_attribute_constraints {}
        }
      + schema {
        }

        # (5 unchanged blocks hidden)
    }
  1. Apply so that the user pool removes the schema

Debug Output

No response

Panic Output

No response

Important Factoids

note: the error message does not appear on a terraform plan

References

No response

Would you like to implement a fix?

Yes

@Mehmet-Kalich Mehmet-Kalich added the bug Addresses a defect in current functionality. label Nov 3, 2024
Copy link

github-actions bot commented Nov 3, 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/cognitoidp Issues and PRs that pertain to the cognitoidp service. needs-triage Waiting for first response or review from a maintainer. labels Nov 3, 2024
@justinretzolk
Copy link
Member

Similar #39823

@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Nov 4, 2024
@oliverphardman
Copy link

oliverphardman commented Nov 4, 2024

Thanks for reporting this. I am facing the same issue. I created a custom attribute in the Cognito console (groups) but did NOT specify this in my Cognito config. Custom attributes cannot be modified after creation, so I would expect Terraform to destroy and recreate the user pool, but instead the plugin crashes.

Plan

# module.cognito.aws_cognito_user_pool.user_pool will be updated in-place
  ~ resource "aws_cognito_user_pool" "user_pool" {
        id                         = ""
        name                       = ""
        tags                       = {}
        # (16 unchanged attributes hidden)

      - schema {
          - attribute_data_type      = "String" -> null
          - developer_only_attribute = false -> null
          - mutable                  = true -> null
          - name                     = "groups" -> null
          - required                 = false -> null

          - string_attribute_constraints {}
        }
      + schema {
        }

        # (7 unchanged blocks hidden)
    }

Config

resource "aws_cognito_user_pool" "user_pool" {
  name                = up-${random_id.cognito_suffix.hex}"
  username_attributes = ["email"]

  schema {
    attribute_data_type      = "String"
    name                     = "email"
    developer_only_attribute = false
    mutable                  = true
    required                 = true
    string_attribute_constraints {
      max_length = "2048"
      min_length = "0"
    }
  }

  account_recovery_setting {
    recovery_mechanism {
      name     = "admin_only"
      priority = 1
    }
  }

  lambda_config {
    post_authentication = module.On_UserPostAuthentication.function_arn
  }
}

provider "aws" {
  region = var.aws_region
  default_tags {
    tags = local.common_tags
  }
}

Error

│ Error: Plugin did not respond
│ 
│   with module.cognito.aws_cognito_user_pool.user_pool,
│   on cognito/main.tf line 9, in resource "aws_cognito_user_pool" "user_pool":
│    9: resource "aws_cognito_user_pool" "user_pool" {
│ 
│ 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.74.0_x5 plugin:

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

goroutine 177 [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 +0x7c5
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Set).hash(0xc002c8b7c0?, {0x0?, 0x0?})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/set.go:221 +0x26
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Set).add(0xc002cd2f80, {0x0, 0x0}, 0x0)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/set.go:201 +0x85
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ConfigFieldReader).readSet(0xc0020c3440, {0xc004792cc0, 0x1, 0x1}, 0xc002c8b2c0)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/field_reader_config.go:287 +0x35e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ConfigFieldReader).readField(0xc0020c3440, {0xc004792cc0, 0x1, 0x1}, 0x0)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/field_reader_config.go:110 +0x429
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ConfigFieldReader).ReadField(0x1721f660?, {0xc004792cc0?, 0x18efa63e?, 0x6?})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/field_reader_config.go:32 +0xac
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*MultiLevelFieldReader).ReadFieldExact(0xc004792cb0?, {0xc004792cc0, 0x1, 0x1}, {0x18efa63e, 0x6})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/field_reader_multi.go:34 +0x99
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).get(0xc0031b8300, {0xc004792cc0, 0x1, 0x1}, 0x0?)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource_data.go:551 +0x12f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).getChange(0xc0031b8300, {0x18efa908?, 0x6?}, 0x1?, 0x12)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource_data.go:527 +0x1c7
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).diffChange(0x16a3bcc0?, {0x18efa908?, 0xc004792bd0?})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource_data.go:504 +0x6a
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.diffSet(0xc001cfced0, {0x1b327f28, 0xc001857230}, {0x18efa908, 0x6}, 0xc002c8b2c0, 0xc0014b3010, {0x1b37d500, 0xc0031b8300}, 0x0)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/schema.go:1412 +0x74
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.diff(0xc001cfced0, {0x1b327f28, 0xc001857230}, {0x18efa908, 0x6}, 0xc002c8b2c0, 0xc0031b8280, {0x1b37d500, 0xc0031b8300}, 0x0)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/schema.go:1134 +0x25a
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.Diff(0xc001cfced0, {0x1b327f28, 0xc001857230}, 0xc002e2dad0, 0xc003fd5a40, 0x0, {0x0, 0x0}, 0x0)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/schema.go:678 +0x332
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.diffFromValues({0x1b327f28, 0xc001857230}, {{{0x1b3282e8?, 0xc001be8c10?}}, {0x1721c1e0?, 0xc0018b9290?}}, {{{0x1b3282e8, 0xc001be8d30}}, {0x1721c1e0, 0xc001a9dcb0}}, ...)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/shims.go:46 +0x265
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.DiffFromValues(...)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/shims.go:23
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc0031d3830, {0x1b327f28?, 0xc001856c00?}, 0xc001044640)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1093 +0x67a
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).ApplyResourceChange(0xc0031b8a00, {0x1b327f28?, 0xc0018567e0?}, 0xc001044640)
	github.com/hashicorp/[email protected]/tf5muxserver/mux_server_ApplyResourceChange.go:36 +0x193
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc0000e34a0, {0x1b327f28?, 0xc0017ea240?}, 0xc000670700)
	github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:865 +0x3bc
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x18d75f20, 0xc0000e34a0}, {0x1b327f28, 0xc0017ea240}, 0xc00557da00, 0x0)
	github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:611 +0x1a6
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000ce6000, {0x1b327f28, 0xc00179fd70}, {0x1b3a7260, 0xc00326b040}, 0xc002010fc0, 0xc00119[69]()00, 0x25f3dc78, 0x0)
	google.golang.org/[email protected]/server.go:1394 +0xe2b
google.golang.org/grpc.(*Server).handleStream(0xc000ce6000, {0x1b3a[72]()60, 0xc00326b040}, 0xc002010fc0)
	google.golang.org/[email protected]/server.go:1805 +0xe8b
google.golang.org/grpc.(*Server).serveStreams.func2.1()
	google.golang.org/[email protected]/server.go:1029 +0x7f
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 24
	google.golang.org/[email protected]/server.go:1040 +0x125

Error: The terraform-provider-aws_v5.[74]().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.

@perriea
Copy link

perriea commented Nov 10, 2024

Same error in 5.72.0, but OK in 5.70.0

❯ make apply
aws_route53_record.console-public-identity: Creating...
module.user_pool_public_users.aws_cognito_user_pool.pool[0]: Modifying... [id=eu-west-1_*******]
module.user_pool_management_users.aws_cognito_user_pool.pool[0]: Modifying... [id=eu-west-1_*******]
╷
│ Error: Plugin did not respond
│ 
│   with aws_route53_record.console-public-identity,
│   on route53.tf line 10, in resource "aws_route53_record" "console-public-identity":
│   10: resource "aws_route53_record" "console-public-identity" {
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵
╷
│ Error: Plugin did not respond
│ 
│   with module.user_pool_management_users.aws_cognito_user_pool.pool[0],
│   on .terraform/modules/user_pool_management_users/main.tf line 1, in resource "aws_cognito_user_pool" "pool":
│    1: resource "aws_cognito_user_pool" "pool" {
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵
╷
│ Error: Plugin did not respond
│ 
│   with module.user_pool_public_users.aws_cognito_user_pool.pool[0],
│   on .terraform/modules/user_pool_public_users/main.tf line 1, in resource "aws_cognito_user_pool" "pool":
│    1: resource "aws_cognito_user_pool" "pool" {
│ 
│ 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.72.0_x5 plugin:

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

goroutine 40 [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:2292 +0x70c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Set).hash(0x140025d1a40?, {0x0?, 0x0?})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/set.go:221 +0x34
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Set).add(0x140026d11a0, {0x0, 0x0}, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/set.go:201 +0x6c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ConfigFieldReader).readSet(0x140026c9a10, {0x140026d60a0, 0x1, 0x1}, 0x140025d0dc0)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/field_reader_config.go:287 +0x298
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ConfigFieldReader).readField(0x140026c9a10, {0x140026d60a0, 0x1, 0x1}, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/field_reader_config.go:110 +0x320
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ConfigFieldReader).ReadField(0x118fdec40?, {0x140026d60a0?, 0x115acda38?, 0x6?})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/field_reader_config.go:32 +0x84
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*MultiLevelFieldReader).ReadFieldExact(0x140026d6090?, {0x140026d60a0, 0x1, 0x1}, {0x115acda38, 0x6})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/field_reader_multi.go:34 +0x78
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).get(0x14004648f00, {0x140026d60a0, 0x1, 0x1}, 0x0?)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource_data.go:551 +0xfc
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).getChange(0x14004648f00, {0x115acdd02?, 0x6?}, 0x1?, 0x12)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource_data.go:527 +0x150
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).diffChange(0x14001324bc8?, {0x115acdd02?, 0x98?})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource_data.go:504 +0x44
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.diffSet(0x140025ba570, {0x11af8ac88, 0x1400242d050}, {0x115acdd02, 0x6}, 0x140025d0dc0, 0x14001324f98, {0x11afdd7e0, 0x14004648f00}, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/schema.go:1412 +0x5c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.diff(0x140025ba570, {0x11af8ac88, 0x1400242d050}, {0x115acdd02, 0x6}, 0x140025d0dc0, 0x14004648e80, {0x11afdd7e0, 0x14004648f00}, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/schema.go:1134 +0x180
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.Diff(0x140025ba570, {0x11af8ac88, 0x1400242d050}, 0x140018aa9c0, 0x140026b5b80, 0x0, {0x0, 0x0}, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/schema.go:678 +0x298
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.diffFromValues({0x11af8ac88, 0x1400242d050}, {{{0x11af8b048?, 0x14001d819a0?}}, {0x118fdb8e0?, 0x14002446db0?}}, {{{0x11af8b048?, 0x14001d81b30?}}, {0x118fdb8e0?, 0x14002452f60?}}, ...)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/shims.go:46 +0x208
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.DiffFromValues(...)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/shims.go:23
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0x14002d70210, {0x11af8ac88?, 0x1400242cf90?}, 0x140022f71d0)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1093 +0x500
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).ApplyResourceChange(0x1400192fe30, {0x11af8ac88?, 0x1400242ccc0?}, 0x140022f71d0)
        github.com/hashicorp/[email protected]/tf5muxserver/mux_server_ApplyResourceChange.go:36 +0x184
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0x140002b5900, {0x11af8ac88?, 0x1400242c4e0?}, 0x14000c2fdc0)
        github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:865 +0x2a8
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x11aab4540, 0x140002b5900}, {0x11af8ac88, 0x1400242c4e0}, 0x140040b9f00, 0x0)
        github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:545 +0x1c0
google.golang.org/grpc.(*Server).processUnaryRPC(0x140012b0e00, {0x11af8ac88, 0x1400242c450}, {0x11b004dc0, 0x14002d48ea0}, 0x1400242ec60, 0x14002dfa870, 0x125776b78, 0x0)
        google.golang.org/[email protected]/server.go:1394 +0xb64
google.golang.org/grpc.(*Server).handleStream(0x140012b0e00, {0x11b004dc0, 0x14002d48ea0}, 0x1400242ec60)
        google.golang.org/[email protected]/server.go:1805 +0xb20
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        google.golang.org/[email protected]/server.go:1029 +0x84
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 52
        google.golang.org/[email protected]/server.go:1040 +0x13c

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

make: *** [apply] Error 1

@finkinfridom
Copy link

same issue happens on plugin version 5.75.0.
Any solution or any workaround?

@Mehmet-Kalich
Copy link
Author

@finkinfridom Strangely, after diving deeper into the AWS documentation I realised that it was more to do with the fact that with the aws_cognito_user_pool resource schema, attributes can be added, but not modified or removed. For my specific issue this bug relates more to the fact that an explicit error message needs to be added, to let it be known that this is an inherent characteristic with user pools. I had to remove the entire user pool and build it again without that specific user schema attribute specified.

In you problem that you posted, are you also trying to modify the set schema attributes of the user pools you are deploying/configuring?

@finkinfridom
Copy link

From what I can see, the terraform plan always shows me a change in the user pool even if no changes are performed. So indeed it's trying to change something in the schema that want to reapply.
In the latest version is throwing the above exception while in previous version it try to update and then fail saying that changing schema could not be performed.

@camilocosta
Copy link

Same problem here, after added an schema for a custom attribute.

I know that I can't change a schema, but for some reason Terraform is not dealing well with this and now with this bug I cannot modify anything in my pool.

@Mehmet-Kalich
Copy link
Author

@camilocosta a very hacky workaround would be to replicate the exact user pool schema configuration in your terraform, at the very least it won't recognise any changes and you can continue modifying other parts of your user pool. Hopefully this gets fixed soon!

@camilocosta
Copy link

Thanks @Mehmet-Kalich , it works!
I tried it before but now tried again looking at terraform plan and found that "string_attribute_constraints {}" must be empty in my case. Now it works. Thanks again.

@jar-b jar-b self-assigned this Nov 19, 2024
@github-actions github-actions bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Nov 19, 2024
Copy link

Warning

This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

@github-actions github-actions bot added this to the v5.77.0 milestone Nov 20, 2024
@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Nov 21, 2024
Copy link

This functionality has been released in v5.77.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/cognitoidp Issues and PRs that pertain to the cognitoidp service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants