r/aws_cognito_identity_provider: Change idp_identifiers to a set 🤖🤖🤖 - #49210
Open
mhorbul wants to merge 2 commits into
Open
r/aws_cognito_identity_provider: Change idp_identifiers to a set 🤖🤖🤖#49210mhorbul wants to merge 2 commits into
mhorbul wants to merge 2 commits into
Conversation
Contributor
Community GuidelinesThis comment is added to every new Pull Request to provide quick reference to how the Terraform AWS Provider is maintained. Please review the information below, and thank you for contributing to the community that keeps the provider thriving! 🚀 Voting for Prioritization
Pull Request Authors
|
Contributor
|
✅ Thank you for correcting the previously detected issues! The maintainers appreciate your efforts to make the review process as smooth as possible. |
AWS returns idp_identifiers in its own order, which does not necessarily match the order in the configuration. Because the attribute was a TypeList, any mismatch produced a permanent diff: every apply rewrote the identifiers and the following plan showed the same reordering again. The order of the identifiers has no meaning to Cognito, so model the attribute as a TypeSet instead.
mhorbul
force-pushed
the
b-r/aws_cognito_identity_provider-idp_identifiers-set
branch
from
July 30, 2026 17:25
a99f982 to
13a48a9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rollback Plan
If a change needs to be reverted, we will publish an updated version of the library.
Changes to Security Controls
None.
Description
aws_cognito_identity_provider.idp_identifierswas modelled as aTypeList, but Cognito returns the identifiers in its own order, which does not necessarily match the order they were sent in. Whenever the two orders differ, the resource has a permanent diff: every apply rewrites the identifiers with the configured order,DescribeIdentityProviderreturns a different order, and the next plan shows the same reordering again.The order of the identifiers carries no meaning for Cognito, so this changes the attribute to a
TypeSet.CloudTrail for a single affected resource, showing the write and the subsequent read disagreeing (domains redacted):
Existing state written by the previous
TypeListschema is read back into the set without a diff or a replacement, so no state upgrade is required. I verified this against real infrastructure that was showing the perpetual diff: a locally built provider with this patch producesNo changes. Your infrastructure matches the configuration.for fouraws_cognito_identity_providerresources that the released provider wanted to update in-place on every run, with no configuration change.TestAccCognitoIDPIdentityProvider_idpIdentifiersOrderis a regression test: it applies two identifiers, then reorders them in the configuration and asserts an empty plan.AI Usage
Disclosed per the AI usage policy. This change was produced with an AI coding agent (Claude Code) working under my direction:
go build,go vet,gofmt, the SDKv2 providerInternalValidatetest, and the acceptance tests against a real AWS account.Relations
Closes #46686
References
TypeListas the root cause andTypeSetas the fix.resource/aws_lakeformation_opt_in([Bug]: aws_lakeformation_opt_in lf_tag resource uses incorrect field name - should be "values" (array) not "value" (string) #46788) made the same kind of list-to-set change in a minor release, v6.37.0, where it was announced under BREAKING CHANGES.Output from Acceptance Testing
Without the schema change (new test only,
TypeListrestored), the new test fails with exactly the reported drift:Compatibility
idp_identifierscan no longer be indexed. Configurations usingaws_cognito_identity_provider.example.idp_identifiers[0], or passing the attribute to functions that require a list such asjoin, needtolist(). I am happy to retarget this at a major release if you would prefer to hold it. If the type change is not acceptable at all, the alternative is to keepTypeListand suppress the ordering difference with a sorted-comparisonDiffSuppressFunc, which I think is more fragile than modelling the attribute correctly.