Update internal/command to use OpenTF in user-provided strings. (#87)

* Update `internal/command` to use OpenTF

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Fix e2e tests.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Fix e2e tests.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Fix

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Rewrite message.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

---------

Signed-off-by: Jakub Martin <kubam@spacelift.io>
This commit is contained in:
Kuba Martin 2023-08-24 10:56:05 +02:00 committed by GitHub
parent 9cf8485255
commit 3b5b8ba719
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
61 changed files with 410 additions and 388 deletions

View File

@ -185,7 +185,7 @@ func (c *ApplyCommand) LoadPlanFile(path string) (*planfile.WrappedPlanFile, tfd
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Destroy can't be called with a plan file",
fmt.Sprintf("If this plan was created using plan -destroy, apply it using:\n terraform apply %q", path),
fmt.Sprintf("If this plan was created using plan -destroy, apply it using:\n opentf apply %q", path),
))
return nil, diags
}
@ -221,7 +221,7 @@ func (c *ApplyCommand) PrepareBackend(planFile *planfile.WrappedPlanFile, args *
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Failed to read plan from plan file",
"The given plan file does not have a valid backend configuration. This is a bug in the Terraform command that generated this plan file.",
"The given plan file does not have a valid backend configuration. This is a bug in the OpenTF command that generated this plan file.",
))
return nil, diags
}
@ -325,15 +325,15 @@ func (c *ApplyCommand) Synopsis() string {
func (c *ApplyCommand) helpApply() string {
helpText := `
Usage: terraform [global options] apply [options] [PLAN]
Usage: opentf [global options] apply [options] [PLAN]
Creates or updates infrastructure according to Terraform configuration
Creates or updates infrastructure according to OpenTF configuration
files in the current directory.
By default, Terraform will generate a new plan and present it for your
By default, OpenTF will generate a new plan and present it for your
approval before taking any action. You can optionally provide a plan
file created by a previous call to "terraform plan", in which case
Terraform will take the actions described in that plan without any
file created by a previous call to "opentf plan", in which case
OpenTF will take the actions described in that plan without any
confirmation prompt.
Options:
@ -344,12 +344,12 @@ Options:
modifying. Defaults to the "-state-out" path with
".backup" extension. Set to "-" to disable backup.
-compact-warnings If Terraform produces any warnings that are not
-compact-warnings If OpenTF produces any warnings that are not
accompanied by errors, show them in a more compact
form that includes only the summary messages.
-destroy Destroy Terraform-managed infrastructure.
The command "terraform destroy" is a convenience alias
-destroy Destroy OpenTF-managed infrastructure.
The command "opentf destroy" is a convenience alias
for this option.
-lock=false Don't hold a state lock during the operation. This is
@ -373,25 +373,25 @@ Options:
state.
If you don't provide a saved plan file then this command will also accept
all of the plan-customization options accepted by the terraform plan command.
all of the plan-customization options accepted by the opentf plan command.
For more information on those options, run:
terraform plan -help
opentf plan -help
`
return strings.TrimSpace(helpText)
}
func (c *ApplyCommand) helpDestroy() string {
helpText := `
Usage: terraform [global options] destroy [options]
Usage: opentf [global options] destroy [options]
Destroy Terraform-managed infrastructure.
Destroy OpenTF-managed infrastructure.
This command is a convenience alias for:
terraform apply -destroy
opentf apply -destroy
This command also accepts many of the plan-customization options accepted by
the terraform plan command. For more information on those options, run:
terraform plan -help
the opentf plan command. For more information on those options, run:
opentf plan -help
`
return strings.TrimSpace(helpText)
}

View File

@ -8,6 +8,7 @@ import (
"os/exec"
"github.com/hashicorp/go-plugin"
"github.com/placeholderplaceholderplaceholder/opentf/internal/cloudplugin"
"github.com/placeholderplaceholderplaceholder/opentf/internal/cloudplugin/cloudplugin1"
"github.com/placeholderplaceholderplaceholder/opentf/internal/logging"
@ -73,7 +74,7 @@ func (c *CloudCommand) proxy(args []string, stdout, stderr io.Writer) int {
// multiple versions are possible.
cloud1, ok := raw.(cloudplugin.Cloud1)
if !ok {
c.Ui.Error("If more than one cloudplugin versions are available, they need to be added to the cloud command. This is a bug in Terraform.")
c.Ui.Error("If more than one cloudplugin versions are available, they need to be added to the cloud command. This is a bug in OpenTF.")
return ExitRPCError
}
return cloud1.Execute(args, stdout, stderr)

View File

@ -44,7 +44,7 @@ const DefaultParallelism = 10
// that require a backend.Local.
const ErrUnsupportedLocalOp = `The configured backend doesn't support this operation.
The "backend" in Terraform defines how Terraform operates. The default
The "backend" in OpenTF defines how OpenTF operates. The default
backend performs all operations locally on your machine. Your configuration
is configured to use a non-local backend. This backend doesn't support this
operation.

View File

@ -192,9 +192,9 @@ func (c *ConsoleCommand) modePiped(session *repl.Session, ui cli.Ui) int {
func (c *ConsoleCommand) Help() string {
helpText := `
Usage: terraform [global options] console [options]
Usage: opentf [global options] console [options]
Starts an interactive console for experimenting with Terraform
Starts an interactive console for experimenting with OpenTF
interpolations.
This will open an interactive console that you can use to type
@ -209,10 +209,10 @@ Options:
-state=path Legacy option for the local backend only. See the local
backend's documentation for more information.
-var 'foo=bar' Set a variable in the Terraform configuration. This
-var 'foo=bar' Set a variable in the OpenTF configuration. This
flag can be set multiple times.
-var-file=foo Set variables in the Terraform configuration from
-var-file=foo Set variables in the OpenTF configuration from
a file. If "terraform.tfvars" or any ".auto.tfvars"
files are present, they will be automatically loaded.
`
@ -220,5 +220,5 @@ Options:
}
func (c *ConsoleCommand) Synopsis() string {
return "Try Terraform expressions at an interactive command prompt"
return "Try OpenTF expressions at an interactive command prompt"
}

View File

@ -10,12 +10,13 @@ import (
"fmt"
"github.com/mitchellh/cli"
"github.com/placeholderplaceholderplaceholder/opentf/internal/repl"
)
func (c *ConsoleCommand) modeInteractive(session *repl.Session, ui cli.Ui) int {
ui.Error(fmt.Sprintf(
"The readline library Terraform currently uses for the interactive\n" +
"The readline library OpenTF currently uses for the interactive\n" +
"console is not supported by Solaris. Interactive mode is therefore\n" +
"not supported on Solaris currently."))
return 1

View File

@ -39,7 +39,7 @@ func TestInitProviders(t *testing.T) {
t.Errorf("unexpected stderr output:\n%s", stderr)
}
if !strings.Contains(stdout, "Terraform has been successfully initialized!") {
if !strings.Contains(stdout, "OpenTF has been successfully initialized!") {
t.Errorf("success message is missing from output:\n%s", stdout)
}
@ -48,7 +48,7 @@ func TestInitProviders(t *testing.T) {
t.Logf("(this can happen if you have a copy of the plugin in one of the global plugin search dirs)")
}
if !strings.Contains(stdout, "Terraform has created a lock file") {
if !strings.Contains(stdout, "OpenTF has created a lock file") {
t.Errorf("lock file notification is missing from output:\n%s", stdout)
}
@ -72,7 +72,7 @@ func TestInitProvidersInternal(t *testing.T) {
t.Errorf("unexpected stderr output:\n%s", stderr)
}
if !strings.Contains(stdout, "Terraform has been successfully initialized!") {
if !strings.Contains(stdout, "OpenTF has been successfully initialized!") {
t.Errorf("success message is missing from output:\n%s", stdout)
}
@ -121,7 +121,7 @@ func TestInitProvidersVendored(t *testing.T) {
t.Errorf("unexpected stderr output:\n%s", stderr)
}
if !strings.Contains(stdout, "Terraform has been successfully initialized!") {
if !strings.Contains(stdout, "OpenTF has been successfully initialized!") {
t.Errorf("success message is missing from output:\n%s", stdout)
}
@ -170,7 +170,7 @@ func TestInitProvidersLocalOnly(t *testing.T) {
t.Errorf("unexpected stderr output:\n%s", stderr)
}
if !strings.Contains(stdout, "Terraform has been successfully initialized!") {
if !strings.Contains(stdout, "OpenTF has been successfully initialized!") {
t.Errorf("success message is missing from output:\n%s", stdout)
}
@ -218,7 +218,7 @@ func TestInitProvidersCustomMethod(t *testing.T) {
t.Errorf("unexpected stderr output:\n%s", stderr)
}
if !strings.Contains(stdout, "Terraform has been successfully initialized!") {
if !strings.Contains(stdout, "OpenTF has been successfully initialized!") {
t.Errorf("success message is missing from output:\n%s", stdout)
}
@ -379,7 +379,7 @@ func TestInitProviderNotFound(t *testing.T) {
consumers will get the correct providers when using a module. To see which
modules are currently depending on hashicorp/nonexist, run the following
command:
terraform providers
opentf providers
`

View File

@ -29,7 +29,7 @@ func TestInitModuleArchive(t *testing.T) {
t.Errorf("unexpected stderr output:\n%s", stderr)
}
if !strings.Contains(stdout, "Terraform has been successfully initialized!") {
if !strings.Contains(stdout, "OpenTF has been successfully initialized!") {
t.Errorf("success message is missing from output:\n%s", stdout)
}
}

View File

@ -69,7 +69,7 @@ func TestProviderTampering(t *testing.T) {
if want := `registry.terraform.io/hashicorp/null: there is no package for registry.terraform.io/hashicorp/null 3.1.0 cached in ` + providerCacheDir; !strings.Contains(stderr, want) {
t.Errorf("missing expected error message\nwant substring: %s\ngot:\n%s", want, stderr)
}
if want := `terraform init`; !strings.Contains(stderr, want) {
if want := `opentf init`; !strings.Contains(stderr, want) {
t.Errorf("missing expected error message\nwant substring: %s\ngot:\n%s", want, stderr)
}
@ -104,7 +104,7 @@ func TestProviderTampering(t *testing.T) {
if want := `Initial configuration of the requested backend "local"`; !strings.Contains(stderr, want) {
t.Errorf("missing expected error message\nwant substring: %s\ngot:\n%s", want, stderr)
}
if want := `terraform init`; !strings.Contains(stderr, want) {
if want := `opentf init`; !strings.Contains(stderr, want) {
t.Errorf("missing expected error message\nwant substring: %s\ngot:\n%s", want, stderr)
}
@ -134,7 +134,7 @@ func TestProviderTampering(t *testing.T) {
if want := `registry.terraform.io/hashicorp/null: the cached package for registry.terraform.io/hashicorp/null 3.1.0 (in ` + providerCacheDir + `) does not match any of the checksums recorded in the dependency lock file`; !strings.Contains(stderr, want) {
t.Errorf("missing expected error message\nwant substring: %s\ngot:\n%s", want, stderr)
}
if want := `terraform init`; !strings.Contains(stderr, want) {
if want := `opentf init`; !strings.Contains(stderr, want) {
t.Errorf("missing expected error message\nwant substring: %s\ngot:\n%s", want, stderr)
}
})

View File

@ -33,7 +33,7 @@ func TestVersion(t *testing.T) {
t.Errorf("unexpected stderr output:\n%s", stderr)
}
wantVersion := fmt.Sprintf("Terraform v%s", version.String())
wantVersion := fmt.Sprintf("OpenTF v%s", version.String())
if !strings.Contains(stdout, wantVersion) {
t.Errorf("output does not contain our current version %q:\n%s", wantVersion, stdout)
}
@ -64,7 +64,7 @@ func TestVersionWithProvider(t *testing.T) {
t.Errorf("unexpected stderr output:\n%s", stderr)
}
wantVersion := fmt.Sprintf("Terraform v%s", version.String())
wantVersion := fmt.Sprintf("OpenTF v%s", version.String())
if !strings.Contains(stdout, wantVersion) {
t.Errorf("output does not contain our current version %q:\n%s", wantVersion, stdout)
}

View File

@ -159,7 +159,7 @@ func (c *FmtCommand) fmt(paths []string, stdin io.Reader, stdout io.Writer) tfdi
}
if !fmtd {
diags = diags.Append(fmt.Errorf("Only .tf, .tfvars, and .tftest.hcl files can be processed with terraform fmt"))
diags = diags.Append(fmt.Errorf("Only .tf, .tfvars, and .tftest.hcl files can be processed with opentf fmt"))
continue
}
}
@ -171,7 +171,7 @@ func (c *FmtCommand) fmt(paths []string, stdin io.Reader, stdout io.Writer) tfdi
func (c *FmtCommand) processFile(path string, r io.Reader, w io.Writer, isStdout bool) tfdiags.Diagnostics {
var diags tfdiags.Diagnostics
log.Printf("[TRACE] terraform fmt: Formatting %s", path)
log.Printf("[TRACE] opentf fmt: Formatting %s", path)
src, err := ioutil.ReadAll(r)
if err != nil {
@ -229,7 +229,7 @@ func (c *FmtCommand) processFile(path string, r io.Reader, w io.Writer, isStdout
func (c *FmtCommand) processDir(path string, stdout io.Writer) tfdiags.Diagnostics {
var diags tfdiags.Diagnostics
log.Printf("[TRACE] terraform fmt: looking for files in %s", path)
log.Printf("[TRACE] opentf fmt: looking for files in %s", path)
entries, err := ioutil.ReadDir(path)
if err != nil {
@ -547,9 +547,9 @@ func (c *FmtCommand) trimNewlines(tokens hclwrite.Tokens) hclwrite.Tokens {
func (c *FmtCommand) Help() string {
helpText := `
Usage: terraform [global options] fmt [options] [target...]
Usage: opentf [global options] fmt [options] [target...]
Rewrites all Terraform configuration files to a canonical format. All
Rewrites all OpenTF configuration files to a canonical format. All
configuration files (.tf), variables files (.tfvars), and testing files
(.tftest.hcl) are updated. JSON files (.tf.json, .tfvars.json, or
.tftest.json) are not modified.
@ -560,7 +560,7 @@ Usage: terraform [global options] fmt [options] [target...]
file. If you provide a single dash ("-"), then fmt will read from standard
input (STDIN).
The content must be in the Terraform language native syntax; JSON is not
The content must be in the OpenTF language native syntax; JSON is not
supported.
Options:

View File

@ -54,7 +54,7 @@ func (c *GetCommand) Run(args []string) int {
func (c *GetCommand) Help() string {
helpText := `
Usage: terraform [global options] get [options]
Usage: opentf [global options] get [options]
Downloads and installs modules needed for the configuration in the
current working directory.
@ -65,7 +65,7 @@ Usage: terraform [global options] get [options]
unless the -update flag is specified.
Module installation also happens automatically by default as part of
the "terraform init" command, so you should rarely need to run this
the "opentf init" command, so you should rarely need to run this
command separately.
Options:
@ -75,14 +75,14 @@ Options:
-no-color Disable text coloring in the output.
-test-directory=path Set the Terraform test directory, defaults to "tests".
-test-directory=path Set the OpenTF test directory, defaults to "tests".
`
return strings.TrimSpace(helpText)
}
func (c *GetCommand) Synopsis() string {
return "Install or upgrade remote Terraform modules"
return "Install or upgrade remote OpenTF modules"
}
func getModules(ctx context.Context, m *Meta, path string, testsDir string, upgrade bool) (abort bool, diags tfdiags.Diagnostics) {

View File

@ -196,7 +196,7 @@ func (c *GraphCommand) Run(args []string) int {
func (c *GraphCommand) Help() string {
helpText := `
Usage: terraform [global options] graph [options]
Usage: opentf [global options] graph [options]
Produces a representation of the dependency graph between different
objects in the current configuration and state.
@ -214,10 +214,10 @@ Options:
This helps when diagnosing cycle errors.
-type=plan Type of graph to output. Can be: plan, plan-refresh-only,
plan-destroy, or apply. By default Terraform chooses
plan-destroy, or apply. By default OpenTF chooses
"plan", or "apply" if you also set the -plan=... option.
-module-depth=n (deprecated) In prior versions of Terraform, specified the
-module-depth=n (deprecated) In prior versions of OpenTF, specified the
depth of modules to show in the output.
`
return strings.TrimSpace(helpText)

View File

@ -11,17 +11,17 @@ import (
const failedToLoadSchemasMessage = `
Warning: Failed to update data for external integrations
Terraform was unable to generate a description of the updated
OpenTF was unable to generate a description of the updated
state for use with external integrations in Terraform Cloud.
Any integrations configured for this workspace which depend on
information from the state may not work correctly when using the
result of this action.
This problem occurs when Terraform cannot read the schema for
This problem occurs when OpenTF cannot read the schema for
one or more of the providers used in the state. The next successful
apply will correct the problem by re-generating the JSON description
of the state:
terraform apply
opentf apply
`
func isCloudMode(b backend.Enhanced) bool {

View File

@ -41,7 +41,7 @@ func (c *ImportCommand) Run(args []string) int {
args = c.Meta.process(args)
cmdFlags := c.Meta.extendedFlagSet("import")
cmdFlags.BoolVar(&c.ignoreRemoteVersion, "ignore-remote-version", false, "continue even if remote and local Terraform versions are incompatible")
cmdFlags.BoolVar(&c.ignoreRemoteVersion, "ignore-remote-version", false, "continue even if remote and local OpenTF versions are incompatible")
cmdFlags.IntVar(&c.Meta.parallelism, "parallelism", DefaultParallelism, "parallelism")
cmdFlags.StringVar(&c.Meta.statePath, "state", "", "path")
cmdFlags.StringVar(&c.Meta.stateOutPath, "state-out", "", "path")
@ -91,9 +91,9 @@ func (c *ImportCommand) Run(args []string) int {
if !c.dirIsConfigPath(configPath) {
diags = diags.Append(&hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: "No Terraform configuration files",
Summary: "No OpenTF configuration files",
Detail: fmt.Sprintf(
"The directory %s does not contain any Terraform configuration files (.tf or .tf.json). To specify a different configuration directory, use the -config=\"...\" command line option.",
"The directory %s does not contain any OpenTF configuration files (.tf or .tf.json). To specify a different configuration directory, use the -config=\"...\" command line option.",
configPath,
),
})
@ -286,13 +286,13 @@ func (c *ImportCommand) Run(args []string) int {
func (c *ImportCommand) Help() string {
helpText := `
Usage: terraform [global options] import [options] ADDR ID
Usage: opentf [global options] import [options] ADDR ID
Import existing infrastructure into your Terraform state.
Import existing infrastructure into your OpenTF state.
This will find and import the specified resource into your Terraform
state, allowing existing infrastructure to come under Terraform
management without having to be initially created by Terraform.
This will find and import the specified resource into your OpenTF
state, allowing existing infrastructure to come under OpenTF
management without having to be initially created by OpenTF.
The ADDR specified is the address to import the resource to. Please
see the documentation online for resource addresses. The ID is a
@ -307,7 +307,7 @@ Usage: terraform [global options] import [options] ADDR ID
Options:
-config=path Path to a directory of Terraform configuration files
-config=path Path to a directory of OpenTF configuration files
to use to configure the provider. Defaults to pwd.
If no config files are present, they must be provided
via the input prompts or env vars.
@ -322,11 +322,11 @@ Options:
-no-color If specified, output won't contain any color.
-var 'foo=bar' Set a variable in the Terraform configuration. This
-var 'foo=bar' Set a variable in the OpenTF configuration. This
flag can be set multiple times. This is only useful
with the "-config" flag.
-var-file=foo Set variables in the Terraform configuration from
-var-file=foo Set variables in the OpenTF configuration from
a file. If "terraform.tfvars" or any ".auto.tfvars"
files are present, they will be automatically loaded.
@ -341,7 +341,7 @@ Options:
}
func (c *ImportCommand) Synopsis() string {
return "Associate existing infrastructure with a Terraform resource"
return "Associate existing infrastructure with a OpenTF resource"
}
const importCommandInvalidAddressReference = `For information on valid syntax, see:
@ -359,5 +359,5 @@ resource %q %q {
const importCommandSuccessMsg = `Import successful!
The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.
your OpenTF state and will henceforth be managed by OpenTF.
`

View File

@ -189,7 +189,7 @@ func TestImport_remoteState(t *testing.T) {
}
// (Using log here rather than t.Log so that these messages interleave with other trace logs)
log.Print("[TRACE] TestImport_remoteState running: terraform init")
log.Print("[TRACE] TestImport_remoteState running: opentf init")
if code := ic.Run([]string{}); code != 0 {
t.Fatalf("init failed\n%s", ui.ErrorWriter)
}
@ -250,7 +250,7 @@ func TestImport_remoteState(t *testing.T) {
"test_instance.foo",
"bar",
}
log.Printf("[TRACE] TestImport_remoteState running: terraform import %s %s", args[0], args[1])
log.Printf("[TRACE] TestImport_remoteState running: opentf import %s %s", args[0], args[1])
if code := c.Run(args); code != 0 {
fmt.Println(ui.OutputWriter)
t.Fatalf("bad: %d\n\n%s", code, ui.ErrorWriter.String())
@ -301,7 +301,7 @@ func TestImport_initializationErrorShouldUnlock(t *testing.T) {
}
// (Using log here rather than t.Log so that these messages interleave with other trace logs)
log.Print("[TRACE] TestImport_initializationErrorShouldUnlock running: terraform init")
log.Print("[TRACE] TestImport_initializationErrorShouldUnlock running: opentf init")
if code := ic.Run([]string{}); code != 0 {
t.Fatalf("init failed\n%s", ui.ErrorWriter)
}
@ -323,7 +323,7 @@ func TestImport_initializationErrorShouldUnlock(t *testing.T) {
"unknown_instance.baz",
"bar",
}
log.Printf("[TRACE] TestImport_initializationErrorShouldUnlock running: terraform import %s %s", args[0], args[1])
log.Printf("[TRACE] TestImport_initializationErrorShouldUnlock running: opentf import %s %s", args[0], args[1])
// this should fail
if code := c.Run(args); code != 1 {
@ -674,7 +674,7 @@ func TestImport_emptyConfig(t *testing.T) {
}
msg := ui.ErrorWriter.String()
if want := `No Terraform configuration files`; !strings.Contains(msg, want) {
if want := `No OpenTF configuration files`; !strings.Contains(msg, want) {
t.Errorf("incorrect message\nwant substring: %s\ngot:\n%s", want, msg)
}
}

View File

@ -61,7 +61,7 @@ func (c *InitCommand) Run(args []string) int {
cmdFlags.BoolVar(&flagUpgrade, "upgrade", false, "")
cmdFlags.Var(&flagPluginPath, "plugin-dir", "plugin directory")
cmdFlags.StringVar(&flagLockfile, "lockfile", "", "Set a dependency lockfile mode")
cmdFlags.BoolVar(&c.Meta.ignoreRemoteVersion, "ignore-remote-version", false, "continue even if remote and local Terraform versions are incompatible")
cmdFlags.BoolVar(&c.Meta.ignoreRemoteVersion, "ignore-remote-version", false, "continue even if remote and local OpenTF versions are incompatible")
cmdFlags.StringVar(&testsDirectory, "test-directory", "tests", "test-directory")
cmdFlags.Usage = func() { c.Ui.Error(c.Help()) }
if err := cmdFlags.Parse(args); err != nil {
@ -390,7 +390,7 @@ func (c *InitCommand) getModules(ctx context.Context, path, testsDir string, ear
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Failed to read module manifest",
fmt.Sprintf("After installing modules, Terraform could not re-read the manifest of installed modules. This is a bug in Terraform. %s.", err),
fmt.Sprintf("After installing modules, OpenTF could not re-read the manifest of installed modules. This is a bug in OpenTF. %s.", err),
))
}
}
@ -592,7 +592,7 @@ func (c *InitCommand) getProviders(ctx context.Context, config *configs.Config,
c.Ui.Info(fmt.Sprintf("- Using previously-installed %s v%s", provider.ForDisplay(), selectedVersion))
},
BuiltInProviderAvailable: func(provider addrs.Provider) {
c.Ui.Info(fmt.Sprintf("- %s is built in to Terraform", provider.ForDisplay()))
c.Ui.Info(fmt.Sprintf("- %s is built in to OpenTF", provider.ForDisplay()))
},
BuiltInProviderFailure: func(provider addrs.Provider, err error) {
diags = diags.Append(tfdiags.Sourceless(
@ -636,11 +636,11 @@ func (c *InitCommand) getProviders(ctx context.Context, config *configs.Config,
case getproviders.ErrRegistryProviderNotKnown:
// We might be able to suggest an alternative provider to use
// instead of this one.
suggestion := fmt.Sprintf("\n\nAll modules should specify their required_providers so that external consumers will get the correct providers when using a module. To see which modules are currently depending on %s, run the following command:\n terraform providers", provider.ForDisplay())
suggestion := fmt.Sprintf("\n\nAll modules should specify their required_providers so that external consumers will get the correct providers when using a module. To see which modules are currently depending on %s, run the following command:\n opentf providers", provider.ForDisplay())
alternative := getproviders.MissingProviderSuggestion(ctx, provider, inst.ProviderSource(), reqs)
if alternative != provider {
suggestion = fmt.Sprintf(
"\n\nDid you intend to use %s? If so, you must specify that source address in each module which requires that provider. To see which modules are currently depending on %s, run the following command:\n terraform providers",
"\n\nDid you intend to use %s? If so, you must specify that source address in each module which requires that provider. To see which modules are currently depending on %s, run the following command:\n opentf providers",
alternative.ForDisplay(), provider.ForDisplay(),
)
}
@ -666,7 +666,7 @@ func (c *InitCommand) getProviders(ctx context.Context, config *configs.Config,
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Invalid provider registry host",
fmt.Sprintf("The given source address %q specifies a GitHub repository rather than a Terraform provider. Refer to the documentation of the provider to find the correct source address to use.",
fmt.Sprintf("The given source address %q specifies a GitHub repository rather than a OpenTF provider. Refer to the documentation of the provider to find the correct source address to use.",
provider.String(),
),
))
@ -675,7 +675,7 @@ func (c *InitCommand) getProviders(ctx context.Context, config *configs.Config,
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Invalid provider registry host",
fmt.Sprintf("The host %q given in provider source address %q does not offer a Terraform provider registry that is compatible with this Terraform version, but it may be compatible with a different Terraform version.",
fmt.Sprintf("The host %q given in provider source address %q does not offer a OpenTF provider registry that is compatible with this OpenTF version, but it may be compatible with a different OpenTF version.",
errorTy.Hostname, provider.String(),
),
))
@ -684,7 +684,7 @@ func (c *InitCommand) getProviders(ctx context.Context, config *configs.Config,
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Invalid provider registry host",
fmt.Sprintf("The host %q given in provider source address %q does not offer a Terraform provider registry.",
fmt.Sprintf("The host %q given in provider source address %q does not offer a OpenTF provider registry.",
errorTy.Hostname, provider.String(),
),
))
@ -769,7 +769,7 @@ func (c *InitCommand) getProviders(ctx context.Context, config *configs.Config,
tfdiags.Error,
summaryIncompatible,
fmt.Sprintf(
"Your chosen provider mirror at %s does not have a %s v%s package available for your current platform, %s.\n\nProvider releases are separate from Terraform CLI releases, so this provider might not support your current platform. Alternatively, the mirror itself might have only a subset of the plugin packages available in the origin registry, at %s.",
"Your chosen provider mirror at %s does not have a %s v%s package available for your current platform, %s.\n\nProvider releases are separate from OpenTF CLI releases, so this provider might not support your current platform. Alternatively, the mirror itself might have only a subset of the plugin packages available in the origin registry, at %s.",
err.MirrorURL, err.Provider, err.Version, err.Platform,
err.Provider.Hostname,
),
@ -779,7 +779,7 @@ func (c *InitCommand) getProviders(ctx context.Context, config *configs.Config,
tfdiags.Error,
summaryIncompatible,
fmt.Sprintf(
"Provider %s v%s does not have a package available for your current platform, %s.\n\nProvider releases are separate from Terraform CLI releases, so not all providers are available for all platforms. Other versions of this provider may have different platforms supported.",
"Provider %s v%s does not have a package available for your current platform, %s.\n\nProvider releases are separate from OpenTF CLI releases, so not all providers are available for all platforms. Other versions of this provider may have different platforms supported.",
err.Provider, err.Version, err.Platform,
),
))
@ -911,7 +911,7 @@ func (c *InitCommand) getProviders(ctx context.Context, config *configs.Config,
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
`Provider dependency changes detected`,
`Changes to the required provider dependencies were detected, but the lock file is read-only. To use and record these requirements, run "terraform init" without the "-lockfile=readonly" flag.`,
`Changes to the required provider dependencies were detected, but the lock file is read-only. To use and record these requirements, run "opentf init" without the "-lockfile=readonly" flag.`,
))
return true, true, diags
}
@ -921,7 +921,7 @@ func (c *InitCommand) getProviders(ctx context.Context, config *configs.Config,
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Warning,
`Provider lock file not updated`,
`Changes to the provider selections were detected, but not saved in the .terraform.lock.hcl file. To record these selections, run "terraform init" without the "-lockfile=readonly" flag.`,
`Changes to the provider selections were detected, but not saved in the .terraform.lock.hcl file. To record these selections, run "opentf init" without the "-lockfile=readonly" flag.`,
))
return true, false, diags
}
@ -950,13 +950,13 @@ func (c *InitCommand) getProviders(ctx context.Context, config *configs.Config,
// users or those who are upgrading from a previous Terraform
// version that didn't have dependency lock files.
c.Ui.Output(c.Colorize().Color(`
Terraform has created a lock file [bold].terraform.lock.hcl[reset] to record the provider
OpenTF has created a lock file [bold].terraform.lock.hcl[reset] to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.`))
so that OpenTF can guarantee to make the same selections by default when
you run "opentf init" in the future.`))
} else {
c.Ui.Output(c.Colorize().Color(`
Terraform has made some changes to the provider dependency selections recorded
OpenTF has made some changes to the provider dependency selections recorded
in the .terraform.lock.hcl file. Review those changes and commit them to your
version control system if they represent changes you intended to make.`))
}
@ -1098,14 +1098,14 @@ func (c *InitCommand) AutocompleteFlags() complete.Flags {
func (c *InitCommand) Help() string {
helpText := `
Usage: terraform [global options] init [options]
Usage: opentf [global options] init [options]
Initialize a new or existing Terraform working directory by creating
Initialize a new or existing OpenTF working directory by creating
initial files, loading any remote state, downloading modules, etc.
This is the first command that should be run for any new or existing
Terraform configuration per machine. This sets up all the local data
necessary to run Terraform that is typically not committed to version
OpenTF configuration per machine. This sets up all the local data
necessary to run OpenTF that is typically not committed to version
control.
This command is always safe to run multiple times. Though subsequent runs
@ -1172,12 +1172,12 @@ Options:
-ignore-remote-version A rare option used for Terraform Cloud and the remote backend
only. Set this to ignore checking that the local and remote
Terraform versions use compatible state representations, making
OpenTF versions use compatible state representations, making
an operation proceed even when there is a potential mismatch.
See the documentation on configuring Terraform with
See the documentation on configuring OpenTF with
Terraform Cloud for more information.
-test-directory=path Set the Terraform test directory, defaults to "tests".
-test-directory=path Set the OpenTF test directory, defaults to "tests".
`
return strings.TrimSpace(helpText)
@ -1188,11 +1188,11 @@ func (c *InitCommand) Synopsis() string {
}
const errInitConfigError = `
[reset]Terraform encountered problems during initialisation, including problems
[reset]OpenTF encountered problems during initialisation, including problems
with the configuration, described below.
The Terraform configuration must be valid before initialization so that
Terraform can determine which modules and providers need to be installed.
The OpenTF configuration must be valid before initialization so that
OpenTF can determine which modules and providers need to be installed.
`
const errInitCopyNotEmpty = `
@ -1204,14 +1204,14 @@ To initialize the configuration already in this working directory, omit the
`
const outputInitEmpty = `
[reset][bold]Terraform initialized in an empty directory![reset]
[reset][bold]OpenTF initialized in an empty directory![reset]
The directory has no Terraform configuration files. You may begin working
with Terraform immediately by creating Terraform configuration files.
The directory has no OpenTF configuration files. You may begin working
with OpenTF immediately by creating OpenTF configuration files.
`
const outputInitSuccess = `
[reset][bold][green]Terraform has been successfully initialized![reset][green]
[reset][bold][green]OpenTF has been successfully initialized![reset][green]
`
const outputInitSuccessCloud = `
@ -1219,49 +1219,49 @@ const outputInitSuccessCloud = `
`
const outputInitSuccessCLI = `[reset][green]
You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
You may now begin working with OpenTF. Try running "opentf plan" to see
any changes that are required for your infrastructure. All OpenTF commands
should now work.
If you ever set or change modules or backend configuration for Terraform,
If you ever set or change modules or backend configuration for OpenTF,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
`
const outputInitSuccessCLICloud = `[reset][green]
You may now begin working with Terraform Cloud. Try running "terraform plan" to
You may now begin working with Terraform Cloud. Try running "opentf plan" to
see any changes that are required for your infrastructure.
If you ever set or change modules or Terraform Settings, run "terraform init"
If you ever set or change modules or OpenTF Settings, run "opentf init"
again to reinitialize your working directory.
`
// providerProtocolTooOld is a message sent to the CLI UI if the provider's
// supported protocol versions are too old for the user's version of terraform,
// but a newer version of the provider is compatible.
const providerProtocolTooOld = `Provider %q v%s is not compatible with Terraform %s.
const providerProtocolTooOld = `Provider %q v%s is not compatible with OpenTF %s.
Provider version %s is the latest compatible version. Select it with the following version constraint:
version = %q
Terraform checked all of the plugin versions matching the given constraint:
OpenTF checked all of the plugin versions matching the given constraint:
%s
Consult the documentation for this provider for more information on compatibility between provider and Terraform versions.
Consult the documentation for this provider for more information on compatibility between provider and OpenTF versions.
`
// providerProtocolTooNew is a message sent to the CLI UI if the provider's
// supported protocol versions are too new for the user's version of terraform,
// and the user could either upgrade terraform or choose an older version of the
// provider.
const providerProtocolTooNew = `Provider %q v%s is not compatible with Terraform %s.
const providerProtocolTooNew = `Provider %q v%s is not compatible with OpenTF %s.
You need to downgrade to v%s or earlier. Select it with the following constraint:
version = %q
Terraform checked all of the plugin versions matching the given constraint:
OpenTF checked all of the plugin versions matching the given constraint:
%s
Consult the documentation for this provider for more information on compatibility between provider and Terraform versions.
Alternatively, upgrade to the latest version of Terraform for compatibility with newer provider releases.
Consult the documentation for this provider for more information on compatibility between provider and OpenTF versions.
Alternatively, upgrade to the latest version of OpenTF for compatibility with newer provider releases.
`
// No version of the provider is compatible.
@ -1273,11 +1273,11 @@ const incompleteLockFileInformationHeader = `Incomplete lock file information fo
// incompleteLockFileInformationBody is the body of text displayed to users when
// the lock file has only recorded local hashes.
const incompleteLockFileInformationBody = `Due to your customized provider installation methods, Terraform was forced to calculate lock file checksums locally for the following providers:
const incompleteLockFileInformationBody = `Due to your customized provider installation methods, OpenTF was forced to calculate lock file checksums locally for the following providers:
- %s
The current .terraform.lock.hcl file only includes checksums for %s, so Terraform running on another platform will fail to install these providers.
The current .terraform.lock.hcl file only includes checksums for %s, so OpenTF running on another platform will fail to install these providers.
To calculate additional checksums for another platform, run:
terraform providers lock -platform=linux_amd64
opentf providers lock -platform=linux_amd64
(where linux_amd64 is the platform to generate)`

View File

@ -1663,7 +1663,7 @@ func TestInit_providerSource(t *testing.T) {
if code := c.Run(args); code != 0 {
t.Fatalf("bad: \n%s", ui.ErrorWriter.String())
}
if strings.Contains(ui.OutputWriter.String(), "Terraform has initialized, but configuration upgrades may be needed") {
if strings.Contains(ui.OutputWriter.String(), "OpenTF has initialized, but configuration upgrades may be needed") {
t.Fatalf("unexpected \"configuration upgrade\" warning in output")
}
@ -2576,8 +2576,8 @@ func TestInit_pluginDirWithBuiltIn(t *testing.T) {
}
outputStr := ui.OutputWriter.String()
if subStr := "terraform.io/builtin/terraform is built in to Terraform"; !strings.Contains(outputStr, subStr) {
t.Errorf("output should mention the terraform provider\nwant substr: %s\ngot:\n%s", subStr, outputStr)
if subStr := "terraform.io/builtin/terraform is built in to OpenTF"; !strings.Contains(outputStr, subStr) {
t.Errorf("output should mention the opentf provider\nwant substr: %s\ngot:\n%s", subStr, outputStr)
}
}
@ -2642,7 +2642,7 @@ func TestInit_invalidSyntaxNoBackend(t *testing.T) {
}
errStr := ui.ErrorWriter.String()
if subStr := "Terraform encountered problems during initialisation, including problems\nwith the configuration, described below."; !strings.Contains(errStr, subStr) {
if subStr := "OpenTF encountered problems during initialisation, including problems\nwith the configuration, described below."; !strings.Contains(errStr, subStr) {
t.Errorf("Error output should include preamble\nwant substr: %s\ngot:\n%s", subStr, errStr)
}
if subStr := "Error: Unsupported block type"; !strings.Contains(errStr, subStr) {
@ -2671,7 +2671,7 @@ func TestInit_invalidSyntaxWithBackend(t *testing.T) {
}
errStr := ui.ErrorWriter.String()
if subStr := "Terraform encountered problems during initialisation, including problems\nwith the configuration, described below."; !strings.Contains(errStr, subStr) {
if subStr := "OpenTF encountered problems during initialisation, including problems\nwith the configuration, described below."; !strings.Contains(errStr, subStr) {
t.Errorf("Error output should include preamble\nwant substr: %s\ngot:\n%s", subStr, errStr)
}
if subStr := "Error: Unsupported block type"; !strings.Contains(errStr, subStr) {
@ -2700,7 +2700,7 @@ func TestInit_invalidSyntaxInvalidBackend(t *testing.T) {
}
errStr := ui.ErrorWriter.String()
if subStr := "Terraform encountered problems during initialisation, including problems\nwith the configuration, described below."; !strings.Contains(errStr, subStr) {
if subStr := "OpenTF encountered problems during initialisation, including problems\nwith the configuration, described below."; !strings.Contains(errStr, subStr) {
t.Errorf("Error output should include preamble\nwant substr: %s\ngot:\n%s", subStr, errStr)
}
if subStr := "Error: Unsupported block type"; !strings.Contains(errStr, subStr) {
@ -2732,7 +2732,7 @@ func TestInit_invalidSyntaxBackendAttribute(t *testing.T) {
}
errStr := ui.ErrorWriter.String()
if subStr := "Terraform encountered problems during initialisation, including problems\nwith the configuration, described below."; !strings.Contains(errStr, subStr) {
if subStr := "OpenTF encountered problems during initialisation, including problems\nwith the configuration, described below."; !strings.Contains(errStr, subStr) {
t.Errorf("Error output should include preamble\nwant substr: %s\ngot:\n%s", subStr, errStr)
}
if subStr := "Error: Invalid character"; !strings.Contains(errStr, subStr) {

View File

@ -23,6 +23,7 @@ import (
svchost "github.com/hashicorp/terraform-svchost"
svcauth "github.com/hashicorp/terraform-svchost/auth"
"github.com/hashicorp/terraform-svchost/disco"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/cliconfig"
"github.com/placeholderplaceholderplaceholder/opentf/internal/httpclient"
"github.com/placeholderplaceholderplaceholder/opentf/internal/logging"
@ -63,7 +64,7 @@ func (c *LoginCommand) Run(args []string) int {
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Login is an interactive command",
"The \"terraform login\" command uses interactive prompts to obtain and record credentials, so it can't be run with input disabled.\n\nTo configure credentials in a non-interactive context, write existing credentials directly to a CLI configuration file.",
"The \"opentf login\" command uses interactive prompts to obtain and record credentials, so it can't be run with input disabled.\n\nTo configure credentials in a non-interactive context, write existing credentials directly to a CLI configuration file.",
))
c.showDiagnostics(diags)
return 1
@ -125,14 +126,14 @@ func (c *LoginCommand) Run(args []string) int {
case *disco.ErrVersionNotSupported:
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Warning,
"Host does not support Terraform login",
fmt.Sprintf("The given hostname %q allows creating Terraform authorization tokens, but requires a newer version of Terraform CLI to do so.", dispHostname),
"Host does not support OpenTF login",
fmt.Sprintf("The given hostname %q allows creating OpenTF authorization tokens, but requires a newer version of OpenTF CLI to do so.", dispHostname),
))
default:
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Warning,
"Host does not support Terraform login",
fmt.Sprintf("The given hostname %q cannot support \"terraform login\": %s.", dispHostname, err),
"Host does not support OpenTF login",
fmt.Sprintf("The given hostname %q cannot support \"opentf login\": %s.", dispHostname, err),
))
}
@ -146,20 +147,20 @@ func (c *LoginCommand) Run(args []string) int {
case *disco.ErrServiceNotProvided:
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Host does not support Terraform tokens API",
fmt.Sprintf("The given hostname %q does not support creating Terraform authorization tokens.", dispHostname),
"Host does not support OpenTF tokens API",
fmt.Sprintf("The given hostname %q does not support creating OpenTF authorization tokens.", dispHostname),
))
case *disco.ErrVersionNotSupported:
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Host does not support Terraform tokens API",
fmt.Sprintf("The given hostname %q allows creating Terraform authorization tokens, but requires a newer version of Terraform CLI to do so.", dispHostname),
"Host does not support OpenTF tokens API",
fmt.Sprintf("The given hostname %q allows creating OpenTF authorization tokens, but requires a newer version of OpenTF CLI to do so.", dispHostname),
))
default:
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Host does not support Terraform tokens API",
fmt.Sprintf("The given hostname %q cannot support \"terraform login\": %s.", dispHostname, err),
"Host does not support OpenTF tokens API",
fmt.Sprintf("The given hostname %q cannot support \"opentf login\": %s.", dispHostname, err),
))
}
}
@ -168,7 +169,7 @@ func (c *LoginCommand) Run(args []string) int {
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
fmt.Sprintf("Credentials for %s are manually configured", dispHostname),
"The \"terraform login\" command cannot log in because credentials for this host are already configured in a CLI configuration file.\n\nTo log in, first revoke the existing credentials and remove that block from the CLI configuration.",
"The \"opentf login\" command cannot log in because credentials for this host are already configured in a CLI configuration file.\n\nTo log in, first revoke the existing credentials and remove that block from the CLI configuration.",
))
}
@ -180,7 +181,7 @@ func (c *LoginCommand) Run(args []string) int {
var token svcauth.HostCredentialsToken
var tokenDiags tfdiags.Diagnostics
// Prefer Terraform login if available
// Prefer OpenTF login if available
if clientConfig != nil {
var oauthToken *oauth2.Token
@ -196,8 +197,8 @@ func (c *LoginCommand) Run(args []string) int {
default:
tokenDiags = tokenDiags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Host does not support Terraform login",
fmt.Sprintf("The given hostname %q does not allow any OAuth grant types that are supported by this version of Terraform.", dispHostname),
"Host does not support OpenTF login",
fmt.Sprintf("The given hostname %q does not allow any OAuth grant types that are supported by this version of OpenTF.", dispHostname),
))
}
if oauthToken != nil {
@ -218,7 +219,7 @@ func (c *LoginCommand) Run(args []string) int {
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Failed to save API token",
fmt.Sprintf("The given host returned an API token, but Terraform failed to save it: %s.", err),
fmt.Sprintf("The given host returned an API token, but OpenTF failed to save it: %s.", err),
))
}
@ -290,9 +291,9 @@ func (c *LoginCommand) Run(args []string) int {
c.Ui.Output(
fmt.Sprintf(
c.Colorize().Color(strings.TrimSpace(`
[green][bold]Success![reset] [bold]Terraform has obtained and saved an API token.[reset]
[green][bold]Success![reset] [bold]OpenTF has obtained and saved an API token.[reset]
The new API token will be used for any future Terraform command that must make
The new API token will be used for any future OpenTF command that must make
authenticated requests to %s.
`)),
dispHostname,
@ -338,7 +339,7 @@ func (c *LoginCommand) Help() string {
}
helpText := fmt.Sprintf(`
Usage: terraform [global options] login [hostname]
Usage: opentf [global options] login [hostname]
Retrieves an authentication token for the given hostname, if it supports
automatic login, and saves it in a credentials file in your home directory.
@ -486,7 +487,7 @@ func (c *LoginCommand) interactiveGetTokenByCode(hostname svchost.Hostname, cred
if c.BrowserLauncher != nil {
err = c.BrowserLauncher.OpenURL(authCodeURL)
if err == nil {
c.Ui.Output(fmt.Sprintf("Terraform must now open a web browser to the login page for %s.\n", hostname.ForDisplay()))
c.Ui.Output(fmt.Sprintf("OpenTF must now open a web browser to the login page for %s.\n", hostname.ForDisplay()))
c.Ui.Output(fmt.Sprintf("If a browser does not open this automatically, open the following URL to proceed:\n %s\n", authCodeURL))
} else {
// Assume we're on a platform where opening a browser isn't possible.
@ -500,7 +501,7 @@ func (c *LoginCommand) interactiveGetTokenByCode(hostname svchost.Hostname, cred
c.Ui.Output(fmt.Sprintf("Open the following URL to access the login page for %s:\n %s\n", hostname.ForDisplay(), authCodeURL))
}
c.Ui.Output("Terraform will now wait for the host to signal that login was successful.\n")
c.Ui.Output("OpenTF will now wait for the host to signal that login was successful.\n")
code, ok := <-codeCh
if !ok {
@ -543,7 +544,7 @@ func (c *LoginCommand) interactiveGetTokenByPassword(hostname svchost.Hostname,
}
c.Ui.Output("\n---------------------------------------------------------------------------------\n")
c.Ui.Output("Terraform must temporarily use your password to request an API token.\nThis password will NOT be saved locally.\n")
c.Ui.Output("OpenTF must temporarily use your password to request an API token.\nThis password will NOT be saved locally.\n")
username, err := c.UIInput().Input(context.Background(), &terraform.InputOpts{
Id: "username",
@ -607,7 +608,7 @@ func (c *LoginCommand) interactiveGetTokenByUI(hostname svchost.Hostname, credsC
if c.BrowserLauncher != nil {
err := c.BrowserLauncher.OpenURL(tokensURL.String())
if err == nil {
c.Ui.Output(fmt.Sprintf("Terraform must now open a web browser to the tokens page for %s.\n", hostname.ForDisplay()))
c.Ui.Output(fmt.Sprintf("OpenTF must now open a web browser to the tokens page for %s.\n", hostname.ForDisplay()))
c.Ui.Output(fmt.Sprintf("If a browser does not open this automatically, open the following URL to proceed:\n %s\n", tokensURL.String()))
} else {
log.Printf("[DEBUG] error opening web browser: %s", err)
@ -630,9 +631,9 @@ func (c *LoginCommand) interactiveGetTokenByUI(hostname svchost.Hostname, credsC
if credsCtx != nil {
switch credsCtx.Location {
case cliconfig.CredentialsViaHelper:
c.Ui.Output(fmt.Sprintf("Terraform will store the token in the configured %q credentials helper\nfor use by subsequent commands.\n", credsCtx.HelperType))
c.Ui.Output(fmt.Sprintf("OpenTF will store the token in the configured %q credentials helper\nfor use by subsequent commands.\n", credsCtx.HelperType))
case cliconfig.CredentialsInPrimaryFile, cliconfig.CredentialsNotAvailable:
c.Ui.Output(fmt.Sprintf("Terraform will store the token in plain text in the following file\nfor use by subsequent commands:\n %s\n", credsCtx.LocalFilename))
c.Ui.Output(fmt.Sprintf("OpenTF will store the token in plain text in the following file\nfor use by subsequent commands:\n %s\n", credsCtx.LocalFilename))
}
}
@ -678,7 +679,7 @@ func (c *LoginCommand) interactiveContextConsent(hostname svchost.Hostname, gran
mechanism = "your browser"
}
c.Ui.Output(fmt.Sprintf("Terraform will request an API token for %s using %s.\n", hostname.ForDisplay(), mechanism))
c.Ui.Output(fmt.Sprintf("OpenTF will request an API token for %s using %s.\n", hostname.ForDisplay(), mechanism))
if grantType.UsesAuthorizationEndpoint() {
c.Ui.Output(
@ -691,9 +692,9 @@ func (c *LoginCommand) interactiveContextConsent(hostname svchost.Hostname, gran
if credsCtx != nil {
switch credsCtx.Location {
case cliconfig.CredentialsViaHelper:
c.Ui.Output(fmt.Sprintf("If login is successful, Terraform will store the token in the configured\n%q credentials helper for use by subsequent commands.\n", credsCtx.HelperType))
c.Ui.Output(fmt.Sprintf("If login is successful, OpenTF will store the token in the configured\n%q credentials helper for use by subsequent commands.\n", credsCtx.HelperType))
case cliconfig.CredentialsInPrimaryFile, cliconfig.CredentialsNotAvailable:
c.Ui.Output(fmt.Sprintf("If login is successful, Terraform will store the token in plain text in\nthe following file for use by subsequent commands:\n %s\n", credsCtx.LocalFilename))
c.Ui.Output(fmt.Sprintf("If login is successful, OpenTF will store the token in plain text in\nthe following file for use by subsequent commands:\n %s\n", credsCtx.LocalFilename))
}
}
@ -783,7 +784,7 @@ type loginCredentialsContext struct {
const callbackSuccessMessage = `
<html>
<head>
<title>Terraform Login</title>
<title>OpenTF Login</title>
<style type="text/css">
body {
font-family: monospace;
@ -794,8 +795,8 @@ body {
</head>
<body>
<p>The login server has returned an authentication code to Terraform.</p>
<p>Now close this page and return to the terminal where <tt>terraform login</tt>
<p>The login server has returned an authentication code to OpenTF.</p>
<p>Now close this page and return to the terminal where <tt>opentf login</tt>
is running to see the result of the login process.</p>
</body>

View File

@ -14,6 +14,7 @@ import (
svchost "github.com/hashicorp/terraform-svchost"
"github.com/hashicorp/terraform-svchost/disco"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/cliconfig"
oauthserver "github.com/placeholderplaceholderplaceholder/opentf/internal/command/testdata/login-oauth-server"
tfeserver "github.com/placeholderplaceholderplaceholder/opentf/internal/command/testdata/login-tfe-server"
@ -148,7 +149,7 @@ func TestLogin(t *testing.T) {
t.Errorf("wrong token %q; want %q", got, want)
}
if got, want := ui.OutputWriter.String(), "Terraform has obtained and saved an API token."; !strings.Contains(got, want) {
if got, want := ui.OutputWriter.String(), "OpenTF has obtained and saved an API token."; !strings.Contains(got, want) {
t.Errorf("expected output to contain %q, but was:\n%s", want, got)
}
}))
@ -183,7 +184,7 @@ func TestLogin(t *testing.T) {
t.Errorf("wrong token %q; want %q", got, want)
}
if got, want := ui.OutputWriter.String(), "Terraform has obtained and saved an API token."; !strings.Contains(got, want) {
if got, want := ui.OutputWriter.String(), "OpenTF has obtained and saved an API token."; !strings.Contains(got, want) {
t.Errorf("expected output to contain %q, but was:\n%s", want, got)
}
}))
@ -256,7 +257,7 @@ func TestLogin(t *testing.T) {
t.Fatalf("successful exit; want error")
}
if got, want := ui.ErrorWriter.String(), "Error: Host does not support Terraform tokens API"; !strings.Contains(got, want) {
if got, want := ui.ErrorWriter.String(), "Error: Host does not support OpenTF tokens API"; !strings.Contains(got, want) {
t.Fatalf("missing expected error message\nwant: %s\nfull output:\n%s", want, got)
}
}))

View File

@ -9,6 +9,7 @@ import (
"strings"
svchost "github.com/hashicorp/terraform-svchost"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/cliconfig"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
@ -72,7 +73,7 @@ func (c *LogoutCommand) Run(args []string) int {
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
fmt.Sprintf("Credentials for %s are manually configured", dispHostname),
"The \"terraform logout\" command cannot log out because credentials for this host are manually configured in a CLI configuration file.\n\nTo log out, revoke the existing credentials and remove that block from the CLI configuration.",
"The \"opentf logout\" command cannot log out because credentials for this host are manually configured in a CLI configuration file.\n\nTo log out, revoke the existing credentials and remove that block from the CLI configuration.",
))
}
@ -108,7 +109,7 @@ func (c *LogoutCommand) Run(args []string) int {
c.Ui.Output(
fmt.Sprintf(
c.Colorize().Color(strings.TrimSpace(`
[green][bold]Success![reset] [bold]Terraform has removed the stored API token for %s.[reset]
[green][bold]Success![reset] [bold]OpenTF has removed the stored API token for %s.[reset]
`)),
dispHostname,
) + "\n",
@ -131,7 +132,7 @@ func (c *LogoutCommand) Help() string {
}
helpText := `
Usage: terraform [global options] logout [hostname]
Usage: opentf [global options] logout [hostname]
Removes locally-stored credentials for specified hostname.

View File

@ -568,7 +568,7 @@ func (m *Meta) defaultFlagSet(n string) *flag.FlagSet {
func (m *Meta) ignoreRemoteVersionFlagSet(n string) *flag.FlagSet {
f := m.defaultFlagSet(n)
f.BoolVar(&m.ignoreRemoteVersion, "ignore-remote-version", false, "continue even if remote and local Terraform versions are incompatible")
f.BoolVar(&m.ignoreRemoteVersion, "ignore-remote-version", false, "continue even if remote and local OpenTF versions are incompatible")
return f
}
@ -711,7 +711,7 @@ func (m *Meta) showDiagnostics(vals ...interface{}) {
}
if useCompact {
msg := format.DiagnosticWarningsCompact(diags, m.Colorize())
msg = "\n" + msg + "\nTo see the full warning notes, run Terraform without -compact-warnings.\n"
msg = "\n" + msg + "\nTo see the full warning notes, run OpenTF without -compact-warnings.\n"
m.Ui.Warn(msg)
return
}

View File

@ -128,16 +128,16 @@ func (m *Meta) Backend(opts *BackendOpts) (backend.Enhanced, tfdiags.Diagnostics
for addr, err := range errs {
fmt.Fprintf(&buf, "\n - %s: %s", addr, err)
}
suggestion := "To download the plugins required for this configuration, run:\n terraform init"
suggestion := "To download the plugins required for this configuration, run:\n opentf init"
if m.RunningInAutomation {
// Don't mention "terraform init" specifically if we're running in an automation wrapper
suggestion = "You must install the required plugins before running Terraform operations."
suggestion = "You must install the required plugins before running OpenTF operations."
}
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Required plugins are not installed",
fmt.Sprintf(
"The installed provider plugins are not consistent with the packages selected in the dependency lock file:%s\n\nTerraform uses external plugins to integrate with a variety of different infrastructure services. %s",
"The installed provider plugins are not consistent with the packages selected in the dependency lock file:%s\n\nOpenTF uses external plugins to integrate with a variety of different infrastructure services. %s",
buf.String(), suggestion,
),
))
@ -591,7 +591,7 @@ func (m *Meta) backendFromConfig(opts *BackendOpts) (backend.Backend, tfdiags.Di
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Legacy remote state not supported",
"This working directory is configured for legacy remote state, which is no longer supported from Terraform v0.12 onwards. To migrate this environment, first run \"terraform init\" under a Terraform 0.11 release, and then upgrade Terraform again.",
"This working directory is configured for legacy remote state, which is no longer supported from Terraform v0.12 onwards, and thus not supported by OpenTF, either. To migrate this environment, first run \"terraform init\" under a Terraform 0.11 release, and then upgrade to OpenTF.",
))
return nil, diags
}
@ -612,7 +612,7 @@ func (m *Meta) backendFromConfig(opts *BackendOpts) (backend.Backend, tfdiags.Di
if !opts.Init {
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Backend initialization required, please run \"terraform init\"",
"Backend initialization required, please run \"opentf init\"",
fmt.Sprintf(strings.TrimSpace(errBackendInit), initReason),
))
return nil, diags
@ -633,14 +633,14 @@ func (m *Meta) backendFromConfig(opts *BackendOpts) (backend.Backend, tfdiags.Di
initReason := "Initial configuration of Terraform Cloud"
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Terraform Cloud initialization required: please run \"terraform init\"",
"Terraform Cloud initialization required: please run \"opentf init\"",
fmt.Sprintf(strings.TrimSpace(errBackendInitCloud), initReason),
))
} else {
initReason := fmt.Sprintf("Initial configuration of the requested backend %q", c.Type)
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Backend initialization required, please run \"terraform init\"",
"Backend initialization required, please run \"opentf init\"",
fmt.Sprintf(strings.TrimSpace(errBackendInit), initReason),
))
}
@ -750,19 +750,19 @@ func (m *Meta) determineInitReason(previousBackendType string, currentBackendTyp
case cloud.ConfigChangeInPlace:
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Terraform Cloud initialization required: please run \"terraform init\"",
"Terraform Cloud initialization required: please run \"opentf init\"",
fmt.Sprintf(strings.TrimSpace(errBackendInitCloud), initReason),
))
case cloud.ConfigMigrationIn:
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Terraform Cloud initialization required: please run \"terraform init\"",
"Terraform Cloud initialization required: please run \"opentf init\"",
fmt.Sprintf(strings.TrimSpace(errBackendInitCloud), initReason),
))
default:
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Backend initialization required: please run \"terraform init\"",
"Backend initialization required: please run \"opentf init\"",
fmt.Sprintf(strings.TrimSpace(errBackendInit), initReason),
))
}
@ -818,7 +818,7 @@ func (m *Meta) backendFromState(ctx context.Context) (backend.Backend, tfdiags.D
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Failed to decode current backend config",
fmt.Sprintf("The backend configuration created by the most recent run of \"terraform init\" could not be decoded: %s. The configuration may have been initialized by an earlier version that used an incompatible configuration structure. Run \"terraform init -reconfigure\" to force re-initialization of the backend.", err),
fmt.Sprintf("The backend configuration created by the most recent run of \"opentf init\" could not be decoded: %s. The configuration may have been initialized by an earlier version that used an incompatible configuration structure. Run \"opentf init -reconfigure\" to force re-initialization of the backend.", err),
))
return nil, diags
}
@ -1275,7 +1275,7 @@ func (m *Meta) savedBackend(sMgr *clistate.LocalState) (backend.Backend, tfdiags
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Failed to decode current backend config",
fmt.Sprintf("The backend configuration created by the most recent run of \"terraform init\" could not be decoded: %s. The configuration may have been initialized by an earlier version that used an incompatible configuration structure. Run \"terraform init -reconfigure\" to force re-initialization of the backend.", err),
fmt.Sprintf("The backend configuration created by the most recent run of \"opentf init\" could not be decoded: %s. The configuration may have been initialized by an earlier version that used an incompatible configuration structure. Run \"opentf init -reconfigure\" to force re-initialization of the backend.", err),
))
return nil, diags
}
@ -1403,7 +1403,7 @@ func (m *Meta) backendInitFromConfig(c *configs.Backend) (backend.Backend, cty.V
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Unknown values within backend definition",
"The `terraform` configuration block should contain only concrete and static values. Another diagnostic should contain more information about which part of the configuration is problematic."))
"The `opentf` configuration block should contain only concrete and static values. Another diagnostic should contain more information about which part of the configuration is problematic."))
return nil, cty.NilVal, diags
}
@ -1550,8 +1550,8 @@ func (m *Meta) assertSupportedCloudInitOptions(mode cloud.ConfigChangeMode) tfdi
const errBackendLocalRead = `
Error reading local state: %s
Terraform is trying to read your local state to determine if there is
state to migrate to your newly configured backend. Terraform can't continue
OpenTF is trying to read your local state to determine if there is
state to migrate to your newly configured backend. OpenTF can't continue
without this check because that would risk losing state. Please resolve the
error above and try again.
`
@ -1569,19 +1569,19 @@ issue above and retry the command.
const errBackendNewUnknown = `
The backend %q could not be found.
This is the backend specified in your Terraform configuration file.
This is the backend specified in your OpenTF configuration file.
This error could be a simple typo in your configuration, but it can also
be caused by using a Terraform version that doesn't support the specified
backend type. Please check your configuration and your Terraform version.
be caused by using a OpenTF version that doesn't support the specified
backend type. Please check your configuration and your OpenTF version.
If you'd like to run Terraform and store state locally, you can fix this
If you'd like to run OpenTF and store state locally, you can fix this
error by removing the backend configuration from your configuration.
`
const errBackendNoExistingWorkspaces = `
No existing workspaces.
Use the "terraform workspace" command to create and select a new workspace.
Use the "opentf workspace" command to create and select a new workspace.
If the backend already contains existing workspaces, you may need to update
the backend configuration.
`
@ -1589,21 +1589,21 @@ the backend configuration.
const errBackendSavedUnknown = `
The backend %q could not be found.
This is the backend that this Terraform environment is configured to use
This is the backend that this OpenTF environment is configured to use
both in your configuration and saved locally as your last-used backend.
If it isn't found, it could mean an alternate version of Terraform was
used with this configuration. Please use the proper version of Terraform that
If it isn't found, it could mean an alternate version of OpenTF was
used with this configuration. Please use the proper version of OpenTF that
contains support for this backend.
If you'd like to force remove this backend, you must update your configuration
to not use the backend and run "terraform init" (or any other command) again.
to not use the backend and run "opentf init" (or any other command) again.
`
const errBackendClearSaved = `
Error clearing the backend configuration: %s
Terraform removes the saved backend configuration when you're removing a
configured backend. This must be done so future Terraform runs know to not
OpenTF removes the saved backend configuration when you're removing a
configured backend. This must be done so future OpenTF runs know to not
use the backend configuration. Please look at the error above, resolve it,
and try again.
`
@ -1611,14 +1611,14 @@ and try again.
const errBackendInit = `
Reason: %s
The "backend" is the interface that Terraform uses to store state,
The "backend" is the interface that OpenTF uses to store state,
perform operations, etc. If this message is showing up, it means that the
Terraform configuration you're using is using a custom configuration for
the Terraform backend.
OpenTF configuration you're using is using a custom configuration for
the OpenTF backend.
Changes to backend configurations require reinitialization. This allows
Terraform to set up the new configuration, copy existing state, etc. Please run
"terraform init" with either the "-reconfigure" or "-migrate-state" flags to
OpenTF to set up the new configuration, copy existing state, etc. Please run
"opentf init" with either the "-reconfigure" or "-migrate-state" flags to
use the current configuration.
If the change reason above is incorrect, please verify your configuration
@ -1632,50 +1632,50 @@ Reason: %s.
Changes to the Terraform Cloud configuration block require reinitialization, to discover any changes to the available workspaces.
To re-initialize, run:
terraform init
opentf init
Terraform has not yet made changes to your existing configuration or state.
OpenTF has not yet made changes to your existing configuration or state.
`
const errBackendWriteSaved = `
Error saving the backend configuration: %s
Terraform saves the complete backend configuration in a local file for
OpenTF saves the complete backend configuration in a local file for
configuring the backend on future operations. This cannot be disabled. Errors
are usually due to simple file permission errors. Please look at the error
above, resolve it, and try again.
`
const outputBackendMigrateChange = `
Terraform detected that the backend type changed from %q to %q.
OpenTF detected that the backend type changed from %q to %q.
`
const outputBackendMigrateLocal = `
Terraform has detected you're unconfiguring your previously set %q backend.
OpenTF has detected you're unconfiguring your previously set %q backend.
`
const outputBackendReconfigure = `
[reset][bold]Backend configuration changed![reset]
Terraform has detected that the configuration specified for the backend
has changed. Terraform will now check for existing state in the backends.
OpenTF has detected that the configuration specified for the backend
has changed. OpenTF will now check for existing state in the backends.
`
const inputCloudInitCreateWorkspace = `
There are no workspaces with the configured tags (%s)
in your Terraform Cloud organization. To finish initializing, Terraform needs at
in your Terraform Cloud organization. To finish initializing, OpenTF needs at
least one workspace available.
Terraform can create a properly tagged workspace for you now. Please enter a
OpenTF can create a properly tagged workspace for you now. Please enter a
name to create a new Terraform Cloud workspace.
`
const successBackendUnset = `
Successfully unset the backend %q. Terraform will now operate locally.
Successfully unset the backend %q. OpenTF will now operate locally.
`
const successBackendSet = `
Successfully configured the backend %q! Terraform will automatically
Successfully configured the backend %q! OpenTF will automatically
use this backend unless the backend configuration changes.
`
@ -1683,5 +1683,5 @@ var migrateOrReconfigDiag = tfdiags.Sourceless(
tfdiags.Error,
"Backend configuration changed",
"A change in the backend configuration has been detected, which may require migrating existing state.\n\n"+
"If you wish to attempt automatic migration of the state, use \"terraform init -migrate-state\".\n"+
`If you wish to store the current configuration with no changes to the state, use "terraform init -reconfigure".`)
"If you wish to attempt automatic migration of the state, use \"opentf init -migrate-state\".\n"+
`If you wish to store the current configuration with no changes to the state, use "opentf init -reconfigure".`)

View File

@ -941,9 +941,9 @@ const errMigrateLoadStates = `
Error inspecting states in the %q backend:
%s
Prior to changing backends, Terraform inspects the source and destination
Prior to changing backends, OpenTF inspects the source and destination
states to determine what kind of migration steps need to be taken, if any.
Terraform failed to load the states. The data in both the source and the
OpenTF failed to load the states. The data in both the source and the
destination remain unmodified. Please resolve the above error and try again.
`
@ -951,7 +951,7 @@ const errMigrateSingleLoadDefault = `
Error loading state:
%[2]s
Terraform failed to load the default state from the %[1]q backend.
OpenTF failed to load the default state from the %[1]q backend.
State migration cannot occur unless the state can be loaded. Backend
modification and state migration has been aborted. The state in both the
source and the destination remain unmodified. Please resolve the
@ -963,7 +963,7 @@ Error migrating the workspace %q from the previous %q backend
to the newly configured %q backend:
%s
Terraform copies workspaces in alphabetical order. Any workspaces
OpenTF copies workspaces in alphabetical order. Any workspaces
alphabetically earlier than this one have been copied. Any workspaces
later than this haven't been modified in the destination. No workspaces
in the source state have been modified.
@ -1002,7 +1002,7 @@ For example, if a workspace is currently named 'prod', the pattern 'app-*' would
`
const tfcInputBackendMigrateMultiToMulti = `
Unlike typical Terraform workspaces representing an environment associated with a particular
Unlike typical OpenTF workspaces representing an environment associated with a particular
configuration (e.g. production, staging, development), Terraform Cloud workspaces are named uniquely
across all configurations used within an organization. A typical strategy to start with is
<COMPONENT>-<ENVIRONMENT>-<REGION> (e.g. networking-prod-us-east, networking-staging-us-east).
@ -1027,7 +1027,7 @@ Enter "yes" to proceed or "no" to cancel.
`
const tfcInputBackendMigrateStateSingleToCloudSingle = `
As part of migrating to Terraform Cloud, Terraform can optionally copy your
As part of migrating to Terraform Cloud, OpenTF can optionally copy your
current workspace state to the configured Terraform Cloud workspace.
Answer "yes" to copy the latest state snapshot to the configured
@ -1036,15 +1036,15 @@ Terraform Cloud workspace.
Answer "no" to ignore the existing state and just activate the configured
Terraform Cloud workspace with its existing state, if any.
Should Terraform migrate your existing state?
Should OpenTF migrate your existing state?
`
const tfcInputBackendMigrateRemoteMultiToCloud = `
When migrating from the 'remote' backend to Terraform's native integration
with Terraform Cloud, Terraform will automatically create or use existing
When migrating from the 'remote' backend to OpenTF's native integration
with Terraform Cloud, OpenTF will automatically create or use existing
workspaces based on the previous backend configuration's 'prefix' value.
When the migration is complete, workspace names in Terraform will match the
When the migration is complete, workspace names in OpenTF will match the
fully qualified Terraform Cloud workspace name. If necessary, the workspace
tags configured in the 'cloud' option block will be added to the associated
Terraform Cloud workspaces.
@ -1095,24 +1095,24 @@ Enter "yes" to copy and "no" to start with the existing state in Terraform Cloud
const inputBackendMigrateMultiToSingle = `
The existing %[1]q backend supports workspaces and you currently are
using more than one. The newly configured %[2]q backend doesn't support
workspaces. If you continue, Terraform will copy your current workspace %[3]q
workspaces. If you continue, OpenTF will copy your current workspace %[3]q
to the default workspace in the new backend. Your existing workspaces in the
source backend won't be modified. If you want to switch workspaces, back them
up, or cancel altogether, answer "no" and Terraform will abort.
up, or cancel altogether, answer "no" and OpenTF will abort.
`
const inputBackendMigrateMultiToMulti = `
Both the existing %[1]q backend and the newly configured %[2]q backend
support workspaces. When migrating between backends, Terraform will copy
support workspaces. When migrating between backends, OpenTF will copy
all workspaces (with the same names). THIS WILL OVERWRITE any conflicting
states in the destination.
Terraform initialization doesn't currently migrate only select workspaces.
OpenTF initialization doesn't currently migrate only select workspaces.
If you want to migrate a select number of workspaces, you must manually
pull and push those states.
If you answer "yes", Terraform will migrate all states. If you answer
"no", Terraform will abort.
If you answer "yes", OpenTF will migrate all states. If you answer
"no", OpenTF will abort.
`
const inputBackendNewWorkspaceName = `

View File

@ -175,7 +175,7 @@ func (m *Meta) providerDevOverrideInitWarnings() tfdiags.Diagnostics {
for addr, path := range m.ProviderDevOverrides {
detailMsg.WriteString(fmt.Sprintf(" - %s in %s\n", addr.ForDisplay(), path))
}
detailMsg.WriteString("\nSkip terraform init when using provider development overrides. It is not necessary and may error unexpectedly.")
detailMsg.WriteString("\nSkip opentf init when using provider development overrides. It is not necessary and may error unexpectedly.")
return tfdiags.Diagnostics{
tfdiags.Sourceless(
tfdiags.Warning,

View File

@ -12,6 +12,7 @@ import (
"github.com/hashicorp/hcl/v2"
"github.com/hashicorp/hcl/v2/hclsyntax"
hcljson "github.com/hashicorp/hcl/v2/json"
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
@ -126,7 +127,7 @@ func (m *Meta) collectVariableValues() (map[string]backend.UnparsedVariableValue
default:
// Should never happen; always a bug in the code that built up
// the contents of m.variableArgs.
diags = diags.Append(fmt.Errorf("unsupported variable option name %q (this is a bug in Terraform)", rawFlag.Name))
diags = diags.Append(fmt.Errorf("unsupported variable option name %q (this is a bug in OpenTF)", rawFlag.Name))
}
}

View File

@ -21,7 +21,7 @@ func (c *MetadataCommand) Run(args []string) int {
func (c *MetadataCommand) Help() string {
helpText := `
Usage: terraform [global options] metadata <subcommand> [options] [args]
Usage: opentf [global options] metadata <subcommand> [options] [args]
This command has subcommands for metadata related purposes.

View File

@ -6,9 +6,10 @@ package command
import (
"fmt"
"github.com/zclconf/go-cty/cty/function"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/jsonfunction"
"github.com/placeholderplaceholderplaceholder/opentf/internal/lang"
"github.com/zclconf/go-cty/cty/function"
)
var (
@ -43,7 +44,7 @@ func (c *MetadataFunctionsCommand) Run(args []string) int {
if !jsonOutput {
c.Ui.Error(
"The `terraform metadata functions` command requires the `-json` flag.\n")
"The `opentf metadata functions` command requires the `-json` flag.\n")
cmdFlags.Usage()
return 1
}
@ -69,7 +70,7 @@ func (c *MetadataFunctionsCommand) Run(args []string) int {
}
const metadataFunctionsCommandHelp = `
Usage: terraform [global options] metadata functions -json
Usage: opentf [global options] metadata functions -json
Prints out a json representation of the available function signatures.
`

View File

@ -95,9 +95,9 @@ func (c *OutputCommand) Outputs(statePath string) (map[string]*states.OutputValu
func (c *OutputCommand) Help() string {
helpText := `
Usage: terraform [global options] output [options] [NAME]
Usage: opentf [global options] output [options] [NAME]
Reads an output variable from a Terraform state file and prints
Reads an output variable from a OpenTF state file and prints
the value. With no additional arguments, output will display all
the outputs for the root module. If NAME is not specified, all
outputs are printed.

View File

@ -195,9 +195,9 @@ func (c *PlanCommand) GatherVariables(opReq *backend.Operation, args *arguments.
func (c *PlanCommand) Help() string {
helpText := `
Usage: terraform [global options] plan [options]
Usage: opentf [global options] plan [options]
Generates a speculative execution plan, showing what actions Terraform
Generates a speculative execution plan, showing what actions OpenTF
would take to apply the current configuration. This command will not
actually perform the planned actions.
@ -206,18 +206,18 @@ Usage: terraform [global options] plan [options]
Plan Customization Options:
The following options customize how Terraform will produce its plan. You
can also use these options when you run "terraform apply" without passing
The following options customize how OpenTF will produce its plan. You
can also use these options when you run "opentf apply" without passing
it a saved plan, in order to plan and apply in a single command.
-destroy Select the "destroy" planning mode, which creates a plan
to destroy all objects currently managed by this
Terraform configuration instead of the usual behavior.
OpenTF configuration instead of the usual behavior.
-refresh-only Select the "refresh only" planning mode, which checks
whether remote objects still match the outcome of the
most recent Terraform apply but does not propose any
actions to undo any changes made outside of Terraform.
most recent OpenTF apply but does not propose any
actions to undo any changes made outside of OpenTF.
-refresh=false Skip checking for external changes to remote objects
while creating the plan. This can potentially make
@ -227,7 +227,7 @@ Plan Customization Options:
-replace=resource Force replacement of a particular resource instance using
its resource address. If the plan would've normally
produced an update or no-op action for this instance,
Terraform will plan to replace it instead. You can use
OpenTF will plan to replace it instead. You can use
this option multiple times to replace more than one object.
-target=resource Limit the planning operation to only the given module,
@ -247,7 +247,7 @@ Plan Customization Options:
Other Options:
-compact-warnings If Terraform produces any warnings that are not
-compact-warnings If OpenTF produces any warnings that are not
accompanied by errors, shows them in a more compact
form that includes only the summary messages.
@ -258,10 +258,10 @@ Other Options:
2 - Succeeded, there is a diff
-generate-config-out=path (Experimental) If import blocks are present in
configuration, instructs Terraform to generate HCL
configuration, instructs OpenTF to generate HCL
for any imported resources not already present. The
configuration is written to a new file at PATH,
which must not already exist. Terraform may still
which must not already exist. OpenTF may still
attempt to write configuration if the plan errors.
-input=true Ask for input for variables if not directly set.

View File

@ -54,7 +54,7 @@ func (c *ProvidersCommand) Run(args []string) int {
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Error validating configuration directory",
fmt.Sprintf("Terraform encountered an unexpected error while verifying that the given configuration directory is valid: %s.", err),
fmt.Sprintf("OpenTF encountered an unexpected error while verifying that the given configuration directory is valid: %s.", err),
))
c.showDiagnostics(diags)
return 1
@ -67,7 +67,7 @@ func (c *ProvidersCommand) Run(args []string) int {
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"No configuration files",
fmt.Sprintf("The directory %s contains no Terraform configuration files.", absPath),
fmt.Sprintf("The directory %s contains no OpenTF configuration files.", absPath),
))
c.showDiagnostics(diags)
return 1
@ -175,7 +175,7 @@ func (c *ProvidersCommand) populateTreeNode(tree treeprint.Tree, node *configs.M
}
const providersCommandHelp = `
Usage: terraform [global options] providers [options] [DIR]
Usage: opentf [global options] providers [options] [DIR]
Prints out a tree of modules in the referenced configuration annotated with
their provider requirements.
@ -186,5 +186,5 @@ Usage: terraform [global options] providers [options] [DIR]
Options:
-test-directory=path Set the Terraform test directory, defaults to "tests".
-test-directory=path Set the OpenTF test directory, defaults to "tests".
`

View File

@ -223,7 +223,7 @@ func (c *ProvidersLockCommand) Run(args []string) int {
tfdiags.Error,
"Inconsistent provider versions",
fmt.Sprintf(
"The version constraint for %s selected inconsistent versions for different platforms, which is unexpected.\n\nThe upstream registry may have changed its available versions during Terraform's work. If so, re-running this command may produce a successful result.",
"The version constraint for %s selected inconsistent versions for different platforms, which is unexpected.\n\nThe upstream registry may have changed its available versions during OpenTF's work. If so, re-running this command may produce a successful result.",
provider,
),
))
@ -251,7 +251,7 @@ func (c *ProvidersLockCommand) Run(args []string) int {
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Could not retrieve providers for locking",
fmt.Sprintf("Terraform failed to fetch the requested providers for %s in order to calculate their checksums: %s.", platform, err),
fmt.Sprintf("OpenTF failed to fetch the requested providers for %s in order to calculate their checksums: %s.", platform, err),
))
break
}
@ -338,20 +338,20 @@ func (c *ProvidersLockCommand) Run(args []string) int {
}
if madeAnyChange {
c.Ui.Output(c.Colorize().Color("\n[bold][green]Success![reset] [bold]Terraform has updated the lock file.[reset]"))
c.Ui.Output(c.Colorize().Color("\n[bold][green]Success![reset] [bold]OpenTF has updated the lock file.[reset]"))
c.Ui.Output("\nReview the changes in .terraform.lock.hcl and then commit to your\nversion control system to retain the new checksums.\n")
} else {
c.Ui.Output(c.Colorize().Color("\n[bold][green]Success![reset] [bold]Terraform has validated the lock file and found no need for changes.[reset]"))
c.Ui.Output(c.Colorize().Color("\n[bold][green]Success![reset] [bold]OpenTF has validated the lock file and found no need for changes.[reset]"))
}
return 0
}
func (c *ProvidersLockCommand) Help() string {
return `
Usage: terraform [global options] providers lock [options] [providers...]
Usage: opentf [global options] providers lock [options] [providers...]
Normally the dependency lock file (.terraform.lock.hcl) is updated
automatically by "terraform init", but the information available to the
automatically by "opentf init", but the information available to the
normal provider installer can be constrained when you're installing providers
from filesystem or network mirrors, and so the generated lock file can end
up incomplete.
@ -376,7 +376,7 @@ Options:
This would be necessary to generate lock file entries for
a provider that is available only via a mirror, and not
published in an upstream registry. In this case, the set
of valid checksums will be limited only to what Terraform
of valid checksums will be limited only to what OpenTF
can learn from the data in the mirror directory.
-net-mirror=url Consult the given network mirror (given as a base URL)
@ -386,13 +386,13 @@ Options:
This would be necessary to generate lock file entries for
a provider that is available only via a mirror, and not
published in an upstream registry. In this case, the set
of valid checksums will be limited only to what Terraform
of valid checksums will be limited only to what OpenTF
can learn from the data in the mirror indices.
-platform=os_arch Choose a target platform to request package checksums
for.
By default Terraform will request package checksums
By default OpenTF will request package checksums
suitable only for the platform where you run this
command. Use this option multiple times to include
checksums for multiple target systems.

View File

@ -12,6 +12,7 @@ import (
"testing"
"github.com/mitchellh/cli"
"github.com/placeholderplaceholderplaceholder/opentf/internal/addrs"
"github.com/placeholderplaceholderplaceholder/opentf/internal/depsfile"
"github.com/placeholderplaceholderplaceholder/opentf/internal/getproviders"

View File

@ -13,6 +13,7 @@ import (
"github.com/apparentlymart/go-versions/versions"
"github.com/hashicorp/go-getter"
"github.com/placeholderplaceholderplaceholder/opentf/internal/getproviders"
"github.com/placeholderplaceholderplaceholder/opentf/internal/httpclient"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
@ -99,7 +100,7 @@ func (c *ProvidersMirrorCommand) Run(args []string) int {
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Inconsistent dependency lock file",
fmt.Sprintf("To update the locked dependency selections to match a changed configuration, run:\n terraform init -upgrade\n got:%v", errs),
fmt.Sprintf("To update the locked dependency selections to match a changed configuration, run:\n opentf init -upgrade\n got:%v", errs),
))
}
}
@ -138,7 +139,7 @@ func (c *ProvidersMirrorCommand) Run(args []string) int {
for provider, constraints := range reqs {
if provider.IsBuiltIn() {
c.Ui.Output(fmt.Sprintf("- Skipping %s because it is built in to Terraform CLI", provider.ForDisplay()))
c.Ui.Output(fmt.Sprintf("- Skipping %s because it is built in to OpenTF CLI", provider.ForDisplay()))
continue
}
constraintsStr := getproviders.VersionConstraintsString(constraints)
@ -187,7 +188,7 @@ func (c *ProvidersMirrorCommand) Run(args []string) int {
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Provider release not available",
fmt.Sprintf("Failed to download %s v%s for %s: Terraform's provider registry client returned unexpected location type %T. This is a bug in Terraform.", provider.String(), selected.String(), platform.String(), meta.Location),
fmt.Sprintf("Failed to download %s v%s for %s: OpenTF's provider registry client returned unexpected location type %T. This is a bug in OpenTF.", provider.String(), selected.String(), platform.String(), meta.Location),
))
continue
}
@ -353,7 +354,7 @@ func (c *ProvidersMirrorCommand) Run(args []string) int {
func (c *ProvidersMirrorCommand) Help() string {
return `
Usage: terraform [global options] providers mirror [options] <target-dir>
Usage: opentf [global options] providers mirror [options] <target-dir>
Populates a local directory with copies of the provider plugins needed for
the current configuration, so that the directory can be used either directly
@ -368,7 +369,7 @@ Usage: terraform [global options] providers mirror [options] <target-dir>
Options:
-platform=os_arch Choose which target platform to build a mirror for.
By default Terraform will obtain plugin packages
By default OpenTF will obtain plugin packages
suitable for the platform where you run this command.
Use this flag multiple times to include packages for
multiple target systems.

View File

@ -41,7 +41,7 @@ func (c *ProvidersSchemaCommand) Run(args []string) int {
if !jsonOutput {
c.Ui.Error(
"The `terraform providers schema` command requires the `-json` flag.\n")
"The `opentf providers schema` command requires the `-json` flag.\n")
cmdFlags.Usage()
return 1
}
@ -118,7 +118,7 @@ func (c *ProvidersSchemaCommand) Run(args []string) int {
}
const providersSchemaCommandHelp = `
Usage: terraform [global options] providers schema -json
Usage: opentf [global options] providers schema -json
Prints out a json representation of the schemas for all providers used
in the current configuration.

View File

@ -18,7 +18,7 @@ func (c *PushCommand) Run(args []string) int {
// give the user some next-steps after upgrading.
c.showDiagnostics(tfdiags.Sourceless(
tfdiags.Error,
"Command \"terraform push\" is no longer supported",
"Command \"opentf push\" is no longer supported",
"This command was used to push configuration to Terraform Enterprise legacy (v1), which has now reached end-of-life. To push configuration to a new cloud backend, use its REST API.",
))
return 1
@ -26,7 +26,7 @@ func (c *PushCommand) Run(args []string) int {
func (c *PushCommand) Help() string {
helpText := `
Usage: terraform [global options] push [options] [DIR]
Usage: opentf [global options] push [options] [DIR]
This command was for the legacy version of Terraform Enterprise (v1), which
has now reached end-of-life. Therefore this command is no longer supported.

View File

@ -181,7 +181,7 @@ func (c *RefreshCommand) GatherVariables(opReq *backend.Operation, args *argumen
func (c *RefreshCommand) Help() string {
helpText := `
Usage: terraform [global options] refresh [options]
Usage: opentf [global options] refresh [options]
Update the state file of your infrastructure with metadata that matches
the physical resources they are tracking.
@ -192,7 +192,7 @@ Usage: terraform [global options] refresh [options]
Options:
-compact-warnings If Terraform produces any warnings that are not
-compact-warnings If OpenTF produces any warnings that are not
accompanied by errors, show them in a more compact form
that includes only the summary messages.
@ -212,10 +212,10 @@ Options:
resource and its dependencies. This flag can be used
multiple times.
-var 'foo=bar' Set a variable in the Terraform configuration. This
-var 'foo=bar' Set a variable in the OpenTF configuration. This
flag can be set multiple times.
-var-file=foo Set variables in the Terraform configuration from
-var-file=foo Set variables in the OpenTF configuration from
a file. If "terraform.tfvars" or any ".auto.tfvars"
files are present, they will be automatically loaded.

View File

@ -88,15 +88,15 @@ func (c *ShowCommand) Run(rawArgs []string) int {
func (c *ShowCommand) Help() string {
helpText := `
Usage: terraform [global options] show [options] [path]
Usage: opentf [global options] show [options] [path]
Reads and outputs a Terraform state or plan file in a human-readable
Reads and outputs a OpenTF state or plan file in a human-readable
form. If no path is specified, the current state will be shown.
Options:
-no-color If specified, output won't contain any color.
-json If specified, output the Terraform plan or state in
-json If specified, output the OpenTF plan or state in
a machine-readable form.
`

View File

@ -13,6 +13,8 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/mitchellh/cli"
"github.com/zclconf/go-cty/cty"
"github.com/placeholderplaceholderplaceholder/opentf/internal/addrs"
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema"
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
@ -21,7 +23,6 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/version"
"github.com/zclconf/go-cty/cty"
)
func TestShow_badArgs(t *testing.T) {
@ -594,7 +595,7 @@ func TestShow_json_output(t *testing.T) {
}
args := []string{
"-out=terraform.plan",
"-out=opentf.plan",
}
code := pc.Run(args)
@ -623,9 +624,9 @@ func TestShow_json_output(t *testing.T) {
args = []string{
"-json",
"terraform.plan",
"opentf.plan",
}
defer os.Remove("terraform.plan")
defer os.Remove("opentf.plan")
code = sc.Run(args)
showOutput := showDone(t)
@ -684,7 +685,7 @@ func TestShow_json_output_sensitive(t *testing.T) {
}
args := []string{
"-out=terraform.plan",
"-out=opentf.plan",
}
code := pc.Run(args)
planOutput := planDone(t)
@ -705,9 +706,9 @@ func TestShow_json_output_sensitive(t *testing.T) {
args = []string{
"-json",
"terraform.plan",
"opentf.plan",
}
defer os.Remove("terraform.plan")
defer os.Remove("opentf.plan")
code = sc.Run(args)
showOutput := showDone(t)
@ -778,7 +779,7 @@ func TestShow_json_output_conditions_refresh_only(t *testing.T) {
args := []string{
"-refresh-only",
"-out=terraform.plan",
"-out=opentf.plan",
"-var=ami=bad-ami",
"-state=for-refresh.tfstate",
}
@ -801,9 +802,9 @@ func TestShow_json_output_conditions_refresh_only(t *testing.T) {
args = []string{
"-json",
"terraform.plan",
"opentf.plan",
}
defer os.Remove("terraform.plan")
defer os.Remove("opentf.plan")
code = sc.Run(args)
showOutput := showDone(t)

View File

@ -21,11 +21,11 @@ func (c *StateCommand) Run(args []string) int {
func (c *StateCommand) Help() string {
helpText := `
Usage: terraform [global options] state <subcommand> [options] [args]
Usage: opentf [global options] state <subcommand> [options] [args]
This command has subcommands for advanced state management.
These subcommands can be used to slice and dice the Terraform state.
These subcommands can be used to slice and dice the OpenTF state.
This is sometimes necessary in advanced cases. For your safety, all
state management commands that modify the state create a timestamped
backup of the state prior to making modifications.

View File

@ -8,6 +8,7 @@ import (
"strings"
"github.com/mitchellh/cli"
"github.com/placeholderplaceholderplaceholder/opentf/internal/addrs"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
@ -95,11 +96,11 @@ func (c *StateListCommand) Run(args []string) int {
func (c *StateListCommand) Help() string {
helpText := `
Usage: terraform [global options] state list [options] [address...]
Usage: opentf [global options] state list [options] [address...]
List resources in the Terraform state.
List resources in the OpenTF state.
This command lists resource instances in the Terraform state. The address
This command lists resource instances in the OpenTF state. The address
argument can be used to filter the instances by resource or module. If
no pattern is given, all resource instances are listed.
@ -115,8 +116,8 @@ Usage: terraform [global options] state list [options] [address...]
Options:
-state=statefile Path to a Terraform state file to use to look
up Terraform-managed resources. By default, Terraform
-state=statefile Path to a OpenTF state file to use to look
up OpenTF-managed resources. By default, OpenTF
will consult the state of the currently-selected
workspace.
@ -134,12 +135,12 @@ func (c *StateListCommand) Synopsis() string {
const errStateLoadingState = `Error loading the state: %[1]s
Please ensure that your Terraform state exists and that you've
Please ensure that your OpenTF state exists and that you've
configured it properly. You can use the "-state" flag to point
Terraform at another state file.`
OpenTF at another state file.`
const errStateNotFound = `No state file was found!
State management commands require a state file. Run this command
in a directory where Terraform has been run or use the -state flag
in a directory where OpenTF has been run or use the -state flag
to point the command to a specific state location.`

View File

@ -49,7 +49,7 @@ func (c *StateMeta) State() (statemgr.Full, error) {
remoteVersionDiags := c.remoteVersionCheck(b, workspace)
c.showDiagnostics(remoteVersionDiags)
if remoteVersionDiags.HasErrors() {
return nil, fmt.Errorf("Error checking remote Terraform version")
return nil, fmt.Errorf("Error checking remote OpenTF version")
}
// Get the state
@ -128,7 +128,7 @@ func (c *StateMeta) lookupResourceInstanceAddr(state *states.State, allowMissing
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Unknown module",
fmt.Sprintf(`The current state contains no module at %s. If you've just added this module to the configuration, you must run "terraform apply" first to create the module's entry in the state.`, addr),
fmt.Sprintf(`The current state contains no module at %s. If you've just added this module to the configuration, you must run "opentf apply" first to create the module's entry in the state.`, addr),
))
}
@ -140,7 +140,7 @@ func (c *StateMeta) lookupResourceInstanceAddr(state *states.State, allowMissing
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Unknown resource",
fmt.Sprintf(`The current state contains no resource %s. If you've just added this resource to the configuration, you must run "terraform apply" first to create the resource's entry in the state.`, addr),
fmt.Sprintf(`The current state contains no resource %s. If you've just added this resource to the configuration, you must run "opentf apply" first to create the resource's entry in the state.`, addr),
))
}
break
@ -153,7 +153,7 @@ func (c *StateMeta) lookupResourceInstanceAddr(state *states.State, allowMissing
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Unknown resource instance",
fmt.Sprintf(`The current state contains no resource instance %s. If you've just added its resource to the configuration or have changed the count or for_each arguments, you must run "terraform apply" first to update the resource's entry in the state.`, addr),
fmt.Sprintf(`The current state contains no resource instance %s. If you've just added its resource to the configuration or have changed the count or for_each arguments, you must run "opentf apply" first to update the resource's entry in the state.`, addr),
))
}
break

View File

@ -8,6 +8,7 @@ import (
"strings"
"github.com/mitchellh/cli"
"github.com/placeholderplaceholderplaceholder/opentf/internal/addrs"
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/arguments"
@ -355,7 +356,7 @@ func (c *StateMvCommand) Run(args []string) int {
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
msgInvalidSource,
fmt.Sprintf("Cannot move %s: Terraform doesn't know how to move this object.", rawAddrFrom),
fmt.Sprintf("Cannot move %s: OpenTF doesn't know how to move this object.", rawAddrFrom),
))
}
@ -518,7 +519,7 @@ func (c *StateMvCommand) validateResourceMove(addrFrom, addrTo addrs.AbsResource
func (c *StateMvCommand) Help() string {
helpText := `
Usage: terraform [global options] state mv [options] SOURCE DESTINATION
Usage: opentf [global options] state mv [options] SOURCE DESTINATION
This command will move an item matched by the address given to the
destination address. This command can also move to a destination address
@ -527,7 +528,7 @@ Usage: terraform [global options] state mv [options] SOURCE DESTINATION
This can be used for simple resource renaming, moving items to and from
a module, moving entire modules, and more. And because this command can also
move data to a completely new state, it can also be used for refactoring
one configuration into multiple separately managed Terraform configurations.
one configuration into multiple separately managed OpenTF configurations.
This command will output a backup copy of the state prior to saving any
changes. The backup cannot be disabled. Due to the destructive nature

View File

@ -76,13 +76,13 @@ func (c *StatePullCommand) Run(args []string) int {
func (c *StatePullCommand) Help() string {
helpText := `
Usage: terraform [global options] state pull [options]
Usage: opentf [global options] state pull [options]
Pull the state from its location, upgrade the local copy, and output it
to stdout.
This command "pulls" the current state and outputs it to stdout.
As part of this process, Terraform will upgrade the state format of the
As part of this process, OpenTF will upgrade the state format of the
local copy to the current version.
The primary use of this is for state stored remotely. This command

View File

@ -10,6 +10,7 @@ import (
"strings"
"github.com/mitchellh/cli"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/arguments"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/clistate"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views"
@ -154,7 +155,7 @@ func (c *StatePushCommand) Run(args []string) int {
func (c *StatePushCommand) Help() string {
helpText := `
Usage: terraform [global options] state push [options] PATH
Usage: opentf [global options] state push [options] PATH
Update remote state from a local state file at PATH.

View File

@ -8,6 +8,7 @@ import (
"strings"
"github.com/mitchellh/cli"
"github.com/placeholderplaceholderplaceholder/opentf/internal/addrs"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/arguments"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/clistate"
@ -132,7 +133,7 @@ func (c *StateReplaceProviderCommand) Run(args []string) int {
// Explain the changes
colorize := c.Colorize()
c.Ui.Output("Terraform will perform the following actions:\n")
c.Ui.Output("OpenTF will perform the following actions:\n")
c.Ui.Output(colorize.Color(" [yellow]~[reset] Updating provider:"))
c.Ui.Output(colorize.Color(fmt.Sprintf(" [red]-[reset] %s", from)))
c.Ui.Output(colorize.Color(fmt.Sprintf(" [green]+[reset] %s\n", to)))
@ -196,9 +197,9 @@ func (c *StateReplaceProviderCommand) Run(args []string) int {
func (c *StateReplaceProviderCommand) Help() string {
helpText := `
Usage: terraform [global options] state replace-provider [options] FROM_PROVIDER_FQN TO_PROVIDER_FQN
Usage: opentf [global options] state replace-provider [options] FROM_PROVIDER_FQN TO_PROVIDER_FQN
Replace provider for resources in the Terraform state.
Replace provider for resources in the OpenTF state.
Options:

View File

@ -288,7 +288,7 @@ func TestStateReplaceProvider(t *testing.T) {
func TestStateReplaceProvider_docs(t *testing.T) {
c := &StateReplaceProviderCommand{}
if got, want := c.Help(), "Usage: terraform [global options] state replace-provider"; !strings.Contains(got, want) {
if got, want := c.Help(), "Usage: opentf [global options] state replace-provider"; !strings.Contains(got, want) {
t.Fatalf("unexpected help text\nwant: %s\nfull output:\n%s", want, got)
}

View File

@ -8,6 +8,7 @@ import (
"strings"
"github.com/mitchellh/cli"
"github.com/placeholderplaceholderplaceholder/opentf/internal/addrs"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/arguments"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/clistate"
@ -146,7 +147,7 @@ func (c *StateRmCommand) Run(args []string) int {
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Invalid target address",
"No matching objects found. To view the available instances, use \"terraform state list\". Please modify the address to reference a specific instance.",
"No matching objects found. To view the available instances, use \"opentf state list\". Please modify the address to reference a specific instance.",
))
c.showDiagnostics(diags)
return 1
@ -158,14 +159,14 @@ func (c *StateRmCommand) Run(args []string) int {
func (c *StateRmCommand) Help() string {
helpText := `
Usage: terraform [global options] state rm [options] ADDRESS...
Usage: opentf [global options] state rm [options] ADDRESS...
Remove one or more items from the Terraform state, causing Terraform to
Remove one or more items from the OpenTF state, causing OpenTF to
"forget" those items without first destroying them in the remote system.
This command removes one or more resource instances from the Terraform state
This command removes one or more resource instances from the OpenTF state
based on the addresses given. You can view and list the available instances
with "terraform state list".
with "opentf state list".
If you give the address of an entire module then all of the instances in
that module and any of its child modules will be removed from the state.
@ -178,7 +179,7 @@ Options:
-dry-run If set, prints out what would've been removed but
doesn't actually remove anything.
-backup=PATH Path where Terraform should write the backup
-backup=PATH Path where OpenTF should write the backup
state.
-lock=false Don't hold a state lock during the operation. This is
@ -190,7 +191,7 @@ Options:
-state=PATH Path to the state file to update. Defaults to the
current workspace state.
-ignore-remote-version Continue even if remote and local Terraform versions
-ignore-remote-version Continue even if remote and local OpenTF versions
are incompatible. This may result in an unusable
workspace, and should be used with extreme caution.

View File

@ -9,6 +9,7 @@ import (
"strings"
"github.com/mitchellh/cli"
"github.com/placeholderplaceholderplaceholder/opentf/internal/addrs"
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/arguments"
@ -169,18 +170,18 @@ func (c *StateShowCommand) Run(args []string) int {
func (c *StateShowCommand) Help() string {
helpText := `
Usage: terraform [global options] state show [options] ADDRESS
Usage: opentf [global options] state show [options] ADDRESS
Shows the attributes of a resource in the Terraform state.
Shows the attributes of a resource in the OpenTF state.
This command shows the attributes of a single resource in the Terraform
This command shows the attributes of a single resource in the OpenTF
state. The address argument must be used to specify a single resource.
You can view the list of available resources with "terraform state list".
You can view the list of available resources with "opentf state list".
Options:
-state=statefile Path to a Terraform state file to use to look
up Terraform-managed resources. By default it will
-state=statefile Path to a OpenTF state file to use to look
up OpenTF-managed resources. By default it will
use the state "terraform.tfstate" if it exists.
`
@ -194,11 +195,11 @@ func (c *StateShowCommand) Synopsis() string {
const errNoInstanceFound = `No instance found for the given address!
This command requires that the address references one specific instance.
To view the available instances, use "terraform state list". Please modify
To view the available instances, use "opentf state list". Please modify
the address to reference a specific instance.`
const errParsingAddress = `Error parsing instance address: %s
This command requires that the address references one specific instance.
To view the available instances, use "terraform state list". Please modify
To view the available instances, use "opentf state list". Please modify
the address to reference a specific instance.`

View File

@ -150,7 +150,7 @@ func (c *TaintCommand) Run(args []string) int {
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"No such resource instance",
fmt.Sprintf("There is no resource instance in the state with the address %s. If the resource configuration has just been added, you must run \"terraform apply\" once to create the corresponding instance(s) before they can be tainted.", addr),
fmt.Sprintf("There is no resource instance in the state with the address %s. If the resource configuration has just been added, you must run \"opentf apply\" once to create the corresponding instance(s) before they can be tainted.", addr),
))
c.showDiagnostics(diags)
return 1
@ -162,7 +162,7 @@ func (c *TaintCommand) Run(args []string) int {
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"No such resource instance",
fmt.Sprintf("Resource instance %s is currently part-way through a create_before_destroy replacement action. Run \"terraform apply\" to complete its replacement before tainting it.", addr),
fmt.Sprintf("Resource instance %s is currently part-way through a create_before_destroy replacement action. Run \"opentf apply\" to complete its replacement before tainting it.", addr),
))
} else {
// Don't know why we're here, but we'll produce a generic error message anyway.
@ -195,19 +195,19 @@ func (c *TaintCommand) Run(args []string) int {
func (c *TaintCommand) Help() string {
helpText := `
Usage: terraform [global options] taint [options] <address>
Usage: opentf [global options] taint [options] <address>
Terraform uses the term "tainted" to describe a resource instance
OpenTF uses the term "tainted" to describe a resource instance
which may not be fully functional, either because its creation
partially failed or because you've manually marked it as such using
this command.
This will not modify your infrastructure directly, but subsequent
Terraform plans will include actions to destroy the remote object
OpenTF plans will include actions to destroy the remote object
and create a new object to replace it.
You can remove the "taint" state from a resource instance using
the "terraform untaint" command.
the "opentf untaint" command.
The address is in the usual resource address syntax, such as:
aws_instance.foo
@ -215,7 +215,7 @@ Usage: terraform [global options] taint [options] <address>
module.foo.module.bar.aws_instance.baz
Use your shell's quoting or escaping syntax to ensure that the
address will reach Terraform correctly, without any special
address will reach OpenTF correctly, without any special
interpretation.
Options:

View File

@ -36,13 +36,13 @@ type TestCommand struct {
func (c *TestCommand) Help() string {
helpText := `
Usage: terraform [global options] test [options]
Usage: opentf [global options] test [options]
Executes automated integration tests against the current Terraform
Executes automated integration tests against the current OpenTF
configuration.
Terraform will search for .tftest.hcl files within the current configuration
and testing directories. Terraform will then execute the testing run blocks
OpenTF will search for .tftest.hcl files within the current configuration
and testing directories. OpenTF will then execute the testing run blocks
within any testing files in order, and verify conditional checks and
assertions against the created infrastructure.
@ -52,7 +52,7 @@ Usage: terraform [global options] test [options]
Options:
-filter=testfile If specified, Terraform will only execute the test files
-filter=testfile If specified, OpenTF will only execute the test files
specified by this flag. You can use this option multiple
times to execute more than one test file.
@ -61,7 +61,7 @@ Options:
-no-color If specified, output won't contain any color.
-test-directory=path Set the Terraform test directory, defaults to "tests".
-test-directory=path Set the OpenTF test directory, defaults to "tests".
-var 'foo=bar' Set a value for one of the input variables in the root
module of the configuration. Use this option more than
@ -79,7 +79,7 @@ Options:
}
func (c *TestCommand) Synopsis() string {
return "Execute integration tests for Terraform modules"
return "Execute integration tests for OpenTF modules"
}
func (c *TestCommand) Run(rawArgs []string) int {
@ -415,7 +415,7 @@ func (runner *TestFileRunner) ExecuteTestFile(file *moduletest.File) {
run.Diagnostics = run.Diagnostics.Append(&hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: "Invalid module source",
Detail: fmt.Sprintf("The source for the selected module evaluated to %s which should not be possible. This is a bug in Terraform - please report it!", key),
Detail: fmt.Sprintf("The source for the selected module evaluated to %s which should not be possible. This is a bug in OpenTF - please report it!", key),
Subject: run.Config.Module.DeclRange.Ptr(),
})
@ -519,7 +519,7 @@ func (runner *TestFileRunner) ExecuteTestRun(run *moduletest.Run, file *modulete
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Warning,
"Failed to print verbose output",
fmt.Sprintf("Terraform failed to print the verbose output for %s, other diagnostics will contain more details as to why.", path.Join(file.Name, run.Name))))
fmt.Sprintf("OpenTF failed to print the verbose output for %s, other diagnostics will contain more details as to why.", path.Join(file.Name, run.Name))))
} else {
run.Verbose = &moduletest.Verbose{
Plan: plan,
@ -592,7 +592,7 @@ func (runner *TestFileRunner) ExecuteTestRun(run *moduletest.Run, file *modulete
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Warning,
"Failed to print verbose output",
fmt.Sprintf("Terraform failed to print the verbose output for %s, other diagnostics will contain more details as to why.", path.Join(file.Name, run.Name))))
fmt.Sprintf("OpenTF failed to print the verbose output for %s, other diagnostics will contain more details as to why.", path.Join(file.Name, run.Name))))
} else {
run.Verbose = &moduletest.Verbose{
Plan: plan,
@ -909,7 +909,7 @@ func (runner *TestFileRunner) Cleanup(file *moduletest.File) {
if main.Run == nil {
if !main.State.Empty() {
log.Printf("[ERROR] TestFileRunner: found inconsistent run block and state file in %s", file.Name)
diags = diags.Append(tfdiags.Sourceless(tfdiags.Error, "Inconsistent state", fmt.Sprintf("Found inconsistent state while cleaning up %s. This is a bug in Terraform - please report it", file.Name)))
diags = diags.Append(tfdiags.Sourceless(tfdiags.Error, "Inconsistent state", fmt.Sprintf("Found inconsistent state while cleaning up %s. This is a bug in OpenTF - please report it", file.Name)))
}
} else {
reset, configDiags := runner.Suite.Config.TransformForTest(main.Run.Config, file.Config)
@ -952,7 +952,7 @@ func (runner *TestFileRunner) Cleanup(file *moduletest.File) {
// print a diagnostic instead of panicking later.
var diags tfdiags.Diagnostics
diags = diags.Append(tfdiags.Sourceless(tfdiags.Error, "Inconsistent state", fmt.Sprintf("Found inconsistent state while cleaning up %s. This is a bug in Terraform - please report it", file.Name)))
diags = diags.Append(tfdiags.Sourceless(tfdiags.Error, "Inconsistent state", fmt.Sprintf("Found inconsistent state while cleaning up %s. This is a bug in OpenTF - please report it", file.Name)))
runner.Suite.View.DestroySummary(diags, nil, file, state.State)
continue
}

View File

@ -11,6 +11,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
"github.com/mitchellh/cli"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
@ -89,8 +90,8 @@ func (c *UnlockCommand) Run(args []string) int {
return 1
}
desc := "Terraform will remove the lock on the remote state.\n" +
"This will allow local Terraform commands to modify this state, even though it\n" +
desc := "OpenTF will remove the lock on the remote state.\n" +
"This will allow local OpenTF commands to modify this state, even though it\n" +
"may still be in use. Only 'yes' will be accepted to confirm."
v, err := c.UIInput().Input(context.Background(), &terraform.InputOpts{
@ -119,7 +120,7 @@ func (c *UnlockCommand) Run(args []string) int {
func (c *UnlockCommand) Help() string {
helpText := `
Usage: terraform [global options] force-unlock LOCK_ID
Usage: opentf [global options] force-unlock LOCK_ID
Manually unlock the state for the defined configuration.
@ -140,8 +141,8 @@ func (c *UnlockCommand) Synopsis() string {
}
const outputUnlockSuccess = `
[reset][bold][green]Terraform state has been successfully unlocked![reset][green]
[reset][bold][green]OpenTF state has been successfully unlocked![reset][green]
The state has been unlocked, and Terraform commands should now be able to
The state has been unlocked, and OpenTF commands should now be able to
obtain a new lock on the remote state.
`

View File

@ -132,7 +132,7 @@ func (c *UntaintCommand) Run(args []string) int {
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"No such resource instance",
fmt.Sprintf("There is no resource instance in the state with the address %s. If the resource configuration has just been added, you must run \"terraform apply\" once to create the corresponding instance(s) before they can be tainted.", addr),
fmt.Sprintf("There is no resource instance in the state with the address %s. If the resource configuration has just been added, you must run \"opentf apply\" once to create the corresponding instance(s) before they can be tainted.", addr),
))
c.showDiagnostics(diags)
return 1
@ -144,7 +144,7 @@ func (c *UntaintCommand) Run(args []string) int {
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"No such resource instance",
fmt.Sprintf("Resource instance %s is currently part-way through a create_before_destroy replacement action. Run \"terraform apply\" to complete its replacement before tainting it.", addr),
fmt.Sprintf("Resource instance %s is currently part-way through a create_before_destroy replacement action. Run \"opentf apply\" to complete its replacement before tainting it.", addr),
))
} else {
// Don't know why we're here, but we'll produce a generic error message anyway.
@ -195,19 +195,19 @@ func (c *UntaintCommand) Run(args []string) int {
func (c *UntaintCommand) Help() string {
helpText := `
Usage: terraform [global options] untaint [options] name
Usage: opentf [global options] untaint [options] name
Terraform uses the term "tainted" to describe a resource instance
OpenTF uses the term "tainted" to describe a resource instance
which may not be fully functional, either because its creation
partially failed or because you've manually marked it as such using
the "terraform taint" command.
the "opentf taint" command.
This command removes that state from a resource instance, causing
Terraform to see it as fully-functional and not in need of
OpenTF to see it as fully-functional and not in need of
replacement.
This will not modify your infrastructure directly. It only avoids
Terraform planning to replace a tainted instance in a future operation.
OpenTF planning to replace a tainted instance in a future operation.
Options:

View File

@ -145,7 +145,7 @@ func (c *ValidateCommand) Synopsis() string {
func (c *ValidateCommand) Help() string {
helpText := `
Usage: terraform [global options] validate [options]
Usage: opentf [global options] validate [options]
Validate the configuration files in a directory, referring only to the
configuration and not accessing any remote services such as remote state,
@ -163,10 +163,10 @@ Usage: terraform [global options] validate [options]
Validation requires an initialized working directory with any referenced
plugins and modules installed. To initialize a working directory for
validation without accessing any configured remote backend, use:
terraform init -backend=false
opentf init -backend=false
To verify configuration in the context of a particular run (a particular
target workspace, input variable values, etc), use the 'terraform plan'
target workspace, input variable values, etc), use the 'opentf plan'
command instead, which includes an implied validation check.
Options:
@ -177,9 +177,9 @@ Options:
-no-color If specified, output won't contain any color.
-no-tests If specified, Terraform will not validate test files.
-no-tests If specified, OpenTF will not validate test files.
-test-directory=path Set the Terraform test directory, defaults to "tests".
-test-directory=path Set the OpenTF test directory, defaults to "tests".
`
return strings.TrimSpace(helpText)
}

View File

@ -41,9 +41,9 @@ type VersionCheckInfo struct {
func (c *VersionCommand) Help() string {
helpText := `
Usage: terraform [global options] version [options]
Usage: opentf [global options] version [options]
Displays the version of Terraform and all installed plugins
Displays the version of OpenTF and all installed plugins
Options:
@ -72,7 +72,7 @@ func (c *VersionCommand) Run(args []string) int {
return 1
}
fmt.Fprintf(&versionString, "Terraform v%s", c.Version)
fmt.Fprintf(&versionString, "OpenTF v%s", c.Version)
if c.VersionPrerelease != "" {
fmt.Fprintf(&versionString, "-%s", c.VersionPrerelease)
}
@ -138,7 +138,7 @@ func (c *VersionCommand) Run(args []string) int {
}
if outdated {
c.Ui.Output(fmt.Sprintf(
"\nYour version of Terraform is out of date! The latest version\n"+
"\nYour version of OpenTF is out of date! The latest version\n"+
"is %s. You can update by downloading from https://www.terraform.io/downloads.html",
latest))
}
@ -149,5 +149,5 @@ func (c *VersionCommand) Run(args []string) int {
}
func (c *VersionCommand) Synopsis() string {
return "Show the current Terraform version"
return "Show the current OpenTF version"
}

View File

@ -9,6 +9,7 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/mitchellh/cli"
"github.com/placeholderplaceholderplaceholder/opentf/internal/addrs"
"github.com/placeholderplaceholderplaceholder/opentf/internal/depsfile"
"github.com/placeholderplaceholderplaceholder/opentf/internal/getproviders"
@ -56,7 +57,7 @@ func TestVersion(t *testing.T) {
}
actual := strings.TrimSpace(ui.OutputWriter.String())
expected := "Terraform v4.5.6-foo\non aros_riscv64\n+ provider registry.terraform.io/hashicorp/test1 v7.8.9-beta.2\n+ provider registry.terraform.io/hashicorp/test2 v1.2.3"
expected := "OpenTF v4.5.6-foo\non aros_riscv64\n+ provider registry.terraform.io/hashicorp/test1 v7.8.9-beta.2\n+ provider registry.terraform.io/hashicorp/test2 v1.2.3"
if actual != expected {
t.Fatalf("wrong output\ngot:\n%s\nwant:\n%s", actual, expected)
}
@ -82,7 +83,7 @@ func TestVersion_flags(t *testing.T) {
}
actual := strings.TrimSpace(ui.OutputWriter.String())
expected := "Terraform v4.5.6-foo\non aros_riscv64"
expected := "OpenTF v4.5.6-foo\non aros_riscv64"
if actual != expected {
t.Fatalf("wrong output\ngot: %#v\nwant: %#v", actual, expected)
}

View File

@ -29,9 +29,9 @@ func (c *WorkspaceCommand) Run(args []string) int {
func (c *WorkspaceCommand) Help() string {
helpText := `
Usage: terraform [global options] workspace
Usage: opentf [global options] workspace
new, list, show, select and delete Terraform workspaces.
new, list, show, select and delete OpenTF workspaces.
`
return strings.TrimSpace(helpText)
@ -53,14 +53,14 @@ func envCommandShowWarning(ui cli.Ui, show bool) {
return
}
ui.Warn(`Warning: the "terraform env" family of commands is deprecated.
ui.Warn(`Warning: the "opentf env" family of commands is deprecated.
"Workspace" is now the preferred term for what earlier Terraform versions
"Workspace" is now the preferred term for what earlier OpenTF versions
called "environment", to reduce ambiguity caused by the latter term colliding
with other concepts.
The "terraform workspace" commands should be used instead. "terraform env"
will be removed in a future Terraform version.
The "opentf workspace" commands should be used instead. "opentf env"
will be removed in a future OpenTF version.
`)
}
@ -79,7 +79,7 @@ or include the "-or-create" flag with the "select" subcommand.`
[reset][green][bold]Created and switched to workspace %q![reset][green]
You're now on a new, empty workspace. Workspaces isolate their state,
so if you run "terraform plan" Terraform will not see any existing state
so if you run "opentf plan" OpenTF will not see any existing state
for this configuration.
`
@ -87,7 +87,7 @@ for this configuration.
envWarnNotEmpty = `[reset][yellow]WARNING: %q was non-empty.
The resources managed by the deleted workspace may still exist,
but are no longer manageable by Terraform since the state has
but are no longer manageable by OpenTF since the state has
been deleted.
`

View File

@ -9,12 +9,13 @@ import (
"time"
"github.com/mitchellh/cli"
"github.com/posener/complete"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/arguments"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/clistate"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
"github.com/posener/complete"
)
type WorkspaceDeleteCommand struct {
@ -149,7 +150,7 @@ func (c *WorkspaceDeleteCommand) Run(args []string) int {
tfdiags.Error,
"Workspace is not empty",
fmt.Sprintf(
"Workspace %q is currently tracking the following resource instances:%s\n\nDeleting this workspace would cause Terraform to lose track of any associated remote objects, which would then require you to delete them manually outside of Terraform. You should destroy these objects with Terraform before deleting the workspace.\n\nIf you want to delete this workspace anyway, and have Terraform forget about these managed objects, use the -force option to disable this safety check.",
"Workspace %q is currently tracking the following resource instances:%s\n\nDeleting this workspace would cause OpenTF to lose track of any associated remote objects, which would then require you to delete them manually outside of OpenTF. You should destroy these objects with OpenTF before deleting the workspace.\n\nIf you want to delete this workspace anyway, and have OpenTF forget about these managed objects, use the -force option to disable this safety check.",
workspace, buf.String(),
),
))
@ -206,15 +207,15 @@ func (c *WorkspaceDeleteCommand) AutocompleteFlags() complete.Flags {
func (c *WorkspaceDeleteCommand) Help() string {
helpText := `
Usage: terraform [global options] workspace delete [OPTIONS] NAME
Usage: opentf [global options] workspace delete [OPTIONS] NAME
Delete a Terraform workspace
Delete a OpenTF workspace
Options:
-force Remove a workspace even if it is managing resources.
Terraform can no longer track or manage the workspace's
OpenTF can no longer track or manage the workspace's
infrastructure.
-lock=false Don't hold a state lock during the operation. This is

View File

@ -8,8 +8,9 @@ import (
"fmt"
"strings"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
"github.com/posener/complete"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
type WorkspaceListCommand struct {
@ -94,9 +95,9 @@ func (c *WorkspaceListCommand) AutocompleteFlags() complete.Flags {
func (c *WorkspaceListCommand) Help() string {
helpText := `
Usage: terraform [global options] workspace list
Usage: opentf [global options] workspace list
List Terraform workspaces.
List OpenTF workspaces.
`
return strings.TrimSpace(helpText)

View File

@ -10,12 +10,13 @@ import (
"time"
"github.com/mitchellh/cli"
"github.com/posener/complete"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/arguments"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/clistate"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
"github.com/posener/complete"
)
type WorkspaceNewCommand struct {
@ -33,7 +34,7 @@ func (c *WorkspaceNewCommand) Run(args []string) int {
cmdFlags := c.Meta.defaultFlagSet("workspace new")
cmdFlags.BoolVar(&stateLock, "lock", true, "lock state")
cmdFlags.DurationVar(&stateLockTimeout, "lock-timeout", 0, "lock timeout")
cmdFlags.StringVar(&statePath, "state", "", "terraform state file")
cmdFlags.StringVar(&statePath, "state", "", "opentf state file")
cmdFlags.Usage = func() { c.Ui.Error(c.Help()) }
if err := cmdFlags.Parse(args); err != nil {
c.Ui.Error(fmt.Sprintf("Error parsing command-line flags: %s\n", err.Error()))
@ -183,9 +184,9 @@ func (c *WorkspaceNewCommand) AutocompleteFlags() complete.Flags {
func (c *WorkspaceNewCommand) Help() string {
helpText := `
Usage: terraform [global options] workspace new [OPTIONS] NAME
Usage: opentf [global options] workspace new [OPTIONS] NAME
Create a new Terraform workspace.
Create a new OpenTF workspace.
Options:

View File

@ -8,8 +8,9 @@ import (
"strings"
"github.com/mitchellh/cli"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
"github.com/posener/complete"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
type WorkspaceSelectCommand struct {
@ -149,13 +150,13 @@ func (c *WorkspaceSelectCommand) AutocompleteFlags() complete.Flags {
func (c *WorkspaceSelectCommand) Help() string {
helpText := `
Usage: terraform [global options] workspace select NAME
Usage: opentf [global options] workspace select NAME
Select a different Terraform workspace.
Select a different OpenTF workspace.
Options:
-or-create=false Create the Terraform workspace if it doesn't exist.
-or-create=false Create the OpenTF workspace if it doesn't exist.
`
return strings.TrimSpace(helpText)

View File

@ -43,7 +43,7 @@ func (c *WorkspaceShowCommand) AutocompleteFlags() complete.Flags {
func (c *WorkspaceShowCommand) Help() string {
helpText := `
Usage: terraform [global options] workspace show
Usage: opentf [global options] workspace show
Show the name of the current workspace.
`