Skip to content

[Bug]: Cognito User Pool: cannot modify or remove schema itemsΒ #38224

Open
@leventyalcin

Description

Terraform Core Version

1.8.3

AWS Provider Version

5.54.1

Affected Resource(s)

aws_cognito_user_pool

Expected Behavior

According to this issue and the this PR, the expected behaviour of Terraform plan/apply output after the first time, updates on schema should be ignored if string_attribute_constraints is present.

Actual Behavior

I am still seeing those triggers updates on aws_cognito_user_pool and it fails with the following output error message.

Plan Output

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

          - string_attribute_constraints {
              - max_length = "512" -> null
              - min_length = "1" -> null
            }
        }
      + schema {
          + attribute_data_type = "String"
          + mutable             = true
          + name                = "name"
          + required            = true

          + string_attribute_constraints {
              + max_length = "512"
              + min_length = "1"
            }
        }

Apply result

Error: updating Cognito User Pool (REGION_xxxxxxxxx): cannot modify or remove schema items

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

resource "aws_cognito_user_pool" "pool" {
  name                = "test"
  mfa_configuration   = "OFF"
  username_attributes = ["email"]

  user_pool_add_ons {
    advanced_security_mode = "AUDIT"
  }

  schema {
    name                = "email"
    attribute_data_type = "String"
    mutable             = true
    required            = true
    string_attribute_constraints {
      min_length = 1
      max_length = 512
    }
  }

  schema {
    name                = "name"
    attribute_data_type = "String"
    mutable             = true
    required            = true
    string_attribute_constraints {
      min_length = 1
      max_length = 512
    }
  }
}

Steps to Reproduce

Terraform apply for a template contains schemas like above twice. The second apply always fail.

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

Metadata

Assignees

No one assigned

    Labels

    bugAddresses a defect in current functionality.prioritizedPart of the maintainer teams immediate focus. To be addressed within the current quarter.service/cognitoidpIssues and PRs that pertain to the cognitoidp service.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions