Skip to content

Commit

Permalink
Fix error preventing to create a workspace (#18)
Browse files Browse the repository at this point in the history
Fixes a bug preventing to create a new workspace.

Drive-by:
* Displays a message when deleting a workspace successfully.

Fixes #17
  • Loading branch information
rgreinho committed Mar 30, 2020
1 parent 3fefc1a commit 9d94ef2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Ability to detect HCL variables from a varfile. [#14]
* Ability to delete workspaces. [#15]

### Fixed

- Fix problem preventing to create a workspace. [#18]

## [1.0.0] - 2020-03-25

Initial version with support for managing:
Expand All @@ -25,3 +29,4 @@ Initial version with support for managing:
[//]: # (Issue/PR links)
[#14]: https://github.com/rgreinho/tfe-cli/pull/14
[#15]: https://github.com/rgreinho/tfe-cli/pull/15
[#18]: https://github.com/rgreinho/tfe-cli/pull/18
6 changes: 5 additions & 1 deletion cmd/workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ var workspaceCreateCmd = &cobra.Command{
// Check whether the workspace exists.
w, err := readWorkspace(client, organization, name)
if err != nil {
log.Fatalf("Cannot retrieve workspace %q: %s.", name, err)
if !strings.Contains(err.Error(), "resource not found") {
log.Fatalf("Cannot retrieve workspace %q: %s.", name, err)
}
}

// Update the workspace if needed.
Expand Down Expand Up @@ -121,6 +123,8 @@ var workspaceDeleteCmd = &cobra.Command{
if err := deleteWorkspace(client, organization, name); err != nil {
log.Fatalf("Cannot delete workspace %q: %s.", name, err)
}

log.Infof("Workspace %q deleted successfully.", name)
},
}

Expand Down

0 comments on commit 9d94ef2

Please sign in to comment.