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

Fix returned workspace for created & upgraded no-code workspaces #954

Merged
merged 2 commits into from
Aug 7, 2024

Conversation

paladin-devops
Copy link
Contributor

@paladin-devops paladin-devops commented Aug 7, 2024

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 embedded tfe.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 a tfe.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

$ go test -run TestRegistryNoCodeModulesCreateWorkspace -v ./...

$ go test -run TestRegistryNoCodeModulesUpgradeWorkspace -v ./...

External links

Relevant API endpoints:

  1. https://developer.hashicorp.com/terraform/cloud-docs/api-docs/no-code-provisioning#create-a-no-code-module-workspace
  2. https://developer.hashicorp.com/terraform/cloud-docs/api-docs/no-code-provisioning#initiate-a-no-code-workspace-update

@paladin-devops paladin-devops self-assigned this Aug 7, 2024
@paladin-devops paladin-devops marked this pull request as ready for review August 7, 2024 17:18
@paladin-devops paladin-devops requested a review from a team August 7, 2024 17:18
Copy link
Collaborator

@brandonc brandonc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see this is a bug fix so it's not exactly a "Breaking Change" but hopefully won't cause too much disruption downstream. I may highlight the issue a little brighter in the CHANGELOG before release

@brandonc brandonc merged commit ffbcfd3 into main Aug 7, 2024
8 checks passed
@brandonc brandonc deleted the no-code-workspace-output branch August 7, 2024 17:58
Copy link

github-actions bot commented Aug 7, 2024

Reminder to the contributor that merged this PR: if your changes have added important functionality or fixed a relevant bug, open a follow-up PR to update CHANGELOG.md with a note on your changes.

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