Skip to content

Conversation

Maed223
Copy link
Contributor

@Maed223 Maed223 commented Sep 5, 2025

Re-creation of: #1817

Description

The GET /workspaces API call is ordered by run.created-at. It's possible that between retrieving the first page, and the next page that a workspace will appear on both pages.
This then ultimately causes a 'Duplicate Set Element' error in the TF plan.

This fix converts storing the API response as 2 lists to a single map, with the key being the workspace ID ensuring we overwrite any duplicates.

Remember to:

Testing plan

  1. Describe how to replicate
  2. the conditions
  3. under which your code performs its purpose,
  4. including example Terraform configs where necessary.

External links

Include any links here that might be helpful for people reviewing your PR. If there are none, feel free to delete this section.

Output from acceptance tests

Please run applicable acceptance tests locally and include the output here. See testing.md to learn how to run acceptance tests.

If you are an external contributor, your contribution(s) will first be reviewed before running them against the project's CI pipeline.

$ TESTARGS="-run TestAccTFEWorkspace" make testacc

...

Rollback Plan

Changes to Security Controls

@Maed223 Maed223 requested a review from a team as a code owner September 5, 2025 15:15
lewis-catley and others added 2 commits September 5, 2025 11:46
The GET /workspaces API call is ordered by run.created-at.
It's possible that between retrieving the first page, and the next page
that a workspace will appear on both pages.
This then ultimately causes a 'Duplicate Set Element' error
in the TF plan.

This fix converts storing the API response as 2 lists to a single
map, with the key being the workspace ID ensuring we overwrite any
duplicates.
@Maed223 Maed223 force-pushed the TF-26383/duplicate-set-error-proj-data-source branch from 82b4641 to 43573fb Compare September 5, 2025 15:46
@Maed223 Maed223 closed this Sep 5, 2025
@Maed223 Maed223 reopened this Sep 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants