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 9k forks source link

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

Open leventyalcin opened 2 days ago

leventyalcin commented 2 days ago

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

github-actions[bot] commented 2 days ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue