Fix returned workspace for created & upgraded no-code workspaces #954
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.
Description
This change is being made because the create and upgrade methods for no-code workspaces do not properly return the workspace. They do correctly create and upgrade no-code workspaces, respectively; however the workspace they return is a zero-value
tfe.Workspace
.This PR fixes this issue by removing the
RegistryNoCodeModuleWorkspace
struct, which was a struct that only "wrapped" an embeddedtfe.Workspace
struct field. This was done with the intent of future-proofing the endpoint in the event that other data was returned. However, the documented API response clearly is only atfe.Workspace
, and so this PR corrects the method to return that value.The integration tests passed prior to this PR because the tests only tested the "refreshed" workspace, meaning that the endpoint to fetch the workspace after it was created was used to check that the desired input workspace was created as expected. The test should have used the workspace returned by the "post" endpoints themselves.
Testing plan
External links
Relevant API endpoints: