Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarified usage docs for sorting by config order #10451

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Clarified usage docs for sorting by config order
  • Loading branch information
melinath authored Apr 15, 2024
commit 4fc2b7c335595b2e9f794ebfcb37e43cc8c4197e
4 changes: 2 additions & 2 deletions docs/content/develop/permadiff.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ In tests, add the field to `ImportStateVerifyIgnore` on any relevant import step

## API returns a list in a different order than was sent {#list-order}

For an Array of unique string values (or nested objects with unique string identifiers), use the `SortStringsByConfigOrder` or `SortMapsByConfigOrder` helper functions to sort the API response to match the order in the user's configuration. This will also simplify diffs if new values are added or removed.
For an Array of unique string values (or nested objects with unique string identifiers), use the `SortStringsByConfigOrder` or `SortMapsByConfigOrder` helper functions to sort the API response to match the order in the user's configuration. This will also simplify diffs if new values are added or removed. Imported resources will not have access to a configuration, so the field will be sorted alphabetically. This means that tests for the resource need to ignore the field's import behavior via `ignore_read_extra` (for MMv1 examples) or [`ImportStateVerifyIgnore`](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/import#importstateverifyignore-1) (for handwritten tests).

{{< tabs "diff_suppress_list" >}}

Expand Down Expand Up @@ -266,4 +266,4 @@ func flattenResourceNameFieldName(v interface{}, d *schema.ResourceData, config
{{< /tab >}}
{{< /tabs >}}

For other Array fields, convert the field to a Set – this is a [breaking change]({{< ref "/develop/breaking-changes/breaking-changes" >}}) and can only happen in a major release.
For other Array fields, convert the field to a Set – this is a [breaking change]({{< ref "/develop/breaking-changes/breaking-changes" >}}) and can only happen in a major release.
Loading