Skip to content

Commit

Permalink
Merge pull request #498 from hashicorp/sebasslash/fix-workspace-state
Browse files Browse the repository at this point in the history
Use partial flag to prevent updating state on api failure `tfe_workspace.vcs_repo`
  • Loading branch information
sebasslash committed May 25, 2022
2 parents 32eaf78 + f13828d commit 257f1b0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## 0.32.0 (Unreleased)

BUG FIXES:
* Prevent overwriting `vcs_repo` attributes in `r/tfe_workspace` when update API call fails ([#498](https://github.com/hashicorp/terraform-provider-tfe/pull/498))

FEATURES:
* r/team, d/team: Add manage_run_tasks to the tfe_team organization_access attributes ([#486](https://github.com/hashicorp/terraform-provider-tfe/pull/486))

Expand Down
2 changes: 2 additions & 0 deletions tfe/resource_tfe_workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ func resourceTFEWorkspaceUpdate(d *schema.ResourceData, meta interface{}) error
log.Printf("[DEBUG] Update workspace %s", id)
_, err := tfeClient.Workspaces.UpdateByID(ctx, id, options)
if err != nil {
d.Partial(true)
return fmt.Errorf(
"Error updating workspace %s: %w", id, err)
}
Expand All @@ -481,6 +482,7 @@ func resourceTFEWorkspaceUpdate(d *schema.ResourceData, meta interface{}) error
if !ok {
_, err := tfeClient.Workspaces.RemoveVCSConnectionByID(ctx, id)
if err != nil {
d.Partial(true)
return fmt.Errorf("Error removing VCS repo from workspace %s: %w", id, err)
}
}
Expand Down

0 comments on commit 257f1b0

Please sign in to comment.