Skip to content

Commit f7fb54c

Browse files
committed
Tests pass!
1 parent ad1d7c0 commit f7fb54c

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

cli/delete.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ func deleteWorkspace() *cobra.Command {
3939
}
4040

4141
var state []byte
42+
4243
if orphan {
4344
cliui.Warn(cmd.ErrOrStderr(), "Orphaning workspace",
4445
"Template edit permission is required to orphan workspaces.",
@@ -48,12 +49,13 @@ func deleteWorkspace() *cobra.Command {
4849
if err != nil {
4950
return err
5051
}
51-
52-
state, err = codersdk.OrphanTerraformState(state)
53-
if err != nil {
54-
return err
52+
// If there's alreay no state, orphanage makes no sense.
53+
if len(state) > 0 {
54+
state, err = codersdk.OrphanTerraformState(state)
55+
if err != nil {
56+
return err
57+
}
5558
}
56-
fmt.Printf("new state: %s\n", state)
5759
}
5860

5961
before := time.Now()

0 commit comments

Comments
 (0)