resource/aws_appsync_resolver: Convert caching_keys from typeset to typelist to preerve order and match AWS specs #44513
+7
−2
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 revert the commit and publish an updated version of the provider.
Changes to Security Controls
No changes to security controls in this pull request.
Description
Reverts
caching_keys
field fromTypeSet
back toTypeList
in theaws_appsync_resolver
resource to preserve the order of caching keys, which is critical for proper cache key generation in AWS AppSync.Issue: The
caching_keys
field was changed toTypeSet
in PR #12747, which caused the keys to be reordered alphabetically (due toTypeSet
using hashing). This resulted in:Root Cause:
TypeSet
is an unordered collection that uses hashing to determine element order. According to AWS AppSync documentation, the order of caching keys is crucial because it determines how cache entries are indexed and retrieved.Changes Made:
caching_keys
fromschema.TypeSet
toschema.TypeList
flex.ExpandStringValueSet()
toflex.ExpandStringValueList()
caching_keys.0
="$context.identity.sub"
caching_keys.1
="$context.arguments.id"
Impact: This ensures that the order specified in Terraform configuration is preserved and sent to AWS AppSync exactly as defined, fixing the cache invalidation and drift issues reported by users.
Relations
Closes #42495
References
Output from Acceptance Testing
Test validation: The test at
internal/service/appsync/resolver_test.go:333-360
now includes order verification: