Open wszarmach-koia opened 3 months ago
Voting for Prioritization
Volunteering to Work on This Issue
we're also experiencing this exact problem
Hi @wszarmach-koia
Add
string_attribute_constraints {
max_length = "2048"
min_length = "0"
}
on each schema
to avoid this issue
Example:
schema {
name = "scope"
attribute_data_type = "String"
mutable = true
required = false
string_attribute_constraints {
max_length = "2048"
min_length = "0"
}
}
When defining an attribute_data_type of String or Number, the respective attribute constraints configuration block (e.g string_attribute_constraints or number_attribute_constraints) is required to prevent recreation of the Terraform resource. This requirement is true for both standard (e.g., name, email) and custom schema attributes.
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cognito_user_pool#schema
Hi @bannarisoftwares,
the suggested fix has been mentioned earlier with the following words:
The fix for https://github.com/hashicorp/terraform-provider-aws/issues/21654 allowed only to reapply terraform configuration, when there are no changes to the previously applied schema.
You still cannot modify schema or at least I couldn't with mentioned provider versions.
Terraform Core Version
1.3.7
AWS Provider Version
5.55.0
Affected Resource(s)
Expected Behavior
It should be possible to add a custom attribute.
After application schema should be changed and custom:test field should be added with given configuration.
Actual Behavior
Once applied there is an error:
Relevant Error/Panic Output Snippet
No response
Terraform Configuration Files
Steps to Reproduce
Add a custom attribute to aws_cognito_user_pool.pool:
Debug Output
No response
Panic Output
No response
Important Factoids
The ticket with this error has already been submitted: https://github.com/hashicorp/terraform-provider-aws/issues/21654.
The documentation of schema is wrong twice in the comparison to the state of the current implementation:
it is impossible to add a custom attribute due to this issue:
according to the fix from this https://github.com/hashicorp/terraform-provider-aws/issues/21654 it should omit empty string_attribute_constraints, but the docs say:
The fix for https://github.com/hashicorp/terraform-provider-aws/issues/21654 allowed only to reapply terraform configuration, when there are no changes to the previously applied schema.
It is also not possible to add a custom attribute from the administrative console and reapply the configuration as it wants to recreate schema attributes from scratch as in the actual behavior.
Neither does work for v5.9.0 - the fix for https://github.com/hashicorp/terraform-provider-aws/issues/21654 ticket
References
https://github.com/hashicorp/terraform-provider-aws/issues/21654
Would you like to implement a fix?
None