Skip to content

Conversation

lewis-catley
Copy link

@lewis-catley lewis-catley commented Aug 22, 2025

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

@lewis-catley lewis-catley requested a review from a team as a code owner August 22, 2025 11:11
Copy link

hashicorp-cla-app bot commented Aug 22, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes

Have you signed the CLA already but the status is still pending? Recheck it.

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
Copy link
Contributor

Maed223 commented Sep 5, 2025

Hey @lewis-catley, this PR has been re-created so we can have CI properly run against the changes: #1830

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.

3 participants