mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-29 10:21:01 -06:00
update references
Signed-off-by: Marcin Białoń <mbialon@spacelift.io>
This commit is contained in:
parent
d4bf44dfb6
commit
4ecb07bf8f
@ -281,7 +281,7 @@ func (b *Cloud) Configure(obj cty.Value) tfdiags.Diagnostics {
|
||||
|
||||
// Return an error if we still don't have a token at this point.
|
||||
if token == "" {
|
||||
loginCommand := "terraform login"
|
||||
loginCommand := "opentf login"
|
||||
if b.hostname != defaultHostname {
|
||||
loginCommand = loginCommand + " " + b.hostname
|
||||
}
|
||||
@ -741,7 +741,7 @@ func (b *Cloud) StateMgr(name string) (statemgr.Full, error) {
|
||||
// Explicitly ignore the pseudo-version "latest" here, as it will cause
|
||||
// plan and apply to always fail.
|
||||
if remoteTFVersion != tfversion.String() && remoteTFVersion != "latest" {
|
||||
return nil, fmt.Errorf("Remote workspace Terraform version %q does not match local Terraform version %q", remoteTFVersion, tfversion.String())
|
||||
return nil, fmt.Errorf("Remote workspace TF version %q does not match local OpenTF version %q", remoteTFVersion, tfversion.String())
|
||||
}
|
||||
}
|
||||
|
||||
@ -785,7 +785,7 @@ func (b *Cloud) Operation(ctx context.Context, op *backend.Operation) (*backend.
|
||||
case backend.OperationTypeApply:
|
||||
f = b.opApply
|
||||
case backend.OperationTypeRefresh:
|
||||
// The `terraform refresh` command has been deprecated in favor of `terraform apply -refresh-state`.
|
||||
// The `opentf refresh` command has been deprecated in favor of `opentf apply -refresh-state`.
|
||||
// Rather than respond with an error telling the user to run the other command we can just run
|
||||
// that command instead. We will tell the user what we are doing, and then do it.
|
||||
if b.CLI != nil {
|
||||
@ -965,8 +965,8 @@ func (b *Cloud) VerifyWorkspaceTerraformVersion(workspaceName string) tfdiags.Di
|
||||
remoteConstraint, err := version.NewConstraint(workspace.TerraformVersion)
|
||||
if err != nil {
|
||||
message := fmt.Sprintf(
|
||||
"The remote workspace specified an invalid Terraform version or constraint (%s), "+
|
||||
"and it isn't possible to determine whether the local Terraform version (%s) is compatible.",
|
||||
"The remote workspace specified an invalid TF version or constraint (%s), "+
|
||||
"and it isn't possible to determine whether the local OpenTF version (%s) is compatible.",
|
||||
workspace.TerraformVersion,
|
||||
tfversion.String(),
|
||||
)
|
||||
@ -1018,7 +1018,7 @@ func (b *Cloud) VerifyWorkspaceTerraformVersion(workspaceName string) tfdiags.Di
|
||||
}
|
||||
|
||||
message := fmt.Sprintf(
|
||||
"The local Terraform version (%s) does not meet the version requirements for remote workspace %s/%s (%s).",
|
||||
"The local OpenTF version (%s) does not meet the version requirements for remote workspace %s/%s (%s).",
|
||||
tfversion.String(),
|
||||
b.organization,
|
||||
workspace.Name,
|
||||
@ -1148,7 +1148,7 @@ func (b *Cloud) validWorkspaceEnvVar(ctx context.Context, organization, workspac
|
||||
return tfdiags.Sourceless(
|
||||
tfdiags.Error,
|
||||
"Invalid workspace selection",
|
||||
fmt.Sprintf(`Terraform failed to find workspace %q in organization %s.`, workspace, organization),
|
||||
fmt.Sprintf(`OpenTF failed to find workspace %q in organization %s.`, workspace, organization),
|
||||
)
|
||||
}
|
||||
|
||||
@ -1185,7 +1185,7 @@ func (b *Cloud) validWorkspaceEnvVar(ctx context.Context, organization, workspac
|
||||
tfdiags.Error,
|
||||
"Invalid workspace selection",
|
||||
fmt.Sprintf(
|
||||
"Terraform failed to find workspace %q with the tags specified in your configuration:\n[%s]",
|
||||
"OpenTF failed to find workspace %q with the tags specified in your configuration:\n[%s]",
|
||||
workspace,
|
||||
strings.ReplaceAll(opts.Tags, ",", ", "),
|
||||
),
|
||||
@ -1245,7 +1245,7 @@ func generalError(msg string, err error) error {
|
||||
// The newline in this error is to make it look good in the CLI!
|
||||
const initialRetryError = `
|
||||
[reset][yellow]There was an error connecting to Terraform Cloud. Please do not exit
|
||||
Terraform to prevent data loss! Trying to restore the connection...
|
||||
OpenTF to prevent data loss! Trying to restore the connection...
|
||||
[reset]
|
||||
`
|
||||
|
||||
@ -1261,10 +1261,10 @@ const operationNotCanceled = `
|
||||
[reset][red]The remote operation was not cancelled.[reset]
|
||||
`
|
||||
|
||||
const refreshToApplyRefresh = `[bold][yellow]Proceeding with 'terraform apply -refresh-only -auto-approve'.[reset]`
|
||||
const refreshToApplyRefresh = `[bold][yellow]Proceeding with 'opentf apply -refresh-only -auto-approve'.[reset]`
|
||||
|
||||
const unavailableTerraformVersion = `
|
||||
[reset][yellow]The local Terraform version (%s) is not available in Terraform Cloud, or your
|
||||
[reset][yellow]The local OpenTF version (%s) is not available in Terraform Cloud, or your
|
||||
organization does not have access to it. The new workspace will use %s. You can
|
||||
change this later in the workspace settings.[reset]`
|
||||
|
||||
@ -1272,11 +1272,11 @@ const cloudIntegrationUsedInUnsupportedTFE = `
|
||||
This version of Terraform Cloud/Enterprise does not support the state mechanism
|
||||
attempting to be used by the platform. This should never happen.
|
||||
|
||||
Please reach out to HashiCorp Support to resolve this issue.`
|
||||
Please reach out to OpenTF Support to resolve this issue.`
|
||||
|
||||
var (
|
||||
workspaceConfigurationHelp = fmt.Sprintf(
|
||||
`The 'workspaces' block configures how Terraform CLI maps its workspaces for this single
|
||||
`The 'workspaces' block configures how OpenTF CLI maps its workspaces for this single
|
||||
configuration to workspaces within a Terraform Cloud organization. Two strategies are available:
|
||||
|
||||
[bold]tags[reset] - %s
|
||||
@ -1289,12 +1289,12 @@ for use with Terraform Cloud.`
|
||||
schemaDescriptionOrganization = `The name of the organization containing the targeted workspace(s).`
|
||||
|
||||
schemaDescriptionToken = `The token used to authenticate with Terraform Cloud/Enterprise. Typically this argument should not
|
||||
be set, and 'terraform login' used instead; your credentials will then be fetched from your CLI
|
||||
be set, and 'opentf login' used instead; your credentials will then be fetched from your CLI
|
||||
configuration file or configured credential helper.`
|
||||
|
||||
schemaDescriptionTags = `A set of tags used to select remote Terraform Cloud workspaces to be used for this single
|
||||
configuration. New workspaces will automatically be tagged with these tag values. Generally, this
|
||||
is the primary and recommended strategy to use. This option conflicts with "name".`
|
||||
is the primary and recommended strategy to use. This option conflicts with "name".`
|
||||
|
||||
schemaDescriptionName = `The name of a single Terraform Cloud workspace to be used with this configuration.
|
||||
When configured, only the specified workspace can be used. This option conflicts with "tags".`
|
||||
|
@ -71,7 +71,7 @@ func (b *Cloud) opApply(stopCtx, cancelCtx context.Context, op *backend.Operatio
|
||||
"No configuration files found",
|
||||
`Apply requires configuration to be present. Applying without a configuration `+
|
||||
`would mark everything for destruction, which is normally not what is desired. `+
|
||||
`If you would like to destroy everything, please run 'terraform destroy' which `+
|
||||
`If you would like to destroy everything, please run 'opentf destroy' which `+
|
||||
`does not require any configuration files.`,
|
||||
))
|
||||
}
|
||||
@ -158,11 +158,11 @@ func (b *Cloud) opApply(stopCtx, cancelCtx context.Context, op *backend.Operatio
|
||||
|
||||
if op.PlanMode == plans.DestroyMode {
|
||||
opts.Query = "\nDo you really want to destroy all resources in workspace \"" + op.Workspace + "\"?"
|
||||
opts.Description = "Terraform will destroy all your managed infrastructure, as shown above.\n" +
|
||||
opts.Description = "OpenTF will destroy all your managed infrastructure, as shown above.\n" +
|
||||
"There is no undo. Only 'yes' will be accepted to confirm."
|
||||
} else {
|
||||
opts.Query = "\nDo you want to perform these actions in workspace \"" + op.Workspace + "\"?"
|
||||
opts.Description = "Terraform will perform the actions described above.\n" +
|
||||
opts.Description = "OpenTF will perform the actions described above.\n" +
|
||||
"Only 'yes' will be accepted to approve."
|
||||
}
|
||||
|
||||
|
@ -1948,7 +1948,7 @@ func TestCloud_applyVersionCheck(t *testing.T) {
|
||||
}
|
||||
|
||||
const applySuccessOneResourceAdded = `
|
||||
Terraform v0.11.10
|
||||
OpenTF v0.11.10
|
||||
|
||||
Initializing plugins and modules...
|
||||
null_resource.hello: Creating...
|
||||
|
@ -147,7 +147,7 @@ func (b *Cloud) LocalRun(op *backend.Operation) (*backend.LocalRun, statemgr.Ful
|
||||
diags = diags.Append(ctxDiags)
|
||||
ret.Core = tfCtx
|
||||
|
||||
log.Printf("[TRACE] cloud: finished building terraform.Context")
|
||||
log.Printf("[TRACE] cloud: finished building opentf.Context")
|
||||
|
||||
return ret, stateMgr, diags
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ func (b *Cloud) opPlan(stopCtx, cancelCtx context.Context, op *backend.Operation
|
||||
`would mark everything for destruction, which is normally not what is desired. `+
|
||||
`If you would like to destroy everything, please run plan with the "-destroy" `+
|
||||
`flag or create a single empty configuration file. Otherwise, please create `+
|
||||
`a Terraform configuration file in the path being executed and try again.`,
|
||||
`a OpenTF configuration file in the path being executed and try again.`,
|
||||
))
|
||||
}
|
||||
|
||||
@ -160,7 +160,7 @@ func (b *Cloud) plan(stopCtx, cancelCtx context.Context, op *backend.Operation,
|
||||
The remote workspace is configured to work with configuration at
|
||||
%s relative to the target repository.
|
||||
|
||||
Terraform will upload the contents of the following directory,
|
||||
OpenTF will upload the contents of the following directory,
|
||||
excluding files or directories as defined by a .terraformignore file
|
||||
at %s/.terraformignore (if it is present),
|
||||
in order to capture the filesystem context the remote workspace expects:
|
||||
@ -400,7 +400,7 @@ func (b *Cloud) AssertImportCompatible(config *configs.Config) error {
|
||||
// First, check the remote API version is high enough.
|
||||
currentAPIVersion, err := version.NewVersion(b.client.RemoteAPIVersion())
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error parsing remote API version. To proceed, please remove any import blocks from your config. Please report the following error to the Terraform team: %s", err)
|
||||
return fmt.Errorf("Error parsing remote API version. To proceed, please remove any import blocks from your config. Please report the following error to the OpenTF team: %s", err)
|
||||
}
|
||||
desiredAPIVersion, _ := version.NewVersion("2.6")
|
||||
if currentAPIVersion.LessThan(desiredAPIVersion) {
|
||||
@ -410,11 +410,11 @@ func (b *Cloud) AssertImportCompatible(config *configs.Config) error {
|
||||
// Second, check the agent version is high enough.
|
||||
agentEnv, isSet := os.LookupEnv("TFC_AGENT_VERSION")
|
||||
if !isSet {
|
||||
return fmt.Errorf("Error reading TFC agent version. To proceed, please remove any import blocks from your config. Please report the following error to the Terraform team: TFC_AGENT_VERSION not present.")
|
||||
return fmt.Errorf("Error reading TFC agent version. To proceed, please remove any import blocks from your config. Please report the following error to the OpenTF team: TFC_AGENT_VERSION not present.")
|
||||
}
|
||||
currentAgentVersion, err := version.NewVersion(agentEnv)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error parsing TFC agent version. To proceed, please remove any import blocks from your config. Please report the following error to the Terraform team: %s", err)
|
||||
return fmt.Errorf("Error parsing TFC agent version. To proceed, please remove any import blocks from your config. Please report the following error to the OpenTF team: %s", err)
|
||||
}
|
||||
desiredAgentVersion, _ := version.NewVersion("1.10")
|
||||
if currentAgentVersion.LessThan(desiredAgentVersion) {
|
||||
|
@ -71,7 +71,7 @@ func TestCloud_refreshBasicActuallyRunsApplyRefresh(t *testing.T) {
|
||||
}
|
||||
|
||||
output := b.CLI.(*cli.MockUi).OutputWriter.String()
|
||||
if !strings.Contains(output, "Proceeding with 'terraform apply -refresh-only -auto-approve'") {
|
||||
if !strings.Contains(output, "Proceeding with 'opentf apply -refresh-only -auto-approve'") {
|
||||
t.Fatalf("expected TFC header in output: %s", output)
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ func (b *Cloud) ShowPlanForRun(ctx context.Context, runID, runHostname string, r
|
||||
// Get run and plan
|
||||
r, err := b.client.Runs.ReadWithOptions(ctx, runID, &tfe.RunReadOptions{Include: []tfe.RunIncludeOpt{tfe.RunPlan, tfe.RunWorkspace}})
|
||||
if err == tfe.ErrResourceNotFound {
|
||||
return nil, fmt.Errorf("couldn't read information for cloud run %s; make sure you've run `terraform login` and that you have permission to view the run", runID)
|
||||
return nil, fmt.Errorf("couldn't read information for cloud run %s; make sure you've run `opentf login` and that you have permission to view the run", runID)
|
||||
} else if err != nil {
|
||||
return nil, fmt.Errorf("couldn't read information for cloud run %s: %w", runID, err)
|
||||
}
|
||||
@ -67,9 +67,9 @@ func (b *Cloud) ShowPlanForRun(ctx context.Context, runID, runHostname string, r
|
||||
}
|
||||
if err == tfe.ErrResourceNotFound {
|
||||
if redacted {
|
||||
return nil, fmt.Errorf("couldn't read plan data for cloud run %s; make sure you've run `terraform login` and that you have permission to view the run", runID)
|
||||
return nil, fmt.Errorf("couldn't read plan data for cloud run %s; make sure you've run `opentf login` and that you have permission to view the run", runID)
|
||||
} else {
|
||||
return nil, fmt.Errorf("couldn't read unredacted JSON plan data for cloud run %s; make sure you've run `terraform login` and that you have admin permissions on the workspace", runID)
|
||||
return nil, fmt.Errorf("couldn't read unredacted JSON plan data for cloud run %s; make sure you've run `opentf login` and that you have admin permissions on the workspace", runID)
|
||||
}
|
||||
} else if err != nil {
|
||||
return nil, fmt.Errorf("couldn't read plan data for cloud run %s: %w", runID, err)
|
||||
|
@ -39,7 +39,7 @@ func TestCloud_showMissingRun(t *testing.T) {
|
||||
|
||||
absentRunID := "run-WwwwXxxxYyyyZzzz"
|
||||
_, err := b.ShowPlanForRun(context.Background(), absentRunID, "app.terraform.io", true)
|
||||
if !strings.Contains(err.Error(), "terraform login") {
|
||||
if !strings.Contains(err.Error(), "opentf login") {
|
||||
t.Fatalf("expected error message to suggest checking your login status, instead got: %s", err)
|
||||
}
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ func WithEnvVars(t *testing.T) {
|
||||
vars: map[string]string{
|
||||
"TF_WORKSPACE": "i-dont-exist-in-org",
|
||||
},
|
||||
expectedErr: `Invalid workspace selection: Terraform failed to find workspace "i-dont-exist-in-org" in organization hashicorp`,
|
||||
expectedErr: `Invalid workspace selection: OpenTF failed to find workspace "i-dont-exist-in-org" in organization hashicorp`,
|
||||
},
|
||||
"workspaces and env var specified": {
|
||||
config: cty.ObjectVal(map[string]cty.Value{
|
||||
@ -399,7 +399,7 @@ func WithEnvVars(t *testing.T) {
|
||||
vars: map[string]string{
|
||||
"TF_WORKSPACE": "shire",
|
||||
},
|
||||
expectedErr: "Terraform failed to find workspace \"shire\" with the tags specified in your configuration:\n[cloud]",
|
||||
expectedErr: "OpenTF failed to find workspace \"shire\" with the tags specified in your configuration:\n[cloud]",
|
||||
},
|
||||
"env var workspace has specified tag": {
|
||||
setup: func(b *Cloud) {
|
||||
@ -610,7 +610,7 @@ func TestCloud_config(t *testing.T) {
|
||||
"project": cty.NullVal(cty.String),
|
||||
}),
|
||||
}),
|
||||
confErr: "terraform login localhost",
|
||||
confErr: "opentf login localhost",
|
||||
},
|
||||
"with_tags": {
|
||||
config: cty.ObjectVal(map[string]cty.Value{
|
||||
@ -808,7 +808,7 @@ func TestCloud_setUnavailableTerraformVersion(t *testing.T) {
|
||||
|
||||
_, err = b.StateMgr(workspaceName)
|
||||
if err != nil {
|
||||
t.Fatalf("expected no error from StateMgr, despite not being able to set remote Terraform version: %#v", err)
|
||||
t.Fatalf("expected no error from StateMgr, despite not being able to set remote TF version: %#v", err)
|
||||
}
|
||||
// Make sure the workspace was created:
|
||||
workspace, err := b.client.Workspaces.Read(context.Background(), b.organization, workspaceName)
|
||||
@ -822,7 +822,7 @@ func TestCloud_setUnavailableTerraformVersion(t *testing.T) {
|
||||
tfe.WorkspaceUpdateOptions{TerraformVersion: tfe.String("1.1.0")},
|
||||
)
|
||||
if err == nil {
|
||||
t.Fatalf("the mocks aren't emulating a nonexistent remote Terraform version correctly, so this test isn't trustworthy anymore")
|
||||
t.Fatalf("the mocks aren't emulating a nonexistent remote TF version correctly, so this test isn't trustworthy anymore")
|
||||
}
|
||||
}
|
||||
|
||||
@ -1089,7 +1089,7 @@ func TestCloud_StateMgr_versionCheck(t *testing.T) {
|
||||
}
|
||||
|
||||
// This should fail
|
||||
want := `Remote workspace Terraform version "0.13.5" does not match local Terraform version "0.14.0"`
|
||||
want := `Remote workspace TF version "0.13.5" does not match local OpenTF version "0.14.0"`
|
||||
if _, err := b.StateMgr(testBackendSingleWorkspaceName); err.Error() != want {
|
||||
t.Fatalf("wrong error\n got: %v\nwant: %v", err.Error(), want)
|
||||
}
|
||||
@ -1203,7 +1203,7 @@ func TestCloud_VerifyWorkspaceTerraformVersion(t *testing.T) {
|
||||
if len(diags) != 1 {
|
||||
t.Fatal("expected diag, but none returned")
|
||||
}
|
||||
if got := diags.Err().Error(); !strings.Contains(got, "Incompatible Terraform version") {
|
||||
if got := diags.Err().Error(); !strings.Contains(got, "Incompatible TF version") {
|
||||
t.Fatalf("unexpected error: %s", got)
|
||||
}
|
||||
} else {
|
||||
@ -1252,7 +1252,7 @@ func TestCloud_VerifyWorkspaceTerraformVersion_workspaceErrors(t *testing.T) {
|
||||
if len(diags) != 1 {
|
||||
t.Fatal("expected diag, but none returned")
|
||||
}
|
||||
if got := diags.Err().Error(); !strings.Contains(got, "Incompatible Terraform version: The remote workspace specified") {
|
||||
if got := diags.Err().Error(); !strings.Contains(got, "Incompatible TF version: The remote workspace specified") {
|
||||
t.Fatalf("unexpected error: %s", got)
|
||||
}
|
||||
}
|
||||
@ -1304,10 +1304,10 @@ func TestCloud_VerifyWorkspaceTerraformVersion_ignoreFlagSet(t *testing.T) {
|
||||
if got, want := diags[0].Severity(), tfdiags.Warning; got != want {
|
||||
t.Errorf("wrong severity: got %#v, want %#v", got, want)
|
||||
}
|
||||
if got, want := diags[0].Description().Summary, "Incompatible Terraform version"; got != want {
|
||||
if got, want := diags[0].Description().Summary, "Incompatible TF version"; got != want {
|
||||
t.Errorf("wrong summary: got %s, want %s", got, want)
|
||||
}
|
||||
wantDetail := "The local Terraform version (0.14.0) does not meet the version requirements for remote workspace hashicorp/app-prod (0.13.5)."
|
||||
wantDetail := "The local OpenTF version (0.14.0) does not meet the version requirements for remote workspace hashicorp/app-prod (0.13.5)."
|
||||
if got := diags[0].Description().Detail; got != wantDetail {
|
||||
t.Errorf("wrong summary: got %s, want %s", got, wantDetail)
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ var (
|
||||
)
|
||||
)
|
||||
|
||||
const ignoreRemoteVersionHelp = "If you're sure you want to upgrade the state, you can force Terraform to continue using the -ignore-remote-version flag. This may result in an unusable workspace."
|
||||
const ignoreRemoteVersionHelp = "If you're sure you want to upgrade the state, you can force OpenTF to continue using the -ignore-remote-version flag. This may result in an unusable workspace."
|
||||
|
||||
func missingConfigAttributeAndEnvVar(attribute string, envVar string) tfdiags.Diagnostic {
|
||||
detail := strings.TrimSpace(fmt.Sprintf("\"%s\" must be set in the cloud configuration or as an environment variable: %s.\n", attribute, envVar))
|
||||
@ -59,5 +59,5 @@ func incompatibleWorkspaceTerraformVersion(message string, ignoreVersionConflict
|
||||
suggestion = ""
|
||||
}
|
||||
description := strings.TrimSpace(fmt.Sprintf("%s\n\n%s", message, suggestion))
|
||||
return tfdiags.Sourceless(severity, "Incompatible Terraform version", description)
|
||||
return tfdiags.Sourceless(severity, "Incompatible TF version", description)
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ type State struct {
|
||||
|
||||
var ErrStateVersionUnauthorizedUpgradeState = errors.New(strings.TrimSpace(`
|
||||
You are not authorized to read the full state version containing outputs.
|
||||
State versions created by terraform v1.3.0 and newer do not require this level
|
||||
State versions created by opentf v1.3.0 and newer do not require this level
|
||||
of authorization and therefore this error can usually be fixed by upgrading the
|
||||
remote state version.
|
||||
`))
|
||||
@ -338,7 +338,7 @@ func (s *State) Lock(info *statemgr.LockInfo) (string, error) {
|
||||
|
||||
// Lock the workspace.
|
||||
_, err := s.tfeClient.Workspaces.Lock(ctx, s.workspace.ID, tfe.WorkspaceLockOptions{
|
||||
Reason: tfe.String("Locked by Terraform"),
|
||||
Reason: tfe.String("Locked by OpenTF"),
|
||||
})
|
||||
if err != nil {
|
||||
if err == tfe.ErrWorkspaceLocked {
|
||||
|
Loading…
Reference in New Issue
Block a user