You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Query: fmt.Sprintf("Workspace %q does not exit, would you like to create one?", backend.DefaultStateName),
1662
-
Description: desc,
1663
-
})
1664
-
iferr!=nil {
1665
-
diags=diags.Append(fmt.Errorf("Failed to confirm default workspace creation: %w", err))
1666
-
returnnil, diags
1667
-
}
1668
-
ifv!="yes" {
1669
-
diags=diags.Append(errors.New("Failed to create default workspace"))
1670
-
returnnil, diags
1671
-
}
1657
+
switch {
1658
+
casews!=backend.DefaultStateName:
1659
+
// User needs to run a `terraform workspace new` command.
1660
+
diags=append(diags, tfdiags.Sourceless(
1661
+
tfdiags.Error,
1662
+
fmt.Sprintf("Workspace %q has not been created yet", ws),
1663
+
fmt.Sprintf("State store %q in provider %s (%q) reports that no workspaces currently exist. To create the custom workspace %q use the command `terraform workspace new %s`.",
1664
+
c.Type,
1665
+
c.Provider.Name,
1666
+
c.ProviderAddr,
1667
+
ws,
1668
+
ws,
1669
+
),
1670
+
))
1671
+
returnnil, diags
1672
+
1673
+
casews==backend.DefaultStateName:
1674
+
// TODO: do we want to prompt for input here (m.Input()), or create automatically unless -readonly flag present?
1675
+
// input := m.UIInput()
1676
+
// desc := fmt.Sprintf("Terraform will create the %q workspace via %q.\n"+
1677
+
// "Only 'yes' will be accepted to approve.", backend.DefaultStateName, c.Type)
0 commit comments