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 the %s workspace does not exit, would you like to create it?", backend.DefaultStateName),
1687
-
Description: desc,
1688
-
})
1689
-
iferr!=nil {
1690
-
diags=diags.Append(fmt.Errorf("Failed to confirm %s workspace creation: %w", backend.DefaultStateName, err))
1691
-
returnnil, diags
1692
-
}
1693
-
ifv!="yes" {
1694
-
diags=diags.Append(fmt.Errorf("Cancelled creation of the %s workspace", backend.DefaultStateName))
1695
-
returnnil, diags
1696
-
}
1678
+
// Users control if the default workspace is created through the -create-default-workspace flag (defaults to true)
1679
+
ifopts.CreateDefaultWorkspace {
1697
1680
m.createDefaultWorkspace(c, b)
1698
1681
} else {
1699
-
// If input is disabled, we don't prompt before creating the default workspace.
1700
-
// However this can be blocked with other flags present.
1701
-
ifopts.CreateDefaultWorkspace {
1702
-
m.createDefaultWorkspace(c, b)
1703
-
} else {
1704
-
diags=diags.Append(&hcl.Diagnostic{
1705
-
Severity: hcl.DiagWarning,
1706
-
Summary: "The default workspace does not exist",
1707
-
Detail: "Terraform has been configured to skip creation of the default workspace in the state store. This may cause issues in subsequent Terraform operations",
1708
-
})
1709
-
}
1682
+
diags=diags.Append(&hcl.Diagnostic{
1683
+
Severity: hcl.DiagWarning,
1684
+
Summary: "The default workspace does not exist",
1685
+
Detail: "Terraform has been configured to skip creation of the default workspace in the state store.",
"an init command prompts users for input when the default workspace needs to be created": {
2099
-
inputEnabled: true,
2100
-
createDefaultWorkspace: true,
2101
-
inputText: "yes",
2102
-
isInitCommand: true,
2103
-
expectDefaultWorkspaceExists: true,
2104
-
},
2105
-
"an init command with input disabled will create the default workspace automatically": {
2106
-
inputEnabled: false,
2094
+
"an init command creates the default workspace by default": {
2107
2095
createDefaultWorkspace: true,
2108
2096
isInitCommand: true,
2109
2097
expectDefaultWorkspaceExists: true,
2110
2098
},
2111
-
"an init command with input disabled and the flag -create-default-workspace=false will not make the default workspace": {
2112
-
inputEnabled: false,
2099
+
"an init command with the flag -create-default-workspace=false will not make the default workspace": {
2113
2100
createDefaultWorkspace: false,
2114
2101
isInitCommand: true,
2115
2102
expectDefaultWorkspaceExists: false,
2116
2103
},
2117
-
// "during a non-init command, the command ends in with an error telling the user to run an init command": {
2118
-
// isInitCommand: false,
2119
-
// expectedError: "State store initialization required, please run \"terraform init\": Reason: Initial configuration of the requested state_store \"foo_bar\" in provider foo (\"registry.terraform.io/my-org/foo\")",
2120
-
// },
2104
+
"during a non-init command, the command ends in with an error telling the user to run an init command": {
2105
+
isInitCommand: false,
2106
+
expectedError: "State store initialization required, please run \"terraform init\": Reason: Initial configuration of the requested state_store \"foo_bar\" in provider foo (\"registry.terraform.io/my-org/foo\")",
0 commit comments