API returns an unordered list in a different order
SkillCloud & infraUse when apply fails with 'inconsistent result' where list items swap places (targets[0] now holds targets[1]'s value), or a plan shows reorder-only diffs. Keep prior order when the items match as a set.
Use API returns an unordered list in a different order in Claude, ChatGPT or Ahel Desktop
Free. Sign in, add API returns an unordered list in a different order and connect your AI. About a minute.
Also: Claude Code · Cursor · Codex
Then ask your AI: use the API returns an unordered list in a different order skill
Details
Instructions available. Your AI can read the instructions. Execution depends on the setup they require.
Account requirements not reviewed. Check the skill instructions before use; Ahel provides instructions and does not run this skill.
No other account needed.
Add Ahel to your AI once: Claude, ChatGPT, Cursor, Claude Code or Codex. Then ask it to use this.
What this skill tells your AI
The instructions your AI receives, as published by coralogix/terraform-provider-coralogix in .claude/skills/api-reorders-unordered-list/SKILL.md and read by Ahel’s review.
Trigger: "Provider produced inconsistent result after apply" where x[0].id, x[1].id, ... hold the same values as the plan, but at other indexes. Often intermittent: the same fixture passes in one test and fails in another.
Fix: When order has no meaning and the attribute is an already-released ListNestedAttribute, compare the API list with the prior list before flatten. Use the plan in Create/Update and the state in Read. Compare them as a multiset of the full item content. Same items in a different order: return the prior list. Different items: keep the API order, so the plan shows the drift. Compare full content, not a key, because keys can repeat (the API accepts two targets with the same connector and preset). See orderTargetsLike in internal/provider/notifications/resource_coralogix_global_router.go.
alignRuleTargets(result.Router.GetRules(), router.Rules) // router = extracted from plan
plan, diags = flattenGlobalRouter(ctx, result.Router)
Do not change a released list to SetNestedAttribute for this: it needs a new schema version and breaks index references like targets[0]. For a new attribute, prefer a set.
Why: A Terraform list is ordered, so any order change counts as a change, even when the backend treats the items as a set.
Signals
- GitHub stars
- 22
- Forks
- 14
- Last commit
- Oct 2026
Advanced
- Item type
- skill
- Key
api-reorders-unordered-list- Source
- github.com/coralogix/terraform-provider-coralogix
github.com/coralogix/terraform-provider-coralogix
Related picks
Skill · samber
The pick for Gogo-sdk-specialist
Skill · a5c-ai
The pick for Govercel-react-best-practices
Skill · vercel-labs
More in Cloud & infraweb-design-guidelines
Skill · vercel-labs
More in Cloud & infraturborepo
Skill · vercel
More in Cloud & inframicrosoft-foundry
Skill · microsoft
More in Cloud & infra