mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-23 15:40:07 -06:00
Rename multiple packages to OpenTofu (addrs, backend, command) (#506)
This commit is contained in:
parent
d7cc74d9e2
commit
487d9bc6a4
@ -55,7 +55,7 @@ func (c *CheckRuleDiagnosticExtra) WrapDiagnosticExtra(inner interface{}) {
|
||||
if c.wrapped != nil {
|
||||
// This is a logical inconsistency, the caller should know whether they
|
||||
// have already wrapped an extra or not.
|
||||
panic("Attempted to wrap a diagnostic extra into a CheckRuleDiagnosticExtra that is already wrapping a different extra. This is a bug in OpenTF, please report it.")
|
||||
panic("Attempted to wrap a diagnostic extra into a CheckRuleDiagnosticExtra that is already wrapping a different extra. This is a bug in OpenTofu, please report it.")
|
||||
}
|
||||
c.wrapped = inner
|
||||
}
|
||||
|
@ -2,14 +2,14 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
// Package addrs contains types that represent "addresses", which are
|
||||
// references to specific objects within a OpenTF configuration or
|
||||
// references to specific objects within a OpenTofu configuration or
|
||||
// state.
|
||||
//
|
||||
// All addresses have string representations based on HCL traversal syntax
|
||||
// which should be used in the user-interface, and also in-memory
|
||||
// representations that can be used internally.
|
||||
//
|
||||
// For object types that exist within OpenTF modules a pair of types is
|
||||
// For object types that exist within OpenTofu modules a pair of types is
|
||||
// used. The "local" part of the address is represented by a type, and then
|
||||
// an absolute path to that object in the context of its module is represented
|
||||
// by a type of the same name with an "Abs" prefix added, for "absolute".
|
||||
|
@ -198,7 +198,7 @@ LOOP:
|
||||
// equivalent ModuleInstance address that assumes that no modules have
|
||||
// keyed instances.
|
||||
//
|
||||
// This is a temporary allowance for the fact that OpenTF does not presently
|
||||
// This is a temporary allowance for the fact that OpenTofu does not presently
|
||||
// support "count" and "for_each" on modules, and thus graph building code that
|
||||
// derives graph nodes from configuration must just assume unkeyed modules
|
||||
// in order to construct the graph. At a later time when "count" and "for_each"
|
||||
|
@ -7,9 +7,9 @@ import (
|
||||
tfaddr "github.com/hashicorp/terraform-registry-address"
|
||||
)
|
||||
|
||||
// A ModulePackage represents a physical location where OpenTF can retrieve
|
||||
// A ModulePackage represents a physical location where OpenTofu can retrieve
|
||||
// a module package, which is an archive, repository, or other similar
|
||||
// container which delivers the source code for one or more OpenTF modules.
|
||||
// container which delivers the source code for one or more OpenTofu modules.
|
||||
//
|
||||
// A ModulePackage is a string in go-getter's address syntax. By convention,
|
||||
// we use ModulePackage-typed values only for the result of successfully
|
||||
|
@ -54,7 +54,7 @@ var moduleSourceLocalPrefixes = []string{
|
||||
// For historical reasons this syntax is a bit overloaded, supporting three
|
||||
// different address types:
|
||||
// - Local paths starting with either ./ or ../, which are special because
|
||||
// OpenTF considers them to belong to the same "package" as the caller.
|
||||
// OpenTofu considers them to belong to the same "package" as the caller.
|
||||
// - Module registry addresses, given as either NAMESPACE/NAME/SYSTEM or
|
||||
// HOST/NAMESPACE/NAME/SYSTEM, in which case the remote registry serves
|
||||
// as an indirection over the third address type that follows.
|
||||
@ -85,7 +85,7 @@ func ParseModuleSource(raw string) (ModuleSource, error) {
|
||||
// parsed as one, and anything else must fall through to be
|
||||
// parsed as a direct remote source, where go-getter might
|
||||
// then recognize it as a filesystem path. This is odd
|
||||
// but matches behavior we've had since OpenTF v0.10 which
|
||||
// but matches behavior we've had since OpenTofu v0.10 which
|
||||
// existing modules may be relying on.
|
||||
// (Notice that this means that there's never any path where
|
||||
// the registry source parse error gets returned to the caller,
|
||||
@ -142,7 +142,7 @@ func parseModuleSourceLocal(raw string) (ModuleSourceLocal, error) {
|
||||
// produces.
|
||||
|
||||
// Although using backslashes (Windows-style) is non-idiomatic, we do
|
||||
// allow it and just normalize it away, so the rest of OpenTF will
|
||||
// allow it and just normalize it away, so the rest of OpenTofu will
|
||||
// only see the forward-slash form.
|
||||
if strings.Contains(raw, `\`) {
|
||||
// Note: We use string replacement rather than filepath.ToSlash
|
||||
@ -192,12 +192,12 @@ func (s ModuleSourceLocal) ForDisplay() string {
|
||||
}
|
||||
|
||||
// ModuleSourceRegistry is a ModuleSource representing a module listed in a
|
||||
// OpenTF module registry.
|
||||
// OpenTofu module registry.
|
||||
//
|
||||
// A registry source isn't a direct source location but rather an indirection
|
||||
// over a ModuleSourceRemote. The job of a registry is to translate the
|
||||
// combination of a ModuleSourceRegistry and a module version number into
|
||||
// a concrete ModuleSourceRemote that OpenTF will then download and
|
||||
// a concrete ModuleSourceRemote that OpenTofu will then download and
|
||||
// install.
|
||||
type ModuleSourceRegistry tfaddr.Module
|
||||
|
||||
|
@ -481,7 +481,7 @@ func TestParseModuleSourceRegistry(t *testing.T) {
|
||||
// the user provided in the input, and so for backward compatibility
|
||||
// we're continuing to do that here, at the expense of now making the
|
||||
// "ForDisplay" output case-preserving where its predecessor in the
|
||||
// old package wasn't. The main OpenTF Registry at registry.terraform.io
|
||||
// old package wasn't. The main OpenTofu Registry at registry.terraform.io
|
||||
// is itself case-insensitive anyway, so our case-preserving here is
|
||||
// entirely for the benefit of existing third-party registry
|
||||
// implementations that might be case-sensitive, which we must remain
|
||||
|
@ -18,8 +18,8 @@ import (
|
||||
// Its name reflects that its primary purpose is for the "from" and "to"
|
||||
// addresses in a "moved" statement in the configuration, but it's also
|
||||
// valid to use MoveEndpoint for other similar mechanisms that give
|
||||
// OpenTF hints about historical configuration changes that might
|
||||
// prompt creating a different plan than OpenTF would by default.
|
||||
// OpenTofu hints about historical configuration changes that might
|
||||
// prompt creating a different plan than OpenTofu would by default.
|
||||
//
|
||||
// To obtain a full address from a MoveEndpoint you must use
|
||||
// either the package function UnifyMoveEndpoints (to get an AbsMoveable) or
|
||||
@ -31,7 +31,7 @@ type MoveEndpoint struct {
|
||||
SourceRange tfdiags.SourceRange
|
||||
|
||||
// Internally we (ab)use AbsMoveable as the representation of our
|
||||
// relative address, even though everywhere else in OpenTF
|
||||
// relative address, even though everywhere else in OpenTofu
|
||||
// AbsMoveable always represents a fully-absolute address.
|
||||
// In practice, due to the implementation of ParseMoveEndpoint,
|
||||
// this is always either a ModuleInstance or an AbsResourceInstance,
|
||||
|
@ -17,7 +17,7 @@ import (
|
||||
//
|
||||
// This is related to but separate from ModuleCallOutput, which represents
|
||||
// a module output from the perspective of its parent module. Outputs are
|
||||
// referencable from the testing scope, in general opentf operation users
|
||||
// referencable from the testing scope, in general tofu operation users
|
||||
// will be referencing ModuleCallOutput.
|
||||
type OutputValue struct {
|
||||
referenceable
|
||||
|
@ -23,10 +23,10 @@ type Reference struct {
|
||||
}
|
||||
|
||||
// DisplayString returns a string that approximates the subject and remaining
|
||||
// traversal of the reciever in a way that resembles the OpenTF language
|
||||
// traversal of the reciever in a way that resembles the OpenTofu language
|
||||
// syntax that could've produced it.
|
||||
//
|
||||
// It's not guaranteed to actually be a valid OpenTF language expression,
|
||||
// It's not guaranteed to actually be a valid OpenTofu language expression,
|
||||
// since the intended use here is primarily for UI messages such as
|
||||
// diagnostics.
|
||||
func (r *Reference) DisplayString() string {
|
||||
@ -209,7 +209,7 @@ func parseRef(traversal hcl.Traversal) (*Reference, tfdiags.Diagnostics) {
|
||||
case "resource":
|
||||
// This is an alias for the normal case of just using a managed resource
|
||||
// type as a top-level symbol, which will serve as an escape mechanism
|
||||
// if a later edition of the OpenTF language introduces a new
|
||||
// if a later edition of the OpenTofu language introduces a new
|
||||
// reference prefix that conflicts with a resource type name in an
|
||||
// existing provider. In that case, the edition upgrade tool can
|
||||
// rewrite foo.bar into resource.foo.bar to ensure that "foo" remains
|
||||
@ -346,7 +346,7 @@ func parseRef(traversal hcl.Traversal) (*Reference, tfdiags.Diagnostics) {
|
||||
diags = diags.Append(&hcl.Diagnostic{
|
||||
Severity: hcl.DiagError,
|
||||
Summary: "Reserved symbol name",
|
||||
Detail: fmt.Sprintf("The symbol name %q is reserved for use in a future OpenTF version. If you are using a provider that already uses this as a resource type name, add the prefix \"resource.\" to force interpretation as a resource type name.", root),
|
||||
Detail: fmt.Sprintf("The symbol name %q is reserved for use in a future OpenTofu version. If you are using a provider that already uses this as a resource type name, add the prefix \"resource.\" to force interpretation as a resource type name.", root),
|
||||
Subject: rootRange.Ptr(),
|
||||
})
|
||||
return nil, diags
|
||||
|
@ -697,7 +697,7 @@ func TestParseRef(t *testing.T) {
|
||||
// the "resource" prefix forces interpreting the next name as a
|
||||
// resource type name. This is an alias for just using a resource
|
||||
// type name at the top level, to be used only if a later edition
|
||||
// of the OpenTF language introduces a new reserved word that
|
||||
// of the OpenTofu language introduces a new reserved word that
|
||||
// overlaps with a resource type name.
|
||||
{
|
||||
`resource.boop_instance.foo`,
|
||||
@ -721,17 +721,17 @@ func TestParseRef(t *testing.T) {
|
||||
{
|
||||
`template.foo`,
|
||||
nil,
|
||||
`The symbol name "template" is reserved for use in a future OpenTF version. If you are using a provider that already uses this as a resource type name, add the prefix "resource." to force interpretation as a resource type name.`,
|
||||
`The symbol name "template" is reserved for use in a future OpenTofu version. If you are using a provider that already uses this as a resource type name, add the prefix "resource." to force interpretation as a resource type name.`,
|
||||
},
|
||||
{
|
||||
`lazy.foo`,
|
||||
nil,
|
||||
`The symbol name "lazy" is reserved for use in a future OpenTF version. If you are using a provider that already uses this as a resource type name, add the prefix "resource." to force interpretation as a resource type name.`,
|
||||
`The symbol name "lazy" is reserved for use in a future OpenTofu version. If you are using a provider that already uses this as a resource type name, add the prefix "resource." to force interpretation as a resource type name.`,
|
||||
},
|
||||
{
|
||||
`arg.foo`,
|
||||
nil,
|
||||
`The symbol name "arg" is reserved for use in a future OpenTF version. If you are using a provider that already uses this as a resource type name, add the prefix "resource." to force interpretation as a resource type name.`,
|
||||
`The symbol name "arg" is reserved for use in a future OpenTofu version. If you are using a provider that already uses this as a resource type name, add the prefix "resource." to force interpretation as a resource type name.`,
|
||||
},
|
||||
|
||||
// anything else, interpreted as a managed resource reference
|
||||
|
@ -67,14 +67,14 @@ func NewProvider(hostname svchost.Hostname, namespace, typeName string) Provider
|
||||
// As a special case, the string "terraform" maps to
|
||||
// "terraform.io/builtin/terraform" because that is the more likely user
|
||||
// intent than the now-unmaintained "registry.terraform.io/hashicorp/terraform"
|
||||
// which remains only for compatibility with older OpenTF versions.
|
||||
// which remains only for compatibility with older OpenTofu versions.
|
||||
func ImpliedProviderForUnqualifiedType(typeName string) Provider {
|
||||
switch typeName {
|
||||
case "terraform":
|
||||
// Note for future maintainers: any additional strings we add here
|
||||
// as implied to be builtin must never also be use as provider names
|
||||
// in the registry.terraform.io/hashicorp/... namespace, because
|
||||
// otherwise older versions of OpenTF could implicitly select
|
||||
// otherwise older versions of OpenTofu could implicitly select
|
||||
// the registry name instead of the internal one.
|
||||
return NewBuiltInProvider(typeName)
|
||||
default:
|
||||
|
@ -233,7 +233,7 @@ func ParseLegacyAbsProviderConfigStr(str string) (AbsProviderConfig, tfdiags.Dia
|
||||
}
|
||||
|
||||
// ParseLegacyAbsProviderConfig parses the given traversal as an absolute
|
||||
// provider address in the legacy form used by OpenTF v0.12 and earlier.
|
||||
// provider address in the legacy form used by OpenTofu v0.12 and earlier.
|
||||
// The following are examples of traversals that can be successfully parsed as
|
||||
// legacy absolute provider configuration addresses:
|
||||
//
|
||||
@ -244,8 +244,8 @@ func ParseLegacyAbsProviderConfigStr(str string) (AbsProviderConfig, tfdiags.Dia
|
||||
//
|
||||
// We can encounter this kind of address in a historical state snapshot that
|
||||
// hasn't yet been upgraded by refreshing or applying a plan with
|
||||
// OpenTF v0.13. Later versions of OpenTF reject state snapshots using
|
||||
// this format, and so users must follow the OpenTF v0.13 upgrade guide
|
||||
// OpenTofu v0.13. Later versions of OpenTofu reject state snapshots using
|
||||
// this format, and so users must follow the OpenTofu v0.13 upgrade guide
|
||||
// in that case.
|
||||
//
|
||||
// We will not use this address form for any new file formats.
|
||||
@ -352,7 +352,7 @@ func (pc AbsProviderConfig) providerConfig() {}
|
||||
// other than the root module. Even if a valid address is returned, inheritence
|
||||
// may not be performed for other reasons, such as if the calling module
|
||||
// provided explicit provider configurations within the call for this module.
|
||||
// The ProviderTransformer graph transform in the main opentf module has the
|
||||
// The ProviderTransformer graph transform in the main tofu module has the
|
||||
// authoritative logic for provider inheritance, and this method is here mainly
|
||||
// just for its benefit.
|
||||
func (pc AbsProviderConfig) Inherited() (AbsProviderConfig, bool) {
|
||||
|
@ -2,9 +2,9 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
// Package backend provides interfaces that the CLI uses to interact with
|
||||
// OpenTF. A backend provides the abstraction that allows the same CLI
|
||||
// OpenTofu. A backend provides the abstraction that allows the same CLI
|
||||
// to simultaneously support both local and remote operations for seamlessly
|
||||
// using OpenTF in a team environment.
|
||||
// using OpenTofu in a team environment.
|
||||
package backend
|
||||
|
||||
import (
|
||||
@ -54,7 +54,7 @@ var (
|
||||
// InitFn is used to initialize a new backend.
|
||||
type InitFn func() Backend
|
||||
|
||||
// Backend is the minimal interface that must be implemented to enable OpenTF.
|
||||
// Backend is the minimal interface that must be implemented to enable OpenTofu.
|
||||
type Backend interface {
|
||||
// ConfigSchema returns a description of the expected configuration
|
||||
// structure for the receiving backend.
|
||||
@ -135,7 +135,7 @@ type HostAlias struct {
|
||||
type Enhanced interface {
|
||||
Backend
|
||||
|
||||
// Operation performs a OpenTF operation such as refresh, plan, apply.
|
||||
// Operation performs a OpenTofu operation such as refresh, plan, apply.
|
||||
// It is up to the implementation to determine what "performing" means.
|
||||
// This DOES NOT BLOCK. The context returned as part of RunningOperation
|
||||
// should be used to block for completion.
|
||||
@ -152,7 +152,7 @@ type Enhanced interface {
|
||||
// Local implements additional behavior on a Backend that allows local
|
||||
// operations in addition to remote operations.
|
||||
//
|
||||
// This enables more behaviors of OpenTF that require more data such
|
||||
// This enables more behaviors of OpenTofu that require more data such
|
||||
// as `console`, `import`, `graph`. These require direct access to
|
||||
// configurations, variables, and more. Not all backends may support this
|
||||
// so we separate it out into its own optional interface.
|
||||
@ -182,12 +182,12 @@ type Local interface {
|
||||
//
|
||||
// This type is a weird architectural wart resulting from the overly-general
|
||||
// way our backend API models operations, whereby we behave as if all
|
||||
// OpenTF operations have the same inputs and outputs even though they
|
||||
// OpenTofu operations have the same inputs and outputs even though they
|
||||
// are actually all rather different. The exact meaning of the fields in
|
||||
// this type therefore vary depending on which OperationType was passed to
|
||||
// Local.Context in order to create an object of this type.
|
||||
type LocalRun struct {
|
||||
// Core is an already-initialized OpenTF Core context, ready to be
|
||||
// Core is an already-initialized OpenTofu Core context, ready to be
|
||||
// used to run operations such as Plan and Apply.
|
||||
Core *tofu.Context
|
||||
|
||||
@ -216,7 +216,7 @@ type LocalRun struct {
|
||||
Plan *plans.Plan
|
||||
}
|
||||
|
||||
// An operation represents an operation for OpenTF to execute.
|
||||
// An operation represents an operation for OpenTofu to execute.
|
||||
//
|
||||
// Note that not all fields are supported by all backends and can result
|
||||
// in an error if set. All backend implementations should show user-friendly
|
||||
@ -224,12 +224,12 @@ type LocalRun struct {
|
||||
// backend doesn't support a PlanId being set.
|
||||
//
|
||||
// The operation options are purposely designed to have maximal compatibility
|
||||
// between OpenTF and Terraform Servers (a commercial product offered by
|
||||
// between OpenTofu and Terraform Servers (a commercial product offered by
|
||||
// HashiCorp). Therefore, it isn't expected that other implementation support
|
||||
// every possible option. The struct here is generalized in order to allow
|
||||
// even partial implementations to exist in the open, without walling off
|
||||
// remote functionality 100% behind a commercial wall. Anyone can implement
|
||||
// against this interface and have OpenTF interact with it just as it
|
||||
// against this interface and have OpenTofu interact with it just as it
|
||||
// would with HashiCorp-provided Terraform Servers.
|
||||
type Operation struct {
|
||||
// Type is the operation to perform.
|
||||
@ -314,7 +314,7 @@ type Operation struct {
|
||||
}
|
||||
|
||||
// HasConfig returns true if and only if the operation has a ConfigDir value
|
||||
// that refers to a directory containing at least one OpenTF configuration
|
||||
// that refers to a directory containing at least one OpenTofu configuration
|
||||
// file.
|
||||
func (o *Operation) HasConfig() bool {
|
||||
return o.ConfigLoader.IsConfigDir(o.ConfigDir)
|
||||
|
@ -59,7 +59,7 @@ func TestReadPathOrContents_TildePath(t *testing.T) {
|
||||
|
||||
func TestRead_PathNoPermission(t *testing.T) {
|
||||
// This skip condition is intended to get this test out of the way of users
|
||||
// who are building and testing OpenTF from within a Linux-based Docker
|
||||
// who are building and testing OpenTofu from within a Linux-based Docker
|
||||
// container, where it is common for processes to be running as effectively
|
||||
// root within the container.
|
||||
if u, err := user.Current(); err == nil && u.Uid == "0" {
|
||||
|
@ -12,12 +12,12 @@ import (
|
||||
)
|
||||
|
||||
// CLI is an optional interface that can be implemented to be initialized
|
||||
// with information from the OpenTF CLI. If this is implemented, this
|
||||
// with information from the OpenTofu CLI. If this is implemented, this
|
||||
// initialization function will be called with data to help interact better
|
||||
// with a CLI.
|
||||
//
|
||||
// This interface was created to improve backend interaction with the
|
||||
// official OpenTF CLI while making it optional for API users to have
|
||||
// official OpenTofu CLI while making it optional for API users to have
|
||||
// to provide full CLI interaction to every backend.
|
||||
//
|
||||
// If you're implementing a Backend, it is acceptable to require CLI
|
||||
@ -71,7 +71,7 @@ type CLIOpts struct {
|
||||
StateBackupPath string
|
||||
|
||||
// ContextOpts are the base context options to set when initializing a
|
||||
// OpenTF context. Many of these will be overridden or merged by
|
||||
// OpenTofu context. Many of these will be overridden or merged by
|
||||
// Operation. See Operation for more details.
|
||||
ContextOpts *tofu.ContextOpts
|
||||
|
||||
@ -87,7 +87,7 @@ type CLIOpts struct {
|
||||
// automated system rather than directly at a command prompt.
|
||||
//
|
||||
// This is a hint not to produce messages that expect that a user can
|
||||
// run a follow-up command, perhaps because OpenTF is running in
|
||||
// run a follow-up command, perhaps because OpenTofu is running in
|
||||
// some sort of workflow automation tool that abstracts away the
|
||||
// exact commands that are being run.
|
||||
RunningInAutomation bool
|
||||
|
@ -29,13 +29,13 @@ import (
|
||||
)
|
||||
|
||||
// backends is the list of available backends. This is a global variable
|
||||
// because backends are currently hardcoded into OpenTF and can't be
|
||||
// because backends are currently hardcoded into OpenTofu and can't be
|
||||
// modified without recompilation.
|
||||
//
|
||||
// To read an available backend, use the Backend function. This ensures
|
||||
// safe concurrent read access to the list of built-in backends.
|
||||
//
|
||||
// Backends are hardcoded into OpenTF because the API for backends uses
|
||||
// Backends are hardcoded into OpenTofu because the API for backends uses
|
||||
// complex structures and supporting that over the plugin system is currently
|
||||
// prohibitively difficult. For those wanting to implement a custom backend,
|
||||
// they can do so with recompilation.
|
||||
@ -73,12 +73,12 @@ func Init(services *disco.Disco) {
|
||||
}
|
||||
|
||||
RemovedBackends = map[string]string{
|
||||
"artifactory": `The "artifactory" backend is not supported in OpenTF v1.3 or later.`,
|
||||
"artifactory": `The "artifactory" backend is not supported in OpenTofu v1.3 or later.`,
|
||||
"azure": `The "azure" backend name has been removed, please use "azurerm".`,
|
||||
"etcd": `The "etcd" backend is not supported in OpenTF v1.3 or later.`,
|
||||
"etcdv3": `The "etcdv3" backend is not supported in OpenTF v1.3 or later.`,
|
||||
"manta": `The "manta" backend is not supported in OpenTF v1.3 or later.`,
|
||||
"swift": `The "swift" backend is not supported in OpenTF v1.3 or later.`,
|
||||
"etcd": `The "etcd" backend is not supported in OpenTofu v1.3 or later.`,
|
||||
"etcdv3": `The "etcdv3" backend is not supported in OpenTofu v1.3 or later.`,
|
||||
"manta": `The "manta" backend is not supported in OpenTofu v1.3 or later.`,
|
||||
"swift": `The "swift" backend is not supported in OpenTofu v1.3 or later.`,
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ func Backend(name string) backend.InitFn {
|
||||
// then it will be overwritten.
|
||||
//
|
||||
// This method sets this backend globally and care should be taken to do
|
||||
// this only before OpenTF is executing to prevent odd behavior of backends
|
||||
// this only before OpenTofu is executing to prevent odd behavior of backends
|
||||
// changing mid-execution.
|
||||
func Set(name string, f backend.InitFn) {
|
||||
backendsLock.Lock()
|
||||
|
@ -31,7 +31,7 @@ const (
|
||||
)
|
||||
|
||||
// Local is an implementation of EnhancedBackend that performs all operations
|
||||
// locally. This is the "default" backend and implements normal OpenTF
|
||||
// locally. This is the "default" backend and implements normal OpenTofu
|
||||
// behavior as it is well known.
|
||||
type Local struct {
|
||||
// The State* paths are set from the backend config, and may be left blank
|
||||
@ -65,7 +65,7 @@ type Local struct {
|
||||
// here as they're loaded.
|
||||
states map[string]statemgr.Full
|
||||
|
||||
// OpenTF context. Many of these will be overridden or merged by
|
||||
// OpenTofu context. Many of these will be overridden or merged by
|
||||
// Operation. See Operation for more details.
|
||||
ContextOpts *tofu.ContextOpts
|
||||
|
||||
@ -292,8 +292,8 @@ func (b *Local) Operation(ctx context.Context, op *backend.Operation) (*backend.
|
||||
default:
|
||||
return nil, fmt.Errorf(
|
||||
"unsupported operation type: %s\n\n"+
|
||||
"This is a bug in OpenTF and should be reported. The local backend\n"+
|
||||
"is built-in to OpenTF and should always support all operations.",
|
||||
"This is a bug in OpenTofu and should be reported. The local backend\n"+
|
||||
"is built-in to OpenTofu and should always support all operations.",
|
||||
op.Type)
|
||||
}
|
||||
|
||||
@ -492,4 +492,4 @@ func (b *Local) stateWorkspaceDir() string {
|
||||
|
||||
const earlyStateWriteErrorFmt = `Error: %s
|
||||
|
||||
OpenTF encountered an error attempting to save the state before cancelling the current operation. Once the operation is complete another attempt will be made to save the final state.`
|
||||
OpenTofu encountered an error attempting to save the state before cancelling the current operation. Once the operation is complete another attempt will be made to save the final state.`
|
||||
|
@ -42,7 +42,7 @@ func (b *Local) opApply(
|
||||
"No configuration files",
|
||||
"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, run 'opentf destroy' instead.",
|
||||
"If you would like to destroy everything, run 'tofu destroy' instead.",
|
||||
))
|
||||
op.ReportResult(runningOp, diags)
|
||||
return
|
||||
@ -92,8 +92,8 @@ func (b *Local) opApply(
|
||||
plan, moreDiags = lr.Core.Plan(lr.Config, lr.InputState, lr.PlanOpts)
|
||||
diags = diags.Append(moreDiags)
|
||||
if moreDiags.HasErrors() {
|
||||
// If OpenTF Core generated a partial plan despite the errors
|
||||
// then we'll make the best effort to render it. OpenTF Core
|
||||
// If OpenTofu Core generated a partial plan despite the errors
|
||||
// then we'll make the best effort to render it. OpenTofu Core
|
||||
// promises that if it returns a non-nil plan along with errors
|
||||
// then the plan won't necessarily contain all the needed
|
||||
// actions but that any it does include will be properly-formed.
|
||||
@ -136,15 +136,15 @@ func (b *Local) opApply(
|
||||
} else {
|
||||
query = "Do you really want to destroy all resources?"
|
||||
}
|
||||
desc = "OpenTF will destroy all your managed infrastructure, as shown above.\n" +
|
||||
desc = "OpenTofu will destroy all your managed infrastructure, as shown above.\n" +
|
||||
"There is no undo. Only 'yes' will be accepted to confirm."
|
||||
case plans.RefreshOnlyMode:
|
||||
if op.Workspace != "default" {
|
||||
query = "Would you like to update the OpenTF state for \"" + op.Workspace + "\" to reflect these detected changes?"
|
||||
query = "Would you like to update the OpenTofu state for \"" + op.Workspace + "\" to reflect these detected changes?"
|
||||
} else {
|
||||
query = "Would you like to update the OpenTF state to reflect these detected changes?"
|
||||
query = "Would you like to update the OpenTofu state to reflect these detected changes?"
|
||||
}
|
||||
desc = "OpenTF will write these changes to the state without modifying any real infrastructure.\n" +
|
||||
desc = "OpenTofu will write these changes to the state without modifying any real infrastructure.\n" +
|
||||
"There is no undo. Only 'yes' will be accepted to confirm."
|
||||
default:
|
||||
if op.Workspace != "default" {
|
||||
@ -152,7 +152,7 @@ func (b *Local) opApply(
|
||||
} else {
|
||||
query = "Do you want to perform these actions?"
|
||||
}
|
||||
desc = "OpenTF will perform the actions described above.\n" +
|
||||
desc = "OpenTofu will perform the actions described above.\n" +
|
||||
"Only 'yes' will be accepted to approve."
|
||||
}
|
||||
|
||||
@ -212,7 +212,7 @@ func (b *Local) opApply(
|
||||
diags = diags.Append(tfdiags.Sourceless(
|
||||
tfdiags.Error,
|
||||
"Cannot apply incomplete plan",
|
||||
"OpenTF encountered an error when generating this plan, so it cannot be applied.",
|
||||
"OpenTofu encountered an error when generating this plan, so it cannot be applied.",
|
||||
))
|
||||
op.ReportResult(runningOp, diags)
|
||||
return
|
||||
@ -332,29 +332,29 @@ func (b *Local) backupStateForError(stateFile *statefile.File, err error, view v
|
||||
return diags
|
||||
}
|
||||
|
||||
const stateWriteBackedUpError = `The error shown above has prevented OpenTF from writing the updated state to the configured backend. To allow for recovery, the state has been written to the file "errored.tfstate" in the current working directory.
|
||||
const stateWriteBackedUpError = `The error shown above has prevented OpenTofu from writing the updated state to the configured backend. To allow for recovery, the state has been written to the file "errored.tfstate" in the current working directory.
|
||||
|
||||
Running "opentf apply" again at this point will create a forked state, making it harder to recover.
|
||||
Running "tofu apply" again at this point will create a forked state, making it harder to recover.
|
||||
|
||||
To retry writing this state, use the following command:
|
||||
opentf state push errored.tfstate
|
||||
tofu state push errored.tfstate
|
||||
`
|
||||
|
||||
const stateWriteConsoleFallbackError = `The errors shown above prevented OpenTF from writing the updated state to
|
||||
const stateWriteConsoleFallbackError = `The errors shown above prevented OpenTofu from writing the updated state to
|
||||
the configured backend and from creating a local backup file. As a fallback,
|
||||
the raw state data is printed above as a JSON object.
|
||||
|
||||
To retry writing this state, copy the state data (from the first { to the last } inclusive) and save it into a local file called errored.tfstate, then run the following command:
|
||||
opentf state push errored.tfstate
|
||||
tofu state push errored.tfstate
|
||||
`
|
||||
|
||||
const stateWriteFatalErrorFmt = `Failed to save state after apply.
|
||||
|
||||
Error serializing state: %s
|
||||
|
||||
A catastrophic error has prevented OpenTF from persisting the state file or creating a backup. Unfortunately this means that the record of any resources created during this apply has been lost, and such resources may exist outside of OpenTF's management.
|
||||
A catastrophic error has prevented OpenTofu from persisting the state file or creating a backup. Unfortunately this means that the record of any resources created during this apply has been lost, and such resources may exist outside of OpenTofu's management.
|
||||
|
||||
For resources that support import, it is possible to recover by manually importing each resource using its id from the target system.
|
||||
|
||||
This is a serious bug in OpenTF and should be reported.
|
||||
This is a serious bug in OpenTofu and should be reported.
|
||||
`
|
||||
|
@ -78,7 +78,7 @@ func (b *Local) localRun(op *backend.Operation) (*backend.LocalRun, *configload.
|
||||
var ctxDiags tfdiags.Diagnostics
|
||||
var configSnap *configload.Snapshot
|
||||
if op.PlanFile.IsCloud() {
|
||||
diags = diags.Append(fmt.Errorf("error: using a saved cloud plan when executing OpenTF locally is not supported"))
|
||||
diags = diags.Append(fmt.Errorf("error: using a saved cloud plan when executing OpenTofu locally is not supported"))
|
||||
return nil, nil, nil, diags
|
||||
}
|
||||
|
||||
@ -157,11 +157,11 @@ func (b *Local) localRunDirect(op *backend.Operation, run *backend.LocalRun, cor
|
||||
case op.DependencyLocks == nil:
|
||||
// If we get here then it suggests that there's a caller that we
|
||||
// didn't yet update to populate DependencyLocks, which is a bug.
|
||||
suggestion = "This run has no dependency lock information provided at all, which is a bug in OpenTF; please report it!"
|
||||
suggestion = "This run has no dependency lock information provided at all, which is a bug in OpenTofu; please report it!"
|
||||
case op.DependencyLocks.Empty():
|
||||
suggestion = "To make the initial dependency selections that will initialize the dependency lock file, run:\n opentf init"
|
||||
suggestion = "To make the initial dependency selections that will initialize the dependency lock file, run:\n tofu init"
|
||||
default:
|
||||
suggestion = "To update the locked dependency selections to match a changed configuration, run:\n opentf init -upgrade"
|
||||
suggestion = "To update the locked dependency selections to match a changed configuration, run:\n tofu init -upgrade"
|
||||
}
|
||||
diags = diags.Append(tfdiags.Sourceless(
|
||||
tfdiags.Error,
|
||||
@ -366,7 +366,7 @@ func (b *Local) localRunForPlanFile(op *backend.Operation, pf *planfile.Reader,
|
||||
// additional elements as appropriate.
|
||||
//
|
||||
// Interactive prompting is a "best effort" thing for first-time user UX and
|
||||
// not something we expect folks to be relying on for routine use. OpenTF
|
||||
// not something we expect folks to be relying on for routine use. OpenTofu
|
||||
// is primarily a non-interactive tool, and so we prefer to report in error
|
||||
// messages that variables are not set rather than reporting that input failed:
|
||||
// the primary resolution to missing variables is to provide them by some other
|
||||
@ -435,8 +435,8 @@ func (b *Local) interactiveCollectVariables(ctx context.Context, existing map[st
|
||||
//
|
||||
// This function should be used only in situations where variables values
|
||||
// will not be directly used and the variables map is being constructed only
|
||||
// to produce a complete OpenTF context for some ancillary functionality
|
||||
// like "opentf console", "opentf state ...", etc.
|
||||
// to produce a complete OpenTofu context for some ancillary functionality
|
||||
// like "tofu console", "tofu state ...", etc.
|
||||
//
|
||||
// This function is guaranteed not to modify the given map, but it may return
|
||||
// the given map unchanged if no additions are required. If additions are
|
||||
|
@ -49,7 +49,7 @@ func (b *Local) opPlan(
|
||||
"Plan requires configuration to be present. Planning without a configuration would "+
|
||||
"mark everything for destruction, which is normally not what is desired. If you "+
|
||||
"would like to destroy everything, run plan with the -destroy option. Otherwise, "+
|
||||
"create a OpenTF configuration file (.tf file) and try again.",
|
||||
"create a OpenTofu configuration file (.tf file) and try again.",
|
||||
))
|
||||
op.ReportResult(runningOp, diags)
|
||||
return
|
||||
@ -139,7 +139,7 @@ func (b *Local) opPlan(
|
||||
// This is always a bug in the operation caller; it's not valid
|
||||
// to set PlanOutPath without also setting PlanOutBackend.
|
||||
diags = diags.Append(fmt.Errorf(
|
||||
"PlanOutPath set without also setting PlanOutBackend (this is a bug in OpenTF)"),
|
||||
"PlanOutPath set without also setting PlanOutBackend (this is a bug in OpenTofu)"),
|
||||
)
|
||||
op.ReportResult(runningOp, diags)
|
||||
return
|
||||
@ -157,7 +157,7 @@ func (b *Local) opPlan(
|
||||
// there) and so we just use a stub state file header in this case.
|
||||
// NOTE: This won't be exactly identical to the latest state snapshot
|
||||
// in the backend because it's still been subject to state upgrading
|
||||
// to make it consumable by the current OpenTF version, and
|
||||
// to make it consumable by the current OpenTofu version, and
|
||||
// intentionally doesn't preserve the header info.
|
||||
prevStateFile := &statefile.File{
|
||||
State: plan.PrevRunState,
|
||||
@ -204,7 +204,7 @@ func (b *Local) opPlan(
|
||||
// If we've accumulated any diagnostics along the way then we'll show them
|
||||
// here just before we show the summary and next steps. This can potentially
|
||||
// include errors, because we intentionally try to show a partial plan
|
||||
// above even if OpenTF Core encountered an error partway through
|
||||
// above even if OpenTofu Core encountered an error partway through
|
||||
// creating it.
|
||||
op.ReportResult(runningOp, diags)
|
||||
|
||||
|
@ -229,8 +229,8 @@ Changes to Outputs:
|
||||
~ sensitive_after = (sensitive value)
|
||||
~ sensitive_before = (sensitive value)
|
||||
|
||||
You can apply this plan to save these new output values to the OpenTF state,
|
||||
without changing any real infrastructure.
|
||||
You can apply this plan to save these new output values to the OpenTofu
|
||||
state, without changing any real infrastructure.
|
||||
`)
|
||||
|
||||
if output := done(t).Stdout(); !strings.Contains(output, expectedOutput) {
|
||||
@ -322,11 +322,11 @@ func TestLocal_planTainted(t *testing.T) {
|
||||
t.Fatal("plan should not be empty")
|
||||
}
|
||||
|
||||
expectedOutput := `OpenTF used the selected providers to generate the following execution plan.
|
||||
Resource actions are indicated with the following symbols:
|
||||
expectedOutput := `OpenTofu used the selected providers to generate the following execution
|
||||
plan. Resource actions are indicated with the following symbols:
|
||||
-/+ destroy and then create replacement
|
||||
|
||||
OpenTF will perform the following actions:
|
||||
OpenTofu will perform the following actions:
|
||||
|
||||
# test_instance.foo is tainted, so it must be replaced
|
||||
-/+ resource "test_instance" "foo" {
|
||||
@ -403,12 +403,12 @@ func TestLocal_planDeposedOnly(t *testing.T) {
|
||||
|
||||
// The deposed object and the current object are distinct, so our
|
||||
// plan includes separate actions for each of them. This strange situation
|
||||
// is not common: it should arise only if OpenTF fails during
|
||||
// is not common: it should arise only if OpenTofu fails during
|
||||
// a create-before-destroy when the "create" hasn't completed yet but
|
||||
// in a severe way that prevents the previous object from being restored
|
||||
// as "current".
|
||||
//
|
||||
// However, that situation was more common in some earlier OpenTF
|
||||
// However, that situation was more common in some earlier OpenTofu
|
||||
// versions where deposed objects were not managed properly, so this
|
||||
// can arise when upgrading from an older version with deposed objects
|
||||
// already in the state.
|
||||
@ -416,16 +416,16 @@ func TestLocal_planDeposedOnly(t *testing.T) {
|
||||
// This is one of the few cases where we expose the idea of "deposed" in
|
||||
// the UI, including the user-unfriendly "deposed key" (00000000 in this
|
||||
// case) just so that users can correlate this with what they might
|
||||
// see in `opentf show` and in the subsequent apply output, because
|
||||
// see in `tofu show` and in the subsequent apply output, because
|
||||
// it's also possible for there to be _multiple_ deposed objects, in the
|
||||
// unlikely event that create_before_destroy _keeps_ crashing across
|
||||
// subsequent runs.
|
||||
expectedOutput := `OpenTF used the selected providers to generate the following execution plan.
|
||||
Resource actions are indicated with the following symbols:
|
||||
expectedOutput := `OpenTofu used the selected providers to generate the following execution
|
||||
plan. Resource actions are indicated with the following symbols:
|
||||
+ create
|
||||
- destroy
|
||||
|
||||
OpenTF will perform the following actions:
|
||||
OpenTofu will perform the following actions:
|
||||
|
||||
# test_instance.foo will be created
|
||||
+ resource "test_instance" "foo" {
|
||||
@ -492,11 +492,11 @@ func TestLocal_planTainted_createBeforeDestroy(t *testing.T) {
|
||||
t.Fatal("plan should not be empty")
|
||||
}
|
||||
|
||||
expectedOutput := `OpenTF used the selected providers to generate the following execution plan.
|
||||
Resource actions are indicated with the following symbols:
|
||||
expectedOutput := `OpenTofu used the selected providers to generate the following execution
|
||||
plan. Resource actions are indicated with the following symbols:
|
||||
+/- create replacement and then destroy
|
||||
|
||||
OpenTF will perform the following actions:
|
||||
OpenTofu will perform the following actions:
|
||||
|
||||
# test_instance.foo is tainted, so it must be replaced
|
||||
+/- resource "test_instance" "foo" {
|
||||
@ -642,7 +642,7 @@ func TestLocal_planDestroy_withDataSources(t *testing.T) {
|
||||
}
|
||||
|
||||
// Data source should not be rendered in the output
|
||||
expectedOutput := `OpenTF will perform the following actions:
|
||||
expectedOutput := `OpenTofu will perform the following actions:
|
||||
|
||||
# test_instance.foo[0] will be destroyed
|
||||
- resource "test_instance" "foo" {
|
||||
|
@ -46,11 +46,11 @@ type IntermediateStatePersistInfo struct {
|
||||
RequestedPersistInterval time.Duration
|
||||
|
||||
// LastPersist is the time when the last intermediate state snapshot was
|
||||
// persisted, or the time of the first report for OpenTF Core if there
|
||||
// persisted, or the time of the first report for OpenTofu Core if there
|
||||
// hasn't yet been a persisted snapshot.
|
||||
LastPersist time.Time
|
||||
|
||||
// ForcePersist is true when OpenTF CLI has received an interrupt
|
||||
// ForcePersist is true when OpenTofu CLI has received an interrupt
|
||||
// signal and is therefore trying to create snapshots more aggressively
|
||||
// in anticipation of possibly being terminated ungracefully.
|
||||
// [IntermediateStateConditionalPersister] implementations should ideally
|
||||
@ -97,17 +97,17 @@ func (h *StateHook) Stopping() {
|
||||
h.Lock()
|
||||
defer h.Unlock()
|
||||
|
||||
// If OpenTF has been asked to stop then that might mean that a hard
|
||||
// kill signal will follow shortly in case OpenTF doesn't stop
|
||||
// If OpenTofu has been asked to stop then that might mean that a hard
|
||||
// kill signal will follow shortly in case OpenTofu doesn't stop
|
||||
// quickly enough, and so we'll try to persist the latest state
|
||||
// snapshot in the hope that it'll give the user less recovery work to
|
||||
// do if they _do_ subsequently hard-kill OpenTF during an apply.
|
||||
// do if they _do_ subsequently hard-kill OpenTofu during an apply.
|
||||
|
||||
if mgrPersist, ok := h.StateMgr.(statemgr.Persister); ok && h.Schemas != nil {
|
||||
// While we're in the stopping phase we'll try to persist every
|
||||
// new state update to maximize every opportunity we get to avoid
|
||||
// losing track of objects that have been created or updated.
|
||||
// OpenTF Core won't start any new operations after it's been
|
||||
// OpenTofu Core won't start any new operations after it's been
|
||||
// stopped, so at most we should see one more PostStateUpdate
|
||||
// call per already-active request.
|
||||
h.intermediatePersist.ForcePersist = true
|
||||
@ -115,7 +115,7 @@ func (h *StateHook) Stopping() {
|
||||
if h.shouldPersist() {
|
||||
err := mgrPersist.PersistState(h.Schemas)
|
||||
if err != nil {
|
||||
// This hook can't affect OpenTF Core's ongoing behavior,
|
||||
// This hook can't affect OpenTofu Core's ongoing behavior,
|
||||
// but it's a best effort thing anyway, so we'll just emit a
|
||||
// log to aid with debugging.
|
||||
log.Printf("[ERROR] Failed to persist state after interruption: %s", err)
|
||||
@ -146,7 +146,7 @@ func DefaultIntermediateStatePersistRule(info *IntermediateStatePersistInfo) boo
|
||||
|
||||
// IntermediateStateConditionalPersister is an optional extension of
|
||||
// [statemgr.Persister] that allows an implementation to tailor the rules for
|
||||
// whether to create intermediate state snapshots when OpenTF Core emits
|
||||
// whether to create intermediate state snapshots when OpenTofu Core emits
|
||||
// events reporting that the state might have changed.
|
||||
//
|
||||
// For state managers that don't implement this interface, [StateHook] uses
|
||||
@ -156,7 +156,7 @@ func DefaultIntermediateStatePersistRule(info *IntermediateStatePersistInfo) boo
|
||||
// to change over time, but a state manager can implement this interface to
|
||||
// exert full control over those rules.
|
||||
type IntermediateStateConditionalPersister interface {
|
||||
// ShouldPersistIntermediateState will be called each time OpenTF Core
|
||||
// ShouldPersistIntermediateState will be called each time OpenTofu Core
|
||||
// emits an intermediate state event that is potentially eligible to be
|
||||
// persisted.
|
||||
//
|
||||
|
@ -6,7 +6,7 @@ package backend
|
||||
//go:generate go run golang.org/x/tools/cmd/stringer -type=OperationType operation_type.go
|
||||
|
||||
// OperationType is an enum used with Operation to specify the operation
|
||||
// type to perform for OpenTF.
|
||||
// type to perform for OpenTofu.
|
||||
type OperationType uint
|
||||
|
||||
const (
|
||||
|
@ -174,7 +174,7 @@ func New() backend.Backend {
|
||||
"use_azuread_auth": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
Description: "Should OpenTF use AzureAD Authentication to access the Blob?",
|
||||
Description: "Should OpenTofu use AzureAD Authentication to access the Blob?",
|
||||
DefaultFunc: schema.EnvDefaultFunc("ARM_USE_AZUREAD", false),
|
||||
},
|
||||
},
|
||||
|
@ -364,7 +364,7 @@ func (c *RemoteClient) Lock(info *statemgr.LockInfo) (string, error) {
|
||||
c.info = info
|
||||
|
||||
// These checks only are to ensure we strictly follow the specification.
|
||||
// OpenTF shouldn't ever re-lock, so provide errors for the 2 possible
|
||||
// OpenTofu shouldn't ever re-lock, so provide errors for the 2 possible
|
||||
// states if this is called.
|
||||
select {
|
||||
case <-c.lockCh:
|
||||
@ -402,7 +402,7 @@ func (c *RemoteClient) lock() (string, error) {
|
||||
Key: c.lockPath() + lockSuffix,
|
||||
Session: lockSession,
|
||||
|
||||
// only wait briefly, so opentf has the choice to fail fast or
|
||||
// only wait briefly, so tofu has the choice to fail fast or
|
||||
// retry as needed.
|
||||
LockWaitTime: time.Second,
|
||||
LockTryOnce: true,
|
||||
@ -482,7 +482,7 @@ func (c *RemoteClient) lock() (string, error) {
|
||||
|
||||
if err != nil {
|
||||
// We failed to get the lock, keep trying as long as
|
||||
// opentf is running. There may be changes in progress,
|
||||
// tofu is running. There may be changes in progress,
|
||||
// so there's no use in aborting. Either we eventually
|
||||
// reacquire the lock, or a Put will fail on a CAS.
|
||||
log.Printf("[ERROR] could not reacquire lock: %s", err)
|
||||
@ -559,11 +559,11 @@ func (c *RemoteClient) unlock(id string) error {
|
||||
// This method can be called in two circumstances:
|
||||
// - when the plan apply or destroy operation finishes and the lock needs to be released,
|
||||
// the watchdog stopped and the session closed
|
||||
// - when the user calls `opentf force-unlock <lock_id>` in which case
|
||||
// - when the user calls `tofu force-unlock <lock_id>` in which case
|
||||
// we only need to release the lock.
|
||||
|
||||
if c.consulLock == nil || c.lockCh == nil {
|
||||
// The user called `opentf force-unlock <lock_id>`, we just destroy
|
||||
// The user called `tofu force-unlock <lock_id>`, we just destroy
|
||||
// the session which will release the lock, clean the KV store and quit.
|
||||
|
||||
_, err := c.Client.Session().Destroy(id, nil)
|
||||
|
@ -318,7 +318,7 @@ func TestConsul_destroyLock(t *testing.T) {
|
||||
testLock(clientA, lockPath)
|
||||
|
||||
// The release the lock from a second client to test the
|
||||
// `opentf force-unlock <lock_id>` functionality
|
||||
// `tofu force-unlock <lock_id>` functionality
|
||||
s, err = b.StateMgr(backend.DefaultStateName)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
|
@ -142,7 +142,7 @@ func New() backend.Backend {
|
||||
Type: schema.TypeSet,
|
||||
Optional: true,
|
||||
MaxItems: 1,
|
||||
Description: "The `assume_role` block. If provided, opentf will attempt to assume this role using the supplied credentials.",
|
||||
Description: "The `assume_role` block. If provided, tofu will attempt to assume this role using the supplied credentials.",
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"role_arn": {
|
||||
|
@ -196,7 +196,7 @@ func (c *RemoteClient) Lock(info *statemgr.LockInfo) (string, error) {
|
||||
|
||||
lockErr := &statemgr.LockError{
|
||||
Info: currentLockInfo,
|
||||
Err: errors.New("the state is already locked by another opentf client"),
|
||||
Err: errors.New("the state is already locked by another tofu client"),
|
||||
}
|
||||
return "", lockErr
|
||||
}
|
||||
|
@ -350,7 +350,7 @@ func (b *Backend) configure(ctx context.Context) error {
|
||||
}
|
||||
|
||||
if sessionName == "" {
|
||||
sessionName = "opentf"
|
||||
sessionName = "tofu"
|
||||
}
|
||||
if sessionExpiration == 0 {
|
||||
if v := os.Getenv("ALICLOUD_ASSUME_ROLE_SESSION_EXPIRATION"); v != "" {
|
||||
|
@ -51,21 +51,21 @@ func New() backend.Backend {
|
||||
"skip_schema_creation": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
Description: "If set to `true`, OpenTF won't try to create the Postgres schema",
|
||||
Description: "If set to `true`, OpenTofu won't try to create the Postgres schema",
|
||||
DefaultFunc: defaultBoolFunc("PG_SKIP_SCHEMA_CREATION", false),
|
||||
},
|
||||
|
||||
"skip_table_creation": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
Description: "If set to `true`, OpenTF won't try to create the Postgres table",
|
||||
Description: "If set to `true`, OpenTofu won't try to create the Postgres table",
|
||||
DefaultFunc: defaultBoolFunc("PG_SKIP_TABLE_CREATION", false),
|
||||
},
|
||||
|
||||
"skip_index_creation": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
Description: "If set to `true`, OpenTF won't try to create the Postgres index",
|
||||
Description: "If set to `true`, OpenTofu won't try to create the Postgres index",
|
||||
DefaultFunc: defaultBoolFunc("PG_SKIP_INDEX_CREATION", false),
|
||||
},
|
||||
},
|
||||
|
@ -50,7 +50,7 @@ type Remote struct {
|
||||
CLIColor *colorstring.Colorize
|
||||
|
||||
// ContextOpts are the base context options to set when initializing a
|
||||
// new OpenTF context. Many of these will be overridden or merged by
|
||||
// new OpenTofu context. Many of these will be overridden or merged by
|
||||
// Operation. See Operation for more details.
|
||||
ContextOpts *tofu.ContextOpts
|
||||
|
||||
@ -88,7 +88,7 @@ type Remote struct {
|
||||
opLock sync.Mutex
|
||||
|
||||
// ignoreVersionConflict, if true, will disable the requirement that the
|
||||
// local OpenTF version matches the remote workspace's configured
|
||||
// local OpenTofu version matches the remote workspace's configured
|
||||
// version. This will also cause VerifyWorkspaceTerraformVersion to return
|
||||
// a warning diagnostic instead of an error.
|
||||
ignoreVersionConflict bool
|
||||
@ -233,7 +233,7 @@ func (b *Remote) Configure(obj cty.Value) tfdiags.Diagnostics {
|
||||
diags = diags.Append(tfdiags.Sourceless(
|
||||
tfdiags.Error,
|
||||
"Hostname is required for the remote backend",
|
||||
`OpenTF does not provide a default "hostname" attribute, so it must be set to the hostname of the remote backend.`,
|
||||
`OpenTofu does not provide a default "hostname" attribute, so it must be set to the hostname of the remote backend.`,
|
||||
))
|
||||
|
||||
return diags
|
||||
@ -317,7 +317,7 @@ func (b *Remote) Configure(obj cty.Value) tfdiags.Diagnostics {
|
||||
fmt.Sprintf(
|
||||
"Run the following command to generate a token for %s:\n %s",
|
||||
b.hostname,
|
||||
fmt.Sprintf("opentf login %s", b.hostname),
|
||||
fmt.Sprintf("tofu login %s", b.hostname),
|
||||
),
|
||||
))
|
||||
return diags
|
||||
@ -486,14 +486,14 @@ func (b *Remote) checkConstraints(c *disco.Constraints) tfdiags.Diagnostics {
|
||||
excluding = ""
|
||||
}
|
||||
|
||||
summary := fmt.Sprintf("Incompatible OpenTF version v%s", v.String())
|
||||
summary := fmt.Sprintf("Incompatible OpenTofu version v%s", v.String())
|
||||
details := fmt.Sprintf(
|
||||
"The configured remote backend is compatible with OpenTF "+
|
||||
"The configured remote backend is compatible with OpenTofu "+
|
||||
"versions >= %s, <= %s%s.", c.Minimum, c.Maximum, excluding,
|
||||
)
|
||||
|
||||
if action != "" && toVersion != "" {
|
||||
summary = fmt.Sprintf("Please %s OpenTF to %s", action, toVersion)
|
||||
summary = fmt.Sprintf("Please %s OpenTofu to %s", action, toVersion)
|
||||
details += fmt.Sprintf(" Please %s to a supported version and try again.", action)
|
||||
}
|
||||
|
||||
@ -663,7 +663,7 @@ func (b *Remote) StateMgr(name string) (statemgr.Full, error) {
|
||||
Name: tfe.String(name),
|
||||
}
|
||||
|
||||
// We only set the OpenTF Version for the new workspace if this is
|
||||
// We only set the OpenTofu Version for the new workspace if this is
|
||||
// a release candidate or a final release.
|
||||
if tfversion.Prerelease == "" || strings.HasPrefix(tfversion.Prerelease, "rc") {
|
||||
options.TerraformVersion = tfe.String(tfversion.String())
|
||||
@ -685,7 +685,7 @@ func (b *Remote) StateMgr(name string) (statemgr.Full, error) {
|
||||
// Explicitly ignore the pseudo-version "latest" here, as it will cause
|
||||
// plan and apply to always fail.
|
||||
if wsv != tfversion.String() && wsv != "latest" {
|
||||
return nil, fmt.Errorf("Remote workspace OpenTF version %q does not match local OpenTF version %q", workspace.TerraformVersion, tfversion.String())
|
||||
return nil, fmt.Errorf("Remote workspace OpenTofu version %q does not match local OpenTofu version %q", workspace.TerraformVersion, tfversion.String())
|
||||
}
|
||||
}
|
||||
|
||||
@ -694,7 +694,7 @@ func (b *Remote) StateMgr(name string) (statemgr.Full, error) {
|
||||
organization: b.organization,
|
||||
workspace: workspace,
|
||||
|
||||
// This is optionally set during OpenTF Enterprise runs.
|
||||
// This is optionally set during OpenTofu Enterprise runs.
|
||||
runID: os.Getenv("TFE_RUN_ID"),
|
||||
}
|
||||
|
||||
@ -752,14 +752,14 @@ func (b *Remote) Operation(ctx context.Context, op *backend.Operation) (*backend
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// OpenTF remote version conflicts are not a concern for operations. We
|
||||
// OpenTofu remote version conflicts are not a concern for operations. We
|
||||
// are in one of three states:
|
||||
//
|
||||
// - Running remotely, in which case the local version is irrelevant;
|
||||
// - Workspace configured for local operations, in which case the remote
|
||||
// version is meaningless;
|
||||
// - Forcing local operations with a remote backend, which should only
|
||||
// happen in the Terraform Cloud worker, in which case the OpenTF
|
||||
// happen in the Terraform Cloud worker, in which case the OpenTofu
|
||||
// versions by definition match.
|
||||
b.IgnoreVersionConflict()
|
||||
|
||||
@ -785,7 +785,7 @@ func (b *Remote) Operation(ctx context.Context, op *backend.Operation) (*backend
|
||||
case backend.OperationTypeRefresh:
|
||||
return nil, fmt.Errorf(
|
||||
"\n\nThe \"refresh\" operation is not supported when using the \"remote\" backend. " +
|
||||
"Use \"opentf apply -refresh-only\" instead.")
|
||||
"Use \"tofu apply -refresh-only\" instead.")
|
||||
default:
|
||||
return nil, fmt.Errorf(
|
||||
"\n\nThe \"remote\" backend does not support the %q operation.", op.Type)
|
||||
@ -905,8 +905,8 @@ func (b *Remote) cancel(cancelCtx context.Context, op *backend.Operation, r *tfe
|
||||
}
|
||||
|
||||
// IgnoreVersionConflict allows commands to disable the fall-back check that
|
||||
// the local OpenTF version matches the remote workspace's configured
|
||||
// OpenTF version. This should be called by commands where this check is
|
||||
// the local OpenTofu version matches the remote workspace's configured
|
||||
// OpenTofu version. This should be called by commands where this check is
|
||||
// unnecessary, such as those performing remote operations, or read-only
|
||||
// operations. It will also be called if the user uses a command-line flag to
|
||||
// override this check.
|
||||
@ -914,8 +914,8 @@ func (b *Remote) IgnoreVersionConflict() {
|
||||
b.ignoreVersionConflict = true
|
||||
}
|
||||
|
||||
// VerifyWorkspaceTerraformVersion compares the local OpenTF version against
|
||||
// the workspace's configured OpenTF version. If they are equal, this means
|
||||
// VerifyWorkspaceTerraformVersion compares the local OpenTofu version against
|
||||
// the workspace's configured OpenTofu version. If they are equal, this means
|
||||
// that there are no compatibility concerns, so it returns no diagnostics.
|
||||
//
|
||||
// If the versions differ,
|
||||
@ -940,13 +940,13 @@ func (b *Remote) VerifyWorkspaceTerraformVersion(workspaceName string) tfdiags.D
|
||||
}
|
||||
|
||||
// If the workspace has the pseudo-version "latest", all bets are off. We
|
||||
// cannot reasonably determine what the intended OpenTF version is, so
|
||||
// cannot reasonably determine what the intended OpenTofu version is, so
|
||||
// we'll skip version verification.
|
||||
if workspace.TerraformVersion == "latest" {
|
||||
return nil
|
||||
}
|
||||
|
||||
// If the workspace has remote operations disabled, the remote OpenTF
|
||||
// If the workspace has remote operations disabled, the remote OpenTofu
|
||||
// version is effectively meaningless, so we'll skip version verification.
|
||||
if isLocalExecutionMode(workspace.ExecutionMode) {
|
||||
return nil
|
||||
@ -957,22 +957,22 @@ func (b *Remote) VerifyWorkspaceTerraformVersion(workspaceName string) tfdiags.D
|
||||
diags = diags.Append(tfdiags.Sourceless(
|
||||
tfdiags.Error,
|
||||
"Error looking up workspace",
|
||||
fmt.Sprintf("Invalid OpenTF version: %s", err),
|
||||
fmt.Sprintf("Invalid OpenTofu version: %s", err),
|
||||
))
|
||||
return diags
|
||||
}
|
||||
|
||||
v014 := version.Must(version.NewSemver("0.14.0"))
|
||||
if tfversion.SemVer.LessThan(v014) || remoteVersion.LessThan(v014) {
|
||||
// Versions of OpenTF prior to 0.14.0 will refuse to load state files
|
||||
// written by a newer version of OpenTF, even if it is only a patch
|
||||
// Versions of OpenTofu prior to 0.14.0 will refuse to load state files
|
||||
// written by a newer version of OpenTofu, even if it is only a patch
|
||||
// level difference. As a result we require an exact match.
|
||||
if tfversion.SemVer.Equal(remoteVersion) {
|
||||
return diags
|
||||
}
|
||||
}
|
||||
if tfversion.SemVer.GreaterThanOrEqual(v014) && remoteVersion.GreaterThanOrEqual(v014) {
|
||||
// Versions of OpenTF after 0.14.0 should be compatible with each
|
||||
// Versions of OpenTofu after 0.14.0 should be compatible with each
|
||||
// other. At the time this code was written, the only constraints we
|
||||
// are aware of are:
|
||||
//
|
||||
@ -982,7 +982,7 @@ func (b *Remote) VerifyWorkspaceTerraformVersion(workspaceName string) tfdiags.D
|
||||
if tfversion.SemVer.LessThan(v130) && remoteVersion.LessThan(v130) {
|
||||
return diags
|
||||
}
|
||||
// - Any new OpenTF state version will require at least minor patch
|
||||
// - Any new OpenTofu state version will require at least minor patch
|
||||
// increment, so x.y.* will always be compatible with each other
|
||||
tfvs := tfversion.SemVer.Segments64()
|
||||
rwvs := remoteVersion.Segments64()
|
||||
@ -993,21 +993,21 @@ func (b *Remote) VerifyWorkspaceTerraformVersion(workspaceName string) tfdiags.D
|
||||
|
||||
// Even if ignoring version conflicts, it may still be useful to call this
|
||||
// method and warn the user about a mismatch between the local and remote
|
||||
// OpenTF versions.
|
||||
// OpenTofu versions.
|
||||
severity := tfdiags.Error
|
||||
if b.ignoreVersionConflict {
|
||||
severity = tfdiags.Warning
|
||||
}
|
||||
|
||||
suggestion := " 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."
|
||||
suggestion := " If you're sure you want to upgrade the state, you can force OpenTofu to continue using the -ignore-remote-version flag. This may result in an unusable workspace."
|
||||
if b.ignoreVersionConflict {
|
||||
suggestion = ""
|
||||
}
|
||||
diags = diags.Append(tfdiags.Sourceless(
|
||||
severity,
|
||||
"OpenTF version mismatch",
|
||||
"OpenTofu version mismatch",
|
||||
fmt.Sprintf(
|
||||
"The local OpenTF version (%s) does not match the configured version for remote workspace %s/%s (%s).%s",
|
||||
"The local OpenTofu version (%s) does not match the configured version for remote workspace %s/%s (%s).%s",
|
||||
tfversion.String(),
|
||||
b.organization,
|
||||
workspace.Name,
|
||||
@ -1067,7 +1067,7 @@ func checkConstraintsWarning(err error) tfdiags.Diagnostic {
|
||||
// The newline in this error is to make it look good in the CLI!
|
||||
const initialRetryError = `
|
||||
[reset][yellow]There was an error connecting to the remote backend. Please do not exit
|
||||
OpenTF to prevent data loss! Trying to restore the connection...
|
||||
OpenTofu to prevent data loss! Trying to restore the connection...
|
||||
[reset]
|
||||
`
|
||||
|
||||
|
@ -72,7 +72,7 @@ func (b *Remote) opApply(stopCtx, cancelCtx context.Context, op *backend.Operati
|
||||
"Currently the only to way to pass variables to the remote backend is by "+
|
||||
"creating a '*.auto.tfvars' variables file. This file will automatically "+
|
||||
"be loaded by the \"remote\" backend when the workspace is configured to use "+
|
||||
"OpenTF v0.10.0 or later.\n\nAdditionally you can also set variables on "+
|
||||
"OpenTofu v0.10.0 or later.\n\nAdditionally you can also set variables on "+
|
||||
"the workspace in the web UI:\nhttps://%s/app/%s/%s/variables",
|
||||
b.hostname, b.organization, op.Workspace,
|
||||
),
|
||||
@ -85,7 +85,7 @@ func (b *Remote) opApply(stopCtx, cancelCtx context.Context, op *backend.Operati
|
||||
"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 'opentf destroy' which `+
|
||||
`If you would like to destroy everything, please run 'tofu destroy' which `+
|
||||
`does not require any configuration files.`,
|
||||
))
|
||||
}
|
||||
@ -224,11 +224,11 @@ func (b *Remote) opApply(stopCtx, cancelCtx context.Context, op *backend.Operati
|
||||
|
||||
if op.PlanMode == plans.DestroyMode {
|
||||
opts.Query = "\nDo you really want to destroy all resources in workspace \"" + op.Workspace + "\"?"
|
||||
opts.Description = "OpenTF will destroy all your managed infrastructure, as shown above.\n" +
|
||||
opts.Description = "OpenTofu 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 = "OpenTF will perform the actions described above.\n" +
|
||||
opts.Description = "OpenTofu will perform the actions described above.\n" +
|
||||
"Only 'yes' will be accepted to approve."
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,7 @@ func stubAllVariables(vv map[string]backend.UnparsedVariableValue, decls map[str
|
||||
|
||||
// remoteStoredVariableValue is a backend.UnparsedVariableValue implementation
|
||||
// that translates from the go-tfe representation of stored variables into
|
||||
// the OpenTF Core backend representation of variables.
|
||||
// the OpenTofu Core backend representation of variables.
|
||||
type remoteStoredVariableValue struct {
|
||||
definition *tfe.Variable
|
||||
}
|
||||
@ -250,7 +250,7 @@ func (v *remoteStoredVariableValue) ParseVariableValue(mode configs.VariablePars
|
||||
case v.definition.HCL:
|
||||
// If the variable value is marked as being in HCL syntax, we need to
|
||||
// parse it the same way as it would be interpreted in a .tfvars
|
||||
// file because that is how it would get passed to OpenTF CLI for
|
||||
// file because that is how it would get passed to OpenTofu CLI for
|
||||
// a remote operation and we want to mimic that result as closely as
|
||||
// possible.
|
||||
var exprDiags hcl.Diagnostics
|
||||
|
@ -91,7 +91,7 @@ func TestRemoteStoredVariableValue(t *testing.T) {
|
||||
"HCL computation": {
|
||||
// This (stored expressions containing computation) is not a case
|
||||
// we intentionally supported, but it became possible for remote
|
||||
// operations in OpenTF 0.12 (due to Terraform Cloud/Enterprise
|
||||
// operations in OpenTofu 0.12 (due to Terraform Cloud/Enterprise
|
||||
// just writing the HCL verbatim into generated `.tfvars` files).
|
||||
// We support it here for consistency, and we continue to support
|
||||
// it in both places for backward-compatibility. In practice,
|
||||
|
@ -86,7 +86,7 @@ func (b *Remote) opPlan(stopCtx, cancelCtx context.Context, op *backend.Operatio
|
||||
"Currently the only to way to pass variables to the remote backend is by "+
|
||||
"creating a '*.auto.tfvars' variables file. This file will automatically "+
|
||||
"be loaded by the \"remote\" backend when the workspace is configured to use "+
|
||||
"OpenTF v0.10.0 or later.\n\nAdditionally you can also set variables on "+
|
||||
"OpenTofu v0.10.0 or later.\n\nAdditionally you can also set variables on "+
|
||||
"the workspace in the web UI:\nhttps://%s/app/%s/%s/variables",
|
||||
b.hostname, b.organization, op.Workspace,
|
||||
),
|
||||
@ -101,7 +101,7 @@ func (b *Remote) opPlan(stopCtx, cancelCtx context.Context, op *backend.Operatio
|
||||
`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 OpenTF configuration file in the path being executed and try again.`,
|
||||
`a OpenTofu configuration file in the path being executed and try again.`,
|
||||
))
|
||||
}
|
||||
|
||||
@ -229,7 +229,7 @@ func (b *Remote) plan(stopCtx, cancelCtx context.Context, op *backend.Operation,
|
||||
The remote workspace is configured to work with configuration at
|
||||
%s relative to the target repository.
|
||||
|
||||
OpenTF will upload the contents of the following directory,
|
||||
OpenTofu 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:
|
||||
|
@ -951,7 +951,7 @@ func TestRemote_planWithWorkingDirectory(t *testing.T) {
|
||||
defer bCleanup()
|
||||
|
||||
options := tfe.WorkspaceUpdateOptions{
|
||||
WorkingDirectory: tfe.String("opentf"),
|
||||
WorkingDirectory: tfe.String("tofu"),
|
||||
}
|
||||
|
||||
// Configure the workspace to use a custom working directory.
|
||||
@ -960,7 +960,7 @@ func TestRemote_planWithWorkingDirectory(t *testing.T) {
|
||||
t.Fatalf("error configuring working directory: %v", err)
|
||||
}
|
||||
|
||||
op, configCleanup, done := testOperationPlan(t, "./testdata/plan-with-working-directory/opentf")
|
||||
op, configCleanup, done := testOperationPlan(t, "./testdata/plan-with-working-directory/tofu")
|
||||
defer configCleanup()
|
||||
defer done(t)
|
||||
|
||||
@ -996,7 +996,7 @@ func TestRemote_planWithWorkingDirectoryFromCurrentPath(t *testing.T) {
|
||||
defer bCleanup()
|
||||
|
||||
options := tfe.WorkspaceUpdateOptions{
|
||||
WorkingDirectory: tfe.String("opentf"),
|
||||
WorkingDirectory: tfe.String("tofu"),
|
||||
}
|
||||
|
||||
// Configure the workspace to use a custom working directory.
|
||||
@ -1012,7 +1012,7 @@ func TestRemote_planWithWorkingDirectoryFromCurrentPath(t *testing.T) {
|
||||
|
||||
// We need to change into the configuration directory to make sure
|
||||
// the logic to upload the correct slug is working as expected.
|
||||
if err := os.Chdir("./testdata/plan-with-working-directory/opentf"); err != nil {
|
||||
if err := os.Chdir("./testdata/plan-with-working-directory/tofu"); err != nil {
|
||||
t.Fatalf("error changing directory: %v", err)
|
||||
}
|
||||
defer os.Chdir(wd) // Make sure we change back again when were done.
|
||||
|
@ -92,7 +92,7 @@ func (r *remoteClient) uploadStateFallback(ctx context.Context, stateFile *state
|
||||
func (r *remoteClient) Put(state []byte) error {
|
||||
ctx := context.Background()
|
||||
|
||||
// Read the raw state into a OpenTF state.
|
||||
// Read the raw state into a OpenTofu state.
|
||||
stateFile, err := statefile.Read(bytes.NewReader(state))
|
||||
if err != nil {
|
||||
return fmt.Errorf("error reading state: %w", err)
|
||||
@ -164,7 +164,7 @@ func (r *remoteClient) Lock(info *statemgr.LockInfo) (string, error) {
|
||||
|
||||
// Lock the workspace.
|
||||
_, err := r.client.Workspaces.Lock(ctx, r.workspace.ID, tfe.WorkspaceLockOptions{
|
||||
Reason: tfe.String("Locked by OpenTF"),
|
||||
Reason: tfe.String("Locked by OpenTofu"),
|
||||
})
|
||||
if err != nil {
|
||||
if err == tfe.ErrWorkspaceLocked {
|
||||
|
@ -95,7 +95,7 @@ func TestRemote_config(t *testing.T) {
|
||||
"prefix": cty.NullVal(cty.String),
|
||||
}),
|
||||
}),
|
||||
confErr: "opentf login localhost",
|
||||
confErr: "tofu login localhost",
|
||||
},
|
||||
"with_a_name": {
|
||||
config: cty.ObjectVal(map[string]cty.Value{
|
||||
@ -198,7 +198,7 @@ func TestRemote_versionConstraints(t *testing.T) {
|
||||
}),
|
||||
}),
|
||||
version: "0.0.1",
|
||||
result: "upgrade OpenTF to >= 0.1.0",
|
||||
result: "upgrade OpenTofu to >= 0.1.0",
|
||||
},
|
||||
"version too new": {
|
||||
config: cty.ObjectVal(map[string]cty.Value{
|
||||
@ -211,7 +211,7 @@ func TestRemote_versionConstraints(t *testing.T) {
|
||||
}),
|
||||
}),
|
||||
version: "10.0.1",
|
||||
result: "downgrade OpenTF to <= 10.0.0",
|
||||
result: "downgrade OpenTofu to <= 10.0.0",
|
||||
},
|
||||
}
|
||||
|
||||
@ -391,7 +391,7 @@ func TestRemote_checkConstraints(t *testing.T) {
|
||||
Maximum: "0.11.11",
|
||||
},
|
||||
version: "0.10.1",
|
||||
result: "upgrade OpenTF to >= 0.11.0",
|
||||
result: "upgrade OpenTofu to >= 0.11.0",
|
||||
},
|
||||
"version too new": {
|
||||
constraints: &disco.Constraints{
|
||||
@ -399,7 +399,7 @@ func TestRemote_checkConstraints(t *testing.T) {
|
||||
Maximum: "0.11.11",
|
||||
},
|
||||
version: "0.12.0",
|
||||
result: "downgrade OpenTF to <= 0.11.11",
|
||||
result: "downgrade OpenTofu to <= 0.11.11",
|
||||
},
|
||||
"version excluded - ordered": {
|
||||
constraints: &disco.Constraints{
|
||||
@ -408,7 +408,7 @@ func TestRemote_checkConstraints(t *testing.T) {
|
||||
Maximum: "0.11.11",
|
||||
},
|
||||
version: "0.11.7",
|
||||
result: "upgrade OpenTF to > 0.11.8",
|
||||
result: "upgrade OpenTofu to > 0.11.8",
|
||||
},
|
||||
"version excluded - unordered": {
|
||||
constraints: &disco.Constraints{
|
||||
@ -417,7 +417,7 @@ func TestRemote_checkConstraints(t *testing.T) {
|
||||
Maximum: "0.11.11",
|
||||
},
|
||||
version: "0.11.6",
|
||||
result: "upgrade OpenTF to > 0.11.8",
|
||||
result: "upgrade OpenTofu to > 0.11.8",
|
||||
},
|
||||
"list versions": {
|
||||
constraints: &disco.Constraints{
|
||||
@ -493,7 +493,7 @@ func TestRemote_StateMgr_versionCheck(t *testing.T) {
|
||||
tfversion.Version = v0140.String()
|
||||
tfversion.SemVer = v0140
|
||||
|
||||
// Update the mock remote workspace OpenTF version to match the local
|
||||
// Update the mock remote workspace OpenTofu version to match the local
|
||||
// Terraform version
|
||||
if _, err := b.client.Workspaces.Update(
|
||||
context.Background(),
|
||||
@ -524,7 +524,7 @@ func TestRemote_StateMgr_versionCheck(t *testing.T) {
|
||||
}
|
||||
|
||||
// This should fail
|
||||
want := `Remote workspace OpenTF version "0.13.5" does not match local OpenTF version "0.14.0"`
|
||||
want := `Remote workspace OpenTofu version "0.13.5" does not match local OpenTofu version "0.14.0"`
|
||||
if _, err := b.StateMgr(backend.DefaultStateName); err.Error() != want {
|
||||
t.Fatalf("wrong error\n got: %v\nwant: %v", err.Error(), want)
|
||||
}
|
||||
@ -609,7 +609,7 @@ func TestRemote_VerifyWorkspaceTerraformVersion(t *testing.T) {
|
||||
tfversion.Version = local.String()
|
||||
tfversion.SemVer = local
|
||||
|
||||
// Update the mock remote workspace OpenTF version to the
|
||||
// Update the mock remote workspace OpenTofu version to the
|
||||
// specified remote version
|
||||
if _, err := b.client.Workspaces.Update(
|
||||
context.Background(),
|
||||
@ -628,7 +628,7 @@ func TestRemote_VerifyWorkspaceTerraformVersion(t *testing.T) {
|
||||
if len(diags) != 1 {
|
||||
t.Fatal("expected diag, but none returned")
|
||||
}
|
||||
if got := diags.Err().Error(); !strings.Contains(got, "OpenTF version mismatch") {
|
||||
if got := diags.Err().Error(); !strings.Contains(got, "OpenTofu version mismatch") {
|
||||
t.Fatalf("unexpected error: %s", got)
|
||||
}
|
||||
} else {
|
||||
@ -661,7 +661,7 @@ func TestRemote_VerifyWorkspaceTerraformVersion_workspaceErrors(t *testing.T) {
|
||||
t.Fatalf("unexpected error: %s", got)
|
||||
}
|
||||
|
||||
// Update the mock remote workspace OpenTF version to an invalid version
|
||||
// Update the mock remote workspace OpenTofu version to an invalid version
|
||||
if _, err := b.client.Workspaces.Update(
|
||||
context.Background(),
|
||||
b.organization,
|
||||
@ -677,7 +677,7 @@ func TestRemote_VerifyWorkspaceTerraformVersion_workspaceErrors(t *testing.T) {
|
||||
if len(diags) != 1 {
|
||||
t.Fatal("expected diag, but none returned")
|
||||
}
|
||||
if got := diags.Err().Error(); !strings.Contains(got, "Error looking up workspace: Invalid OpenTF version") {
|
||||
if got := diags.Err().Error(); !strings.Contains(got, "Error looking up workspace: Invalid OpenTofu version") {
|
||||
t.Fatalf("unexpected error: %s", got)
|
||||
}
|
||||
}
|
||||
@ -708,7 +708,7 @@ func TestRemote_VerifyWorkspaceTerraformVersion_ignoreFlagSet(t *testing.T) {
|
||||
tfversion.Version = local.String()
|
||||
tfversion.SemVer = local
|
||||
|
||||
// Update the mock remote workspace OpenTF version to the
|
||||
// Update the mock remote workspace OpenTofu version to the
|
||||
// specified remote version
|
||||
if _, err := b.client.Workspaces.Update(
|
||||
context.Background(),
|
||||
@ -729,10 +729,10 @@ func TestRemote_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, "OpenTF version mismatch"; got != want {
|
||||
if got, want := diags[0].Description().Summary, "OpenTofu version mismatch"; got != want {
|
||||
t.Errorf("wrong summary: got %s, want %s", got, want)
|
||||
}
|
||||
wantDetail := "The local OpenTF version (0.14.0) does not match the configured version for remote workspace hashicorp/prod (0.13.5)."
|
||||
wantDetail := "The local OpenTofu version (0.14.0) does not match the configured version for remote workspace hashicorp/prod (0.13.5)."
|
||||
if got := diags[0].Description().Detail; got != wantDetail {
|
||||
t.Errorf("wrong summary: got %s, want %s", got, wantDetail)
|
||||
}
|
||||
|
@ -167,17 +167,17 @@ func ParseVariableValues(vv map[string]UnparsedVariableValue, decls map[string]*
|
||||
|
||||
// By this point we should've gathered all the required root module
|
||||
// variables from one of the many possible sources. We'll now populate
|
||||
// any we haven't gathered as unset placeholders which OpenTF Core
|
||||
// any we haven't gathered as unset placeholders which OpenTofu Core
|
||||
// can then react to.
|
||||
for name, vc := range decls {
|
||||
if isDefinedAny(name, ret, undeclared) {
|
||||
continue
|
||||
}
|
||||
|
||||
// This check is redundant with a check made in OpenTF Core when
|
||||
// This check is redundant with a check made in OpenTofu Core when
|
||||
// processing undeclared variables, but allows us to generate a more
|
||||
// specific error message which mentions -var and -var-file command
|
||||
// line options, whereas the one in OpenTF Core is more general
|
||||
// line options, whereas the one in OpenTofu Core is more general
|
||||
// due to supporting both root and child module variables.
|
||||
if vc.Required() {
|
||||
diags = diags.Append(&hcl.Diagnostic{
|
||||
@ -198,9 +198,9 @@ func ParseVariableValues(vv map[string]UnparsedVariableValue, decls map[string]*
|
||||
}
|
||||
} else {
|
||||
// We're still required to put an entry for this variable
|
||||
// in the mapping to be explicit to OpenTF Core that we
|
||||
// in the mapping to be explicit to OpenTofu Core that we
|
||||
// visited it, but its value will be cty.NilVal to represent
|
||||
// that it wasn't set at all at this layer, and so OpenTF Core
|
||||
// that it wasn't set at all at this layer, and so OpenTofu Core
|
||||
// should substitute a default if available, or generate an error
|
||||
// if not.
|
||||
ret[name] = &tofu.InputValue{
|
||||
|
@ -207,7 +207,7 @@ func TestUnparsedValue(t *testing.T) {
|
||||
},
|
||||
},
|
||||
"missing2": {
|
||||
Value: cty.NilVal, // OpenTF Core handles substituting the default
|
||||
Value: cty.NilVal, // OpenTofu Core handles substituting the default
|
||||
SourceType: tofu.ValueFromConfig,
|
||||
SourceRange: tfdiags.SourceRange{
|
||||
Filename: "fake.tf",
|
||||
|
@ -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 opentf apply %q", path),
|
||||
fmt.Sprintf("If this plan was created using plan -destroy, apply it using:\n tofu 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 OpenTF command that generated this plan file.",
|
||||
"The given plan file does not have a valid backend configuration. This is a bug in the OpenTofu 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: opentf [global options] apply [options] [PLAN]
|
||||
Usage: tofu [global options] apply [options] [PLAN]
|
||||
|
||||
Creates or updates infrastructure according to OpenTF configuration
|
||||
Creates or updates infrastructure according to OpenTofu configuration
|
||||
files in the current directory.
|
||||
|
||||
By default, OpenTF will generate a new plan and present it for your
|
||||
By default, OpenTofu 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 "opentf plan", in which case
|
||||
OpenTF will take the actions described in that plan without any
|
||||
file created by a previous call to "tofu plan", in which case
|
||||
OpenTofu 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 OpenTF produces any warnings that are not
|
||||
-compact-warnings If OpenTofu produces any warnings that are not
|
||||
accompanied by errors, show them in a more compact
|
||||
form that includes only the summary messages.
|
||||
|
||||
-destroy Destroy OpenTF-managed infrastructure.
|
||||
The command "opentf destroy" is a convenience alias
|
||||
-destroy Destroy OpenTofu-managed infrastructure.
|
||||
The command "tofu 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 opentf plan command.
|
||||
all of the plan-customization options accepted by the tofu plan command.
|
||||
For more information on those options, run:
|
||||
opentf plan -help
|
||||
tofu plan -help
|
||||
`
|
||||
return strings.TrimSpace(helpText)
|
||||
}
|
||||
|
||||
func (c *ApplyCommand) helpDestroy() string {
|
||||
helpText := `
|
||||
Usage: opentf [global options] destroy [options]
|
||||
Usage: tofu [global options] destroy [options]
|
||||
|
||||
Destroy OpenTF-managed infrastructure.
|
||||
Destroy OpenTofu-managed infrastructure.
|
||||
|
||||
This command is a convenience alias for:
|
||||
opentf apply -destroy
|
||||
tofu apply -destroy
|
||||
|
||||
This command also accepts many of the plan-customization options accepted by
|
||||
the opentf plan command. For more information on those options, run:
|
||||
opentf plan -help
|
||||
the tofu plan command. For more information on those options, run:
|
||||
tofu plan -help
|
||||
`
|
||||
return strings.TrimSpace(helpText)
|
||||
}
|
||||
|
@ -1708,7 +1708,7 @@ func TestApply_disableBackup(t *testing.T) {
|
||||
func TestApply_terraformEnv(t *testing.T) {
|
||||
// Create a temporary working directory that is empty
|
||||
td := t.TempDir()
|
||||
testCopyDir(t, testFixturePath("apply-opentf-workspace"), td)
|
||||
testCopyDir(t, testFixturePath("apply-tofu-workspace"), td)
|
||||
defer testChdir(t, td)()
|
||||
|
||||
statePath := testTempFile(t)
|
||||
@ -1745,7 +1745,7 @@ output = default
|
||||
func TestApply_terraformEnvNonDefault(t *testing.T) {
|
||||
// Create a temporary working directory that is empty
|
||||
td := t.TempDir()
|
||||
testCopyDir(t, testFixturePath("apply-opentf-workspace"), td)
|
||||
testCopyDir(t, testFixturePath("apply-tofu-workspace"), td)
|
||||
defer testChdir(t, td)()
|
||||
|
||||
// Create new env
|
||||
@ -2126,7 +2126,7 @@ func TestApply_warnings(t *testing.T) {
|
||||
wantWarnings := []string{
|
||||
"warning 1",
|
||||
"warning 2",
|
||||
"To see the full warning notes, run OpenTF without -compact-warnings.",
|
||||
"To see the full warning notes, run OpenTofu without -compact-warnings.",
|
||||
}
|
||||
for _, want := range wantWarnings {
|
||||
if !strings.Contains(output.Stdout(), want) {
|
||||
|
@ -83,7 +83,7 @@ func ParseApply(args []string) (*Apply, tfdiags.Diagnostics) {
|
||||
diags = diags.Append(tfdiags.Sourceless(
|
||||
tfdiags.Error,
|
||||
"Plan file or auto-approve required",
|
||||
"OpenTF cannot ask for interactive approval when -json is set. You can either apply a saved plan file, or enable the -auto-approve option.",
|
||||
"OpenTofu cannot ask for interactive approval when -json is set. You can either apply a saved plan file, or enable the -auto-approve option.",
|
||||
))
|
||||
}
|
||||
|
||||
@ -100,13 +100,13 @@ func ParseApply(args []string) (*Apply, tfdiags.Diagnostics) {
|
||||
}
|
||||
|
||||
// ParseApplyDestroy is a special case of ParseApply that deals with the
|
||||
// "opentf destroy" command, which is effectively an alias for
|
||||
// "opentf apply -destroy".
|
||||
// "tofu destroy" command, which is effectively an alias for
|
||||
// "tofu apply -destroy".
|
||||
func ParseApplyDestroy(args []string) (*Apply, tfdiags.Diagnostics) {
|
||||
apply, diags := ParseApply(args)
|
||||
|
||||
// So far ParseApply was using the command line options like -destroy
|
||||
// and -refresh-only to determine the plan mode. For "opentf destroy"
|
||||
// and -refresh-only to determine the plan mode. For "tofu destroy"
|
||||
// we expect neither of those arguments to be set, and so the plan mode
|
||||
// should currently be set to NormalMode, which we'll replace with
|
||||
// DestroyMode here. If it's already set to something else then that
|
||||
@ -121,13 +121,13 @@ func ParseApplyDestroy(args []string) (*Apply, tfdiags.Diagnostics) {
|
||||
diags = diags.Append(tfdiags.Sourceless(
|
||||
tfdiags.Error,
|
||||
"Invalid mode option",
|
||||
"The -destroy option is not valid for \"opentf destroy\", because this command always runs in destroy mode.",
|
||||
"The -destroy option is not valid for \"tofu destroy\", because this command always runs in destroy mode.",
|
||||
))
|
||||
case plans.RefreshOnlyMode:
|
||||
diags = diags.Append(tfdiags.Sourceless(
|
||||
tfdiags.Error,
|
||||
"Invalid mode option",
|
||||
"The -refresh-only option is not valid for \"opentf destroy\".",
|
||||
"The -refresh-only option is not valid for \"tofu destroy\".",
|
||||
))
|
||||
default:
|
||||
// This is a non-ideal error message for if we forget to handle a
|
||||
@ -136,7 +136,7 @@ func ParseApplyDestroy(args []string) (*Apply, tfdiags.Diagnostics) {
|
||||
diags = diags.Append(tfdiags.Sourceless(
|
||||
tfdiags.Error,
|
||||
"Invalid mode option",
|
||||
fmt.Sprintf("The \"opentf destroy\" command doesn't support %s.", apply.Operation.PlanMode),
|
||||
fmt.Sprintf("The \"tofu destroy\" command doesn't support %s.", apply.Operation.PlanMode),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -16,11 +16,11 @@ import (
|
||||
"github.com/opentofu/opentofu/internal/tfdiags"
|
||||
)
|
||||
|
||||
// DefaultParallelism is the limit OpenTF places on total parallel
|
||||
// DefaultParallelism is the limit OpenTofu places on total parallel
|
||||
// operations as it walks the dependency graph.
|
||||
const DefaultParallelism = 10
|
||||
|
||||
// State describes arguments which are used to define how OpenTF interacts
|
||||
// State describes arguments which are used to define how OpenTofu interacts
|
||||
// with state.
|
||||
type State struct {
|
||||
// Lock controls whether or not the state manager is used to lock state
|
||||
@ -47,7 +47,7 @@ type State struct {
|
||||
BackupPath string
|
||||
}
|
||||
|
||||
// Operation describes arguments which are used to configure how a OpenTF
|
||||
// Operation describes arguments which are used to configure how a OpenTofu
|
||||
// operation such as a plan or apply executes.
|
||||
type Operation struct {
|
||||
// PlanMode selects one of the mutually-exclusive planning modes that
|
||||
@ -55,7 +55,7 @@ type Operation struct {
|
||||
// only for an operation that produces a plan.
|
||||
PlanMode plans.Mode
|
||||
|
||||
// Parallelism is the limit OpenTF places on total parallel operations
|
||||
// Parallelism is the limit OpenTofu places on total parallel operations
|
||||
// as it walks the dependency graph.
|
||||
Parallelism int
|
||||
|
||||
@ -67,7 +67,7 @@ type Operation struct {
|
||||
// their dependencies.
|
||||
Targets []addrs.Targetable
|
||||
|
||||
// ForceReplace addresses cause OpenTF to force a particular set of
|
||||
// ForceReplace addresses cause OpenTofu to force a particular set of
|
||||
// resource instances to generate "replace" actions in any plan where they
|
||||
// would normally have generated "no-op" or "update" actions.
|
||||
//
|
||||
@ -170,7 +170,7 @@ func (o *Operation) Parse() tfdiags.Diagnostics {
|
||||
diags = diags.Append(tfdiags.Sourceless(
|
||||
tfdiags.Error,
|
||||
"Incompatible refresh options",
|
||||
"It doesn't make sense to use -refresh-only at the same time as -refresh=false, because OpenTF would have nothing to do.",
|
||||
"It doesn't make sense to use -refresh-only at the same time as -refresh=false, because OpenTofu would have nothing to do.",
|
||||
))
|
||||
}
|
||||
default:
|
||||
|
@ -25,7 +25,7 @@ type Plan struct {
|
||||
// OutPath contains an optional path to store the plan file
|
||||
OutPath string
|
||||
|
||||
// GenerateConfigPath tells OpenTF that config should be generated for
|
||||
// GenerateConfigPath tells OpenTofu that config should be generated for
|
||||
// unmatched import target paths and which path the generated file should
|
||||
// be written to.
|
||||
GenerateConfigPath string
|
||||
|
@ -18,7 +18,7 @@ type Validate struct {
|
||||
// Path.
|
||||
TestDirectory string
|
||||
|
||||
// NoTests indicates that OpenTF should not validate any test files
|
||||
// NoTests indicates that OpenTofu should not validate any test files
|
||||
// included with the module.
|
||||
NoTests bool
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// The CLI config is a small collection of settings that a user can override via
|
||||
// some files in their home directory or, in some cases, via environment
|
||||
// variables. The CLI config is not the same thing as a OpenTF configuration
|
||||
// variables. The CLI config is not the same thing as a OpenTofu configuration
|
||||
// written in the Terraform language; the logic for those lives in the top-level
|
||||
// directory "configs".
|
||||
package cliconfig
|
||||
@ -30,9 +30,9 @@ import (
|
||||
const pluginCacheDirEnvVar = "TF_PLUGIN_CACHE_DIR"
|
||||
const pluginCacheMayBreakLockFileEnvVar = "TF_PLUGIN_CACHE_MAY_BREAK_DEPENDENCY_LOCK_FILE"
|
||||
|
||||
// Config is the structure of the configuration for the OpenTF CLI.
|
||||
// Config is the structure of the configuration for the OpenTofu CLI.
|
||||
//
|
||||
// This is not the configuration for OpenTF itself. That is in the
|
||||
// This is not the configuration for OpenTofu itself. That is in the
|
||||
// "config" package.
|
||||
type Config struct {
|
||||
Providers map[string]string
|
||||
@ -46,9 +46,9 @@ type Config struct {
|
||||
// those who wish to use the Plugin Cache Dir even in cases where doing so
|
||||
// will cause the dependency lock file to be incomplete.
|
||||
//
|
||||
// This is likely to become a silent no-op in future OpenTF versions but
|
||||
// This is likely to become a silent no-op in future OpenTofu versions but
|
||||
// is here in recognition of the fact that the dependency lock file is not
|
||||
// yet a good fit for all OpenTF workflows and folks in that category
|
||||
// yet a good fit for all OpenTofu workflows and folks in that category
|
||||
// would prefer to have the plugin cache dir's behavior to take priority
|
||||
// over the requirements of the dependency lock file.
|
||||
PluginCacheMayBreakDependencyLockFile bool `hcl:"plugin_cache_may_break_dependency_lock_file"`
|
||||
@ -84,14 +84,14 @@ var BuiltinConfig Config
|
||||
|
||||
// ConfigFile returns the default path to the configuration file.
|
||||
//
|
||||
// On Unix-like systems this is the ".opentfrc" file in the home directory.
|
||||
// On Windows, this is the "opentf.rc" file in the application data
|
||||
// On Unix-like systems this is the ".tofurc" file in the home directory.
|
||||
// On Windows, this is the "tofu.rc" file in the application data
|
||||
// directory.
|
||||
func ConfigFile() (string, error) {
|
||||
return configFile()
|
||||
}
|
||||
|
||||
// ConfigDir returns the configuration directory for OpenTF.
|
||||
// ConfigDir returns the configuration directory for OpenTofu.
|
||||
func ConfigDir() (string, error) {
|
||||
return configDir()
|
||||
}
|
||||
@ -119,7 +119,7 @@ func LoadConfig() (*Config, tfdiags.Diagnostics) {
|
||||
// in the config directory. We skip the config directory when source
|
||||
// file override is set because we interpret the environment variable
|
||||
// being set as an intention to ignore the default set of CLI config
|
||||
// files because we're doing something special, like running OpenTF
|
||||
// files because we're doing something special, like running OpenTofu
|
||||
// in automation with a locally-customized configuration.
|
||||
if cliConfigFileOverride() == "" {
|
||||
if configDir, err := ConfigDir(); err == nil {
|
||||
@ -143,7 +143,7 @@ func LoadConfig() (*Config, tfdiags.Diagnostics) {
|
||||
return config, diags
|
||||
}
|
||||
|
||||
// loadConfigFile loads the CLI configuration from ".opentfrc" files.
|
||||
// loadConfigFile loads the CLI configuration from ".tofurc" files.
|
||||
func loadConfigFile(path string) (*Config, tfdiags.Diagnostics) {
|
||||
var diags tfdiags.Diagnostics
|
||||
result := &Config{}
|
||||
|
@ -19,7 +19,7 @@ func configFile() (string, error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
newConfigFile := filepath.Join(dir, ".opentfrc")
|
||||
newConfigFile := filepath.Join(dir, ".tofurc")
|
||||
legacyConfigFile := filepath.Join(dir, ".terraformrc")
|
||||
|
||||
return getNewOrLegacyPath(newConfigFile, legacyConfigFile)
|
||||
|
@ -26,7 +26,7 @@ func configFile() (string, error) {
|
||||
}
|
||||
|
||||
newConfigFile := filepath.Join(dir, "terraform.rc")
|
||||
oldConfigFile := filepath.Join(dir, "opentf.rc")
|
||||
oldConfigFile := filepath.Join(dir, "tofu.rc")
|
||||
|
||||
return getNewOrLegacyPath(newConfigFile, oldConfigFile)
|
||||
}
|
||||
|
@ -150,12 +150,12 @@ func collectCredentialsFromEnv() map[svchost.Hostname]string {
|
||||
// libraries that might interfere with how they are encoded, we'll
|
||||
// be tolerant of them being given either directly as UTF-8 IDNs
|
||||
// or in Punycode form, normalizing to Punycode form here because
|
||||
// that is what the OpenTF credentials helper protocol will
|
||||
// that is what the OpenTofu credentials helper protocol will
|
||||
// use in its requests.
|
||||
//
|
||||
// Using ForDisplay first here makes this more liberal than OpenTF
|
||||
// Using ForDisplay first here makes this more liberal than OpenTofu
|
||||
// itself would usually be in that it will tolerate pre-punycoded
|
||||
// hostnames that OpenTF normally rejects in other contexts in order
|
||||
// hostnames that OpenTofu normally rejects in other contexts in order
|
||||
// to ensure stored hostnames are human-readable.
|
||||
dispHost := svchost.ForDisplay(rawHost)
|
||||
hostname, err := svchost.ForComparison(dispHost)
|
||||
|
@ -31,7 +31,7 @@ type ProviderInstallation struct {
|
||||
// This is _not_ intended for "production" use because it bypasses the
|
||||
// usual version selection and checksum verification mechanisms for
|
||||
// the providers in question. To make that intent/effect clearer, some
|
||||
// OpenTF commands emit warnings when overrides are present. Local
|
||||
// OpenTofu commands emit warnings when overrides are present. Local
|
||||
// mirror directories are a better way to distribute "released"
|
||||
// providers, because they are still subject to version constraints and
|
||||
// checksum verification.
|
||||
|
@ -6,7 +6,7 @@ credentials "example.com" {
|
||||
credentials "example.net" {
|
||||
# Username and password are not currently supported, but we want to tolerate
|
||||
# unknown keys in case future versions add new keys when both old and new
|
||||
# versions of OpenTF are installed on a system, sharing the same
|
||||
# versions of OpenTofu are installed on a system, sharing the same
|
||||
# CLI config.
|
||||
username = "foo"
|
||||
password = "baz"
|
||||
|
@ -23,18 +23,18 @@ const (
|
||||
LockThreshold = 400 * time.Millisecond
|
||||
LockErrorMessage = `Error message: %s
|
||||
|
||||
OpenTF acquires a state lock to protect the state from being written
|
||||
OpenTofu acquires a state lock to protect the state from being written
|
||||
by multiple users at the same time. Please resolve the issue above and try
|
||||
again. For most commands, you can disable locking with the "-lock=false"
|
||||
flag, but this is not recommended.`
|
||||
|
||||
UnlockErrorMessage = `Error message: %s
|
||||
|
||||
OpenTF acquires a lock when accessing your state to prevent others
|
||||
running OpenTF to potentially modify the state at the same time. An
|
||||
OpenTofu acquires a lock when accessing your state to prevent others
|
||||
running OpenTofu to potentially modify the state at the same time. An
|
||||
error occurred while releasing this lock. This could mean that the lock
|
||||
did or did not release properly. If the lock didn't release properly,
|
||||
OpenTF may not be able to run future commands since it'll appear as if
|
||||
OpenTofu may not be able to run future commands since it'll appear as if
|
||||
the lock is held.
|
||||
|
||||
In this scenario, please call the "force-unlock" command to unlock the
|
||||
|
@ -74,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 OpenTF.")
|
||||
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 OpenTofu.")
|
||||
return ExitRPCError
|
||||
}
|
||||
return cloud1.Execute(args, stdout, stderr)
|
||||
|
@ -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 OpenTF defines how OpenTF operates. The default
|
||||
The "backend" in OpenTofu defines how OpenTofu 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.
|
||||
|
@ -1117,11 +1117,11 @@ func checkGoldenReference(t *testing.T, output *terminal.TestOutput, fixturePath
|
||||
|
||||
// Verify that the log starts with a version message
|
||||
type versionMessage struct {
|
||||
Level string `json:"@level"`
|
||||
Message string `json:"@message"`
|
||||
Type string `json:"type"`
|
||||
OpenTF string `json:"opentf"`
|
||||
UI string `json:"ui"`
|
||||
Level string `json:"@level"`
|
||||
Message string `json:"@message"`
|
||||
Type string `json:"type"`
|
||||
OpenTofu string `json:"tofu"`
|
||||
UI string `json:"ui"`
|
||||
}
|
||||
var gotVersion versionMessage
|
||||
if err := json.Unmarshal([]byte(gotLines[0]), &gotVersion); err != nil {
|
||||
@ -1129,7 +1129,7 @@ func checkGoldenReference(t *testing.T, output *terminal.TestOutput, fixturePath
|
||||
}
|
||||
wantVersion := versionMessage{
|
||||
"info",
|
||||
fmt.Sprintf("OpenTF %s", version.String()),
|
||||
fmt.Sprintf("OpenTofu %s", version.String()),
|
||||
"version",
|
||||
version.String(),
|
||||
views.JSON_UI_VERSION,
|
||||
|
@ -192,9 +192,9 @@ func (c *ConsoleCommand) modePiped(session *repl.Session, ui cli.Ui) int {
|
||||
|
||||
func (c *ConsoleCommand) Help() string {
|
||||
helpText := `
|
||||
Usage: opentf [global options] console [options]
|
||||
Usage: tofu [global options] console [options]
|
||||
|
||||
Starts an interactive console for experimenting with OpenTF
|
||||
Starts an interactive console for experimenting with OpenTofu
|
||||
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 OpenTF configuration. This
|
||||
-var 'foo=bar' Set a variable in the OpenTofu configuration. This
|
||||
flag can be set multiple times.
|
||||
|
||||
-var-file=foo Set variables in the OpenTF configuration from
|
||||
-var-file=foo Set variables in the OpenTofu 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 OpenTF expressions at an interactive command prompt"
|
||||
return "Try OpenTofu expressions at an interactive command prompt"
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ import (
|
||||
|
||||
func (c *ConsoleCommand) modeInteractive(session *repl.Session, ui cli.Ui) int {
|
||||
ui.Error(fmt.Sprintf(
|
||||
"The readline library OpenTF currently uses for the interactive\n" +
|
||||
"The readline library OpenTofu currently uses for the interactive\n" +
|
||||
"console is not supported by Solaris. Interactive mode is therefore\n" +
|
||||
"not supported on Solaris currently."))
|
||||
return 1
|
||||
|
@ -236,9 +236,9 @@ func TestPlanOnlyInAutomation(t *testing.T) {
|
||||
}
|
||||
|
||||
// Because we're running with TF_IN_AUTOMATION set, we should not see
|
||||
// any mention of the the "opentf apply" command in the output.
|
||||
if strings.Contains(stdout, "opentf apply") {
|
||||
t.Errorf("unwanted mention of \"opentf apply\" in plan output\n%s", stdout)
|
||||
// any mention of the the "tofu apply" command in the output.
|
||||
if strings.Contains(stdout, "tofu apply") {
|
||||
t.Errorf("unwanted mention of \"tofu apply\" in plan output\n%s", stdout)
|
||||
}
|
||||
|
||||
if tf.FileExists("tfplan") {
|
||||
|
@ -39,7 +39,7 @@ func TestInitProviders(t *testing.T) {
|
||||
t.Errorf("unexpected stderr output:\n%s", stderr)
|
||||
}
|
||||
|
||||
if !strings.Contains(stdout, "OpenTF has been successfully initialized!") {
|
||||
if !strings.Contains(stdout, "OpenTofu 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, "OpenTF has created a lock file") {
|
||||
if !strings.Contains(stdout, "OpenTofu has created a lock file") {
|
||||
t.Errorf("lock file notification is missing from output:\n%s", stdout)
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ func TestInitProvidersInternal(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// This test should _not_ reach out anywhere because the "terraform"
|
||||
// provider is internal to the core opentf binary.
|
||||
// provider is internal to the core tofu binary.
|
||||
|
||||
fixturePath := filepath.Join("testdata", "tf-provider")
|
||||
tf := e2e.NewBinary(t, terraformBin, fixturePath)
|
||||
@ -72,7 +72,7 @@ func TestInitProvidersInternal(t *testing.T) {
|
||||
t.Errorf("unexpected stderr output:\n%s", stderr)
|
||||
}
|
||||
|
||||
if !strings.Contains(stdout, "OpenTF has been successfully initialized!") {
|
||||
if !strings.Contains(stdout, "OpenTofu 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, "OpenTF has been successfully initialized!") {
|
||||
if !strings.Contains(stdout, "OpenTofu has been successfully initialized!") {
|
||||
t.Errorf("success message is missing from output:\n%s", stdout)
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ func TestInitProvidersLocalOnly(t *testing.T) {
|
||||
fixturePath := filepath.Join("testdata", "local-only-provider")
|
||||
tf := e2e.NewBinary(t, terraformBin, fixturePath)
|
||||
// If you run this test on a workstation with a plugin-cache directory
|
||||
// configured, it will leave a bad directory behind and opentf init will
|
||||
// configured, it will leave a bad directory behind and tofu init will
|
||||
// not work until you remove it.
|
||||
//
|
||||
// To avoid this, we will "zero out" any existing cli config file.
|
||||
@ -170,7 +170,7 @@ func TestInitProvidersLocalOnly(t *testing.T) {
|
||||
t.Errorf("unexpected stderr output:\n%s", stderr)
|
||||
}
|
||||
|
||||
if !strings.Contains(stdout, "OpenTF has been successfully initialized!") {
|
||||
if !strings.Contains(stdout, "OpenTofu 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, "OpenTF has been successfully initialized!") {
|
||||
if !strings.Contains(stdout, "OpenTofu 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:
|
||||
│ opentf providers
|
||||
│ tofu providers
|
||||
╵
|
||||
|
||||
`
|
||||
|
@ -43,12 +43,12 @@ func setup() func() {
|
||||
var err error
|
||||
terraformBin, err = filepath.Abs(terraformBin)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("failed to find absolute path of opentf executable: %s", err))
|
||||
panic(fmt.Sprintf("failed to find absolute path of tofu executable: %s", err))
|
||||
}
|
||||
return func() {}
|
||||
}
|
||||
|
||||
tmpFilename := e2e.GoBuild("github.com/opentofu/opentofu", "opentf")
|
||||
tmpFilename := e2e.GoBuild("github.com/opentofu/opentofu", "tofu")
|
||||
|
||||
// Make the executable available for use in tests
|
||||
terraformBin = tmpFilename
|
||||
|
@ -32,9 +32,9 @@ GOOS="$(go env GOOS)"
|
||||
GOARCH="$(go env GOARCH)"
|
||||
GOEXE="$(go env GOEXE)"
|
||||
OUTDIR="build/${GOOS}_${GOARCH}"
|
||||
OUTFILE="opentf-e2etest_${GOOS}_${GOARCH}.zip"
|
||||
OUTFILE="tofu-e2etest_${GOOS}_${GOARCH}.zip"
|
||||
|
||||
LDFLAGS="-X github.com/opentofu/opentofu/internal/command/e2etest.terraformBin=./opentf$GOEXE"
|
||||
LDFLAGS="-X github.com/opentofu/opentofu/internal/command/e2etest.terraformBin=./tofu$GOEXE"
|
||||
# Caller may pass in the environment variable GO_LDFLAGS with additional
|
||||
# flags we'll use when building.
|
||||
if [ -n "${GO_LDFLAGS+set}" ]; then
|
||||
|
@ -29,7 +29,7 @@ func TestInitModuleArchive(t *testing.T) {
|
||||
t.Errorf("unexpected stderr output:\n%s", stderr)
|
||||
}
|
||||
|
||||
if !strings.Contains(stdout, "OpenTF has been successfully initialized!") {
|
||||
if !strings.Contains(stdout, "OpenTofu has been successfully initialized!") {
|
||||
t.Errorf("success message is missing from output:\n%s", stdout)
|
||||
}
|
||||
}
|
||||
|
@ -18,10 +18,10 @@ import (
|
||||
|
||||
// The tests in this file are for the "primary workflow", which includes
|
||||
// variants of the following sequence, with different details:
|
||||
// opentf init
|
||||
// opentf plan
|
||||
// opentf apply
|
||||
// opentf destroy
|
||||
// tofu init
|
||||
// tofu plan
|
||||
// tofu apply
|
||||
// tofu destroy
|
||||
|
||||
func TestPrimarySeparatePlan(t *testing.T) {
|
||||
t.Parallel()
|
||||
@ -64,7 +64,7 @@ func TestPrimarySeparatePlan(t *testing.T) {
|
||||
if !strings.Contains(stdout, "Saved the plan to: tfplan") {
|
||||
t.Errorf("missing \"Saved the plan to...\" message in plan output\n%s", stdout)
|
||||
}
|
||||
if !strings.Contains(stdout, "opentf apply \"tfplan\"") {
|
||||
if !strings.Contains(stdout, "tofu apply \"tfplan\"") {
|
||||
t.Errorf("missing next-step instruction in plan output\n%s", stdout)
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ func TestPrimaryChdirOption(t *testing.T) {
|
||||
if !strings.Contains(stdout, "Saved the plan to: tfplan") {
|
||||
t.Errorf("missing \"Saved the plan to...\" message in plan output\n%s", stdout)
|
||||
}
|
||||
if !strings.Contains(stdout, "opentf apply \"tfplan\"") {
|
||||
if !strings.Contains(stdout, "tofu apply \"tfplan\"") {
|
||||
t.Errorf("missing next-step instruction in plan output\n%s", stdout)
|
||||
}
|
||||
|
||||
|
@ -66,11 +66,11 @@ func TestProviderDevOverrides(t *testing.T) {
|
||||
t.Errorf("configuration should depend on %s, but doesn't\n%s", want, got)
|
||||
}
|
||||
|
||||
// NOTE: We're intentionally not running "opentf init" here, because
|
||||
// NOTE: We're intentionally not running "tofu init" here, because
|
||||
// dev overrides are always ready to use and don't need any special action
|
||||
// to "install" them. This test is mimicking the a happy path of going
|
||||
// directly from "go build" to validate/plan/apply without interacting
|
||||
// with any registries, mirrors, lock files, etc. To verify "opentf
|
||||
// with any registries, mirrors, lock files, etc. To verify "tofu
|
||||
// init" does actually show a warning, that behavior is tested at the end.
|
||||
stdout, stderr, err = tf.Run("validate")
|
||||
if err != nil {
|
||||
|
@ -38,7 +38,7 @@ func TestProviderProtocols(t *testing.T) {
|
||||
simpleProvider := filepath.Join(tf.WorkDir(), "terraform-provider-simple")
|
||||
simpleProviderExe := e2e.GoBuild("github.com/opentofu/opentofu/internal/provider-simple/main", simpleProvider)
|
||||
|
||||
// Move the provider binaries into a directory that we will point opentf
|
||||
// Move the provider binaries into a directory that we will point tofu
|
||||
// to using the -plugin-dir cli flag.
|
||||
platform := getproviders.CurrentPlatform.String()
|
||||
hashiDir := "cache/registry.terraform.io/hashicorp/"
|
||||
|
@ -13,18 +13,18 @@ import (
|
||||
"github.com/opentofu/opentofu/internal/e2e"
|
||||
)
|
||||
|
||||
// The tests in this file are for the "opentf providers mirror" command,
|
||||
// The tests in this file are for the "tofu providers mirror" command,
|
||||
// which is tested in an e2etest mode rather than a unit test mode because it
|
||||
// interacts directly with Terraform Registry and the full details of that are
|
||||
// tricky to mock. Such a mock is _possible_, but we're using e2etest as a
|
||||
// compromise for now to keep these tests relatively simple.
|
||||
|
||||
func TestTerraformProvidersMirror(t *testing.T) {
|
||||
testTerraformProvidersMirror(t, "opentf-providers-mirror")
|
||||
testTerraformProvidersMirror(t, "tofu-providers-mirror")
|
||||
}
|
||||
|
||||
func TestTerraformProvidersMirrorWithLockFile(t *testing.T) {
|
||||
testTerraformProvidersMirror(t, "opentf-providers-mirror-with-lock-file")
|
||||
testTerraformProvidersMirror(t, "tofu-providers-mirror-with-lock-file")
|
||||
}
|
||||
|
||||
func testTerraformProvidersMirror(t *testing.T, fixture string) {
|
||||
|
@ -14,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
// TestProviderTampering tests various ways that the provider plugins in the
|
||||
// local cache directory might be modified after an initial "opentf init",
|
||||
// local cache directory might be modified after an initial "tofu init",
|
||||
// which other Terraform commands which use those plugins should catch and
|
||||
// report early.
|
||||
func TestProviderTampering(t *testing.T) {
|
||||
@ -68,7 +68,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 := `opentf init`; !strings.Contains(stderr, want) {
|
||||
if want := `tofu init`; !strings.Contains(stderr, want) {
|
||||
t.Errorf("missing expected error message\nwant substring: %s\ngot:\n%s", want, stderr)
|
||||
}
|
||||
|
||||
@ -103,7 +103,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 := `opentf init`; !strings.Contains(stderr, want) {
|
||||
if want := `tofu init`; !strings.Contains(stderr, want) {
|
||||
t.Errorf("missing expected error message\nwant substring: %s\ngot:\n%s", want, stderr)
|
||||
}
|
||||
|
||||
@ -133,7 +133,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 := `opentf init`; !strings.Contains(stderr, want) {
|
||||
if want := `tofu init`; !strings.Contains(stderr, want) {
|
||||
t.Errorf("missing expected error message\nwant substring: %s\ngot:\n%s", want, stderr)
|
||||
}
|
||||
})
|
||||
@ -162,7 +162,7 @@ func TestProviderTampering(t *testing.T) {
|
||||
if want := `provider registry.terraform.io/hashicorp/null: locked version selection 3.1.0 doesn't match the updated version constraints "1.0.0"`; !strings.Contains(stderr, want) {
|
||||
t.Errorf("missing expected error message\nwant substring: %s\ngot:\n%s", want, stderr)
|
||||
}
|
||||
if want := `opentf init -upgrade`; !strings.Contains(stderr, want) {
|
||||
if want := `tofu init -upgrade`; !strings.Contains(stderr, want) {
|
||||
t.Errorf("missing expected error message\nwant substring: %s\ngot:\n%s", want, stderr)
|
||||
}
|
||||
})
|
||||
@ -188,7 +188,7 @@ func TestProviderTampering(t *testing.T) {
|
||||
if want := `provider registry.terraform.io/hashicorp/null: required by this configuration but no version is selected`; !strings.Contains(stderr, want) {
|
||||
t.Errorf("missing expected error message\nwant substring: %s\ngot:\n%s", want, stderr)
|
||||
}
|
||||
if want := `opentf init`; !strings.Contains(stderr, want) {
|
||||
if want := `tofu init`; !strings.Contains(stderr, want) {
|
||||
t.Errorf("missing expected error message\nwant substring: %s\ngot:\n%s", want, stderr)
|
||||
}
|
||||
})
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
"github.com/opentofu/opentofu/internal/e2e"
|
||||
)
|
||||
|
||||
// TestProvisionerPlugin is a test that opentf can execute a 3rd party
|
||||
// TestProvisionerPlugin is a test that tofu can execute a 3rd party
|
||||
// provisioner plugin.
|
||||
func TestProvisionerPlugin(t *testing.T) {
|
||||
if !canRunGoBuild {
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
"github.com/opentofu/opentofu/internal/e2e"
|
||||
)
|
||||
|
||||
// TestProviderDevOverrides is a test that opentf can execute a 3rd party
|
||||
// TestProviderDevOverrides is a test that tofu can execute a 3rd party
|
||||
// provisioner plugin.
|
||||
func TestProvisioner(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
@ -14,7 +14,7 @@ import (
|
||||
|
||||
func TestTerraformProviderData(t *testing.T) {
|
||||
|
||||
fixturePath := filepath.Join("testdata", "opentf-managed-data")
|
||||
fixturePath := filepath.Join("testdata", "tofu-managed-data")
|
||||
tf := e2e.NewBinary(t, terraformBin, fixturePath)
|
||||
|
||||
_, stderr, err := tf.Run("init", "-input=false")
|
||||
|
@ -26,9 +26,9 @@ import (
|
||||
|
||||
// The tests in this file are for the "unmanaged provider workflow", which
|
||||
// includes variants of the following sequence, with different details:
|
||||
// opentf init
|
||||
// opentf plan
|
||||
// opentf apply
|
||||
// tofu init
|
||||
// tofu plan
|
||||
// tofu apply
|
||||
//
|
||||
// These tests are run against an in-process server, and checked to make sure
|
||||
// they're not trying to control the lifecycle of the binary. They are not
|
||||
|
@ -33,7 +33,7 @@ func TestVersion(t *testing.T) {
|
||||
t.Errorf("unexpected stderr output:\n%s", stderr)
|
||||
}
|
||||
|
||||
wantVersion := fmt.Sprintf("OpenTF v%s", version.String())
|
||||
wantVersion := fmt.Sprintf("OpenTofu 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("OpenTF v%s", version.String())
|
||||
wantVersion := fmt.Sprintf("OpenTofu v%s", version.String())
|
||||
if !strings.Contains(stdout, wantVersion) {
|
||||
t.Errorf("output does not contain our current version %q:\n%s", wantVersion, stdout)
|
||||
}
|
||||
|
@ -158,7 +158,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 opentf fmt"))
|
||||
diags = diags.Append(fmt.Errorf("Only .tf, .tfvars, and .tftest.hcl files can be processed with tofu fmt"))
|
||||
continue
|
||||
}
|
||||
}
|
||||
@ -170,7 +170,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] opentf fmt: Formatting %s", path)
|
||||
log.Printf("[TRACE] tofu fmt: Formatting %s", path)
|
||||
|
||||
src, err := io.ReadAll(r)
|
||||
if err != nil {
|
||||
@ -228,7 +228,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] opentf fmt: looking for files in %s", path)
|
||||
log.Printf("[TRACE] tofu fmt: looking for files in %s", path)
|
||||
|
||||
entries, err := os.ReadDir(path)
|
||||
if err != nil {
|
||||
@ -546,9 +546,9 @@ func (c *FmtCommand) trimNewlines(tokens hclwrite.Tokens) hclwrite.Tokens {
|
||||
|
||||
func (c *FmtCommand) Help() string {
|
||||
helpText := `
|
||||
Usage: opentf [global options] fmt [options] [target...]
|
||||
Usage: tofu [global options] fmt [options] [target...]
|
||||
|
||||
Rewrites all OpenTF configuration files to a canonical format. All
|
||||
Rewrites all OpenTofu 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.
|
||||
@ -559,7 +559,7 @@ Usage: opentf [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 OpenTF language native syntax; JSON is not
|
||||
The content must be in the OpenTofu language native syntax; JSON is not
|
||||
supported.
|
||||
|
||||
Options:
|
||||
|
@ -54,7 +54,7 @@ func (c *GetCommand) Run(args []string) int {
|
||||
|
||||
func (c *GetCommand) Help() string {
|
||||
helpText := `
|
||||
Usage: opentf [global options] get [options]
|
||||
Usage: tofu [global options] get [options]
|
||||
|
||||
Downloads and installs modules needed for the configuration in the
|
||||
current working directory.
|
||||
@ -65,7 +65,7 @@ Usage: opentf [global options] get [options]
|
||||
unless the -update flag is specified.
|
||||
|
||||
Module installation also happens automatically by default as part of
|
||||
the "opentf init" command, so you should rarely need to run this
|
||||
the "tofu 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 OpenTF test directory, defaults to "tests".
|
||||
-test-directory=path Set the OpenTofu test directory, defaults to "tests".
|
||||
|
||||
`
|
||||
return strings.TrimSpace(helpText)
|
||||
}
|
||||
|
||||
func (c *GetCommand) Synopsis() string {
|
||||
return "Install or upgrade remote OpenTF modules"
|
||||
return "Install or upgrade remote OpenTofu modules"
|
||||
}
|
||||
|
||||
func getModules(ctx context.Context, m *Meta, path string, testsDir string, upgrade bool) (abort bool, diags tfdiags.Diagnostics) {
|
||||
|
@ -196,7 +196,7 @@ func (c *GraphCommand) Run(args []string) int {
|
||||
|
||||
func (c *GraphCommand) Help() string {
|
||||
helpText := `
|
||||
Usage: opentf [global options] graph [options]
|
||||
Usage: tofu [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 OpenTF chooses
|
||||
plan-destroy, or apply. By default OpenTofu chooses
|
||||
"plan", or "apply" if you also set the -plan=... option.
|
||||
|
||||
-module-depth=n (deprecated) In prior versions of OpenTF, specified the
|
||||
-module-depth=n (deprecated) In prior versions of OpenTofu, specified the
|
||||
depth of modules to show in the output.
|
||||
`
|
||||
return strings.TrimSpace(helpText)
|
||||
|
@ -11,17 +11,17 @@ import (
|
||||
const failedToLoadSchemasMessage = `
|
||||
Warning: Failed to update data for external integrations
|
||||
|
||||
OpenTF was unable to generate a description of the updated
|
||||
OpenTofu 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 OpenTF cannot read the schema for
|
||||
This problem occurs when OpenTofu 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:
|
||||
opentf apply
|
||||
tofu apply
|
||||
`
|
||||
|
||||
func isCloudMode(b backend.Enhanced) bool {
|
||||
|
@ -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 OpenTF versions are incompatible")
|
||||
cmdFlags.BoolVar(&c.ignoreRemoteVersion, "ignore-remote-version", false, "continue even if remote and local OpenTofu 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 OpenTF configuration files",
|
||||
Summary: "No OpenTofu configuration files",
|
||||
Detail: fmt.Sprintf(
|
||||
"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.",
|
||||
"The directory %s does not contain any OpenTofu 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: opentf [global options] import [options] ADDR ID
|
||||
Usage: tofu [global options] import [options] ADDR ID
|
||||
|
||||
Import existing infrastructure into your OpenTF state.
|
||||
Import existing infrastructure into your OpenTofu state.
|
||||
|
||||
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.
|
||||
This will find and import the specified resource into your OpenTofu
|
||||
state, allowing existing infrastructure to come under OpenTofu
|
||||
management without having to be initially created by OpenTofu.
|
||||
|
||||
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: opentf [global options] import [options] ADDR ID
|
||||
|
||||
Options:
|
||||
|
||||
-config=path Path to a directory of OpenTF configuration files
|
||||
-config=path Path to a directory of OpenTofu 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 OpenTF configuration. This
|
||||
-var 'foo=bar' Set a variable in the OpenTofu configuration. This
|
||||
flag can be set multiple times. This is only useful
|
||||
with the "-config" flag.
|
||||
|
||||
-var-file=foo Set variables in the OpenTF configuration from
|
||||
-var-file=foo Set variables in the OpenTofu 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 OpenTF resource"
|
||||
return "Associate existing infrastructure with a OpenTofu 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 OpenTF state and will henceforth be managed by OpenTF.
|
||||
your OpenTofu state and will henceforth be managed by OpenTofu.
|
||||
`
|
||||
|
@ -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: opentf init")
|
||||
log.Print("[TRACE] TestImport_remoteState running: tofu 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: opentf import %s %s", args[0], args[1])
|
||||
log.Printf("[TRACE] TestImport_remoteState running: tofu 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: opentf init")
|
||||
log.Print("[TRACE] TestImport_initializationErrorShouldUnlock running: tofu 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: opentf import %s %s", args[0], args[1])
|
||||
log.Printf("[TRACE] TestImport_initializationErrorShouldUnlock running: tofu 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 OpenTF configuration files`; !strings.Contains(msg, want) {
|
||||
if want := `No OpenTofu configuration files`; !strings.Contains(msg, want) {
|
||||
t.Errorf("incorrect message\nwant substring: %s\ngot:\n%s", want, msg)
|
||||
}
|
||||
}
|
||||
|
@ -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 OpenTF versions are incompatible")
|
||||
cmdFlags.BoolVar(&c.Meta.ignoreRemoteVersion, "ignore-remote-version", false, "continue even if remote and local OpenTofu 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, OpenTF could not re-read the manifest of installed modules. This is a bug in OpenTF. %s.", err),
|
||||
fmt.Sprintf("After installing modules, OpenTofu could not re-read the manifest of installed modules. This is a bug in OpenTofu. %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 OpenTF", provider.ForDisplay()))
|
||||
c.Ui.Info(fmt.Sprintf("- %s is built in to OpenTofu", 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 opentf 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 tofu 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 opentf 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 tofu 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 OpenTF 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 OpenTofu 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 OpenTF provider registry that is compatible with this OpenTF version, but it may be compatible with a different OpenTF version.",
|
||||
fmt.Sprintf("The host %q given in provider source address %q does not offer a OpenTofu provider registry that is compatible with this OpenTofu version, but it may be compatible with a different OpenTofu 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 OpenTF provider registry.",
|
||||
fmt.Sprintf("The host %q given in provider source address %q does not offer a OpenTofu 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 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.",
|
||||
"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 OpenTofu 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 OpenTF 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 OpenTofu 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,
|
||||
),
|
||||
))
|
||||
@ -915,7 +915,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 "opentf 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 "tofu init" without the "-lockfile=readonly" flag.`,
|
||||
))
|
||||
return true, true, diags
|
||||
}
|
||||
@ -925,7 +925,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 "opentf 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 "tofu init" without the "-lockfile=readonly" flag.`,
|
||||
))
|
||||
return true, false, diags
|
||||
}
|
||||
@ -954,13 +954,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(`
|
||||
OpenTF has created a lock file [bold].terraform.lock.hcl[reset] to record the provider
|
||||
OpenTofu 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 OpenTF can guarantee to make the same selections by default when
|
||||
you run "opentf init" in the future.`))
|
||||
so that OpenTofu can guarantee to make the same selections by default when
|
||||
you run "tofu init" in the future.`))
|
||||
} else {
|
||||
c.Ui.Output(c.Colorize().Color(`
|
||||
OpenTF has made some changes to the provider dependency selections recorded
|
||||
OpenTofu 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.`))
|
||||
}
|
||||
@ -1102,14 +1102,14 @@ func (c *InitCommand) AutocompleteFlags() complete.Flags {
|
||||
|
||||
func (c *InitCommand) Help() string {
|
||||
helpText := `
|
||||
Usage: opentf [global options] init [options]
|
||||
Usage: tofu [global options] init [options]
|
||||
|
||||
Initialize a new or existing OpenTF working directory by creating
|
||||
Initialize a new or existing OpenTofu 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
|
||||
OpenTF configuration per machine. This sets up all the local data
|
||||
necessary to run OpenTF that is typically not committed to version
|
||||
OpenTofu configuration per machine. This sets up all the local data
|
||||
necessary to run OpenTofu that is typically not committed to version
|
||||
control.
|
||||
|
||||
This command is always safe to run multiple times. Though subsequent runs
|
||||
@ -1176,12 +1176,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
|
||||
OpenTF versions use compatible state representations, making
|
||||
OpenTofu versions use compatible state representations, making
|
||||
an operation proceed even when there is a potential mismatch.
|
||||
See the documentation on configuring OpenTF with
|
||||
See the documentation on configuring OpenTofu with
|
||||
Terraform Cloud for more information.
|
||||
|
||||
-test-directory=path Set the OpenTF test directory, defaults to "tests".
|
||||
-test-directory=path Set the OpenTofu test directory, defaults to "tests".
|
||||
|
||||
`
|
||||
return strings.TrimSpace(helpText)
|
||||
@ -1192,11 +1192,11 @@ func (c *InitCommand) Synopsis() string {
|
||||
}
|
||||
|
||||
const errInitConfigError = `
|
||||
[reset]OpenTF encountered problems during initialisation, including problems
|
||||
[reset]OpenTofu encountered problems during initialisation, including problems
|
||||
with the configuration, described below.
|
||||
|
||||
The OpenTF configuration must be valid before initialization so that
|
||||
OpenTF can determine which modules and providers need to be installed.
|
||||
The OpenTofu configuration must be valid before initialization so that
|
||||
OpenTofu can determine which modules and providers need to be installed.
|
||||
`
|
||||
|
||||
const errInitCopyNotEmpty = `
|
||||
@ -1208,14 +1208,14 @@ To initialize the configuration already in this working directory, omit the
|
||||
`
|
||||
|
||||
const outputInitEmpty = `
|
||||
[reset][bold]OpenTF initialized in an empty directory![reset]
|
||||
[reset][bold]OpenTofu initialized in an empty directory![reset]
|
||||
|
||||
The directory has no OpenTF configuration files. You may begin working
|
||||
with OpenTF immediately by creating OpenTF configuration files.
|
||||
The directory has no OpenTofu configuration files. You may begin working
|
||||
with OpenTofu immediately by creating OpenTofu configuration files.
|
||||
`
|
||||
|
||||
const outputInitSuccess = `
|
||||
[reset][bold][green]OpenTF has been successfully initialized![reset][green]
|
||||
[reset][bold][green]OpenTofu has been successfully initialized![reset][green]
|
||||
`
|
||||
|
||||
const outputInitSuccessCloud = `
|
||||
@ -1223,49 +1223,49 @@ const outputInitSuccessCloud = `
|
||||
`
|
||||
|
||||
const outputInitSuccessCLI = `[reset][green]
|
||||
You may now begin working with OpenTF. Try running "opentf plan" to see
|
||||
any changes that are required for your infrastructure. All OpenTF commands
|
||||
You may now begin working with OpenTofu. Try running "tofu plan" to see
|
||||
any changes that are required for your infrastructure. All OpenTofu commands
|
||||
should now work.
|
||||
|
||||
If you ever set or change modules or backend configuration for OpenTF,
|
||||
If you ever set or change modules or backend configuration for OpenTofu,
|
||||
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 "opentf plan" to
|
||||
You may now begin working with Terraform Cloud. Try running "tofu plan" to
|
||||
see any changes that are required for your infrastructure.
|
||||
|
||||
If you ever set or change modules or OpenTF Settings, run "opentf init"
|
||||
If you ever set or change modules or OpenTofu Settings, run "tofu 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 OpenTF %s.
|
||||
const providerProtocolTooOld = `Provider %q v%s is not compatible with OpenTofu %s.
|
||||
Provider version %s is the latest compatible version. Select it with the following version constraint:
|
||||
version = %q
|
||||
|
||||
OpenTF checked all of the plugin versions matching the given constraint:
|
||||
OpenTofu 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 OpenTF versions.
|
||||
Consult the documentation for this provider for more information on compatibility between provider and OpenTofu 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 OpenTF %s.
|
||||
const providerProtocolTooNew = `Provider %q v%s is not compatible with OpenTofu %s.
|
||||
You need to downgrade to v%s or earlier. Select it with the following constraint:
|
||||
version = %q
|
||||
|
||||
OpenTF checked all of the plugin versions matching the given constraint:
|
||||
OpenTofu 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 OpenTF versions.
|
||||
Alternatively, upgrade to the latest version of OpenTF for compatibility with newer provider releases.
|
||||
Consult the documentation for this provider for more information on compatibility between provider and OpenTofu versions.
|
||||
Alternatively, upgrade to the latest version of OpenTofu for compatibility with newer provider releases.
|
||||
`
|
||||
|
||||
// No version of the provider is compatible.
|
||||
@ -1277,11 +1277,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, OpenTF was forced to calculate lock file checksums locally for the following providers:
|
||||
const incompleteLockFileInformationBody = `Due to your customized provider installation methods, OpenTofu 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 OpenTF running on another platform will fail to install these providers.
|
||||
The current .terraform.lock.hcl file only includes checksums for %s, so OpenTofu running on another platform will fail to install these providers.
|
||||
|
||||
To calculate additional checksums for another platform, run:
|
||||
opentf providers lock -platform=linux_amd64
|
||||
tofu providers lock -platform=linux_amd64
|
||||
(where linux_amd64 is the platform to generate)`
|
||||
|
@ -920,7 +920,7 @@ func TestInit_backendReinitConfigToExtra(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestInit_backendCloudInvalidOptions(t *testing.T) {
|
||||
// There are various "opentf init" options that are only for
|
||||
// There are various "tofu init" options that are only for
|
||||
// traditional backends and not applicable to Terraform Cloud mode.
|
||||
// For those, we want to return an explicit error rather than
|
||||
// just silently ignoring them, so that users will be aware that
|
||||
@ -969,8 +969,8 @@ func TestInit_backendCloudInvalidOptions(t *testing.T) {
|
||||
|
||||
// We have -backend-config as a pragmatic way to dynamically set
|
||||
// certain settings of backends that tend to vary depending on
|
||||
// where OpenTF is running, such as AWS authentication profiles
|
||||
// that are naturally local only to the machine where OpenTF is
|
||||
// where OpenTofu is running, such as AWS authentication profiles
|
||||
// that are naturally local only to the machine where OpenTofu is
|
||||
// running. Those needs don't apply to Terraform Cloud, because
|
||||
// the remote workspace encapsulates all of the details of how
|
||||
// operations and state work in that case, and so the Cloud
|
||||
@ -1358,7 +1358,7 @@ func TestInit_getProvider(t *testing.T) {
|
||||
|
||||
t.Run("future-state", func(t *testing.T) {
|
||||
// getting providers should fail if a state from a newer version of
|
||||
// opentf exists, since InitCommand.getProviders needs to inspect that
|
||||
// tofu exists, since InitCommand.getProviders needs to inspect that
|
||||
// state.
|
||||
|
||||
f, err := os.Create(DefaultStateFilename)
|
||||
@ -1662,7 +1662,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(), "OpenTF has initialized, but configuration upgrades may be needed") {
|
||||
if strings.Contains(ui.OutputWriter.String(), "OpenTofu has initialized, but configuration upgrades may be needed") {
|
||||
t.Fatalf("unexpected \"configuration upgrade\" warning in output")
|
||||
}
|
||||
|
||||
@ -1740,7 +1740,7 @@ func TestInit_providerSource(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestInit_cancelModules(t *testing.T) {
|
||||
// This test runs `opentf init` as if SIGINT (or similar on other
|
||||
// This test runs `tofu init` as if SIGINT (or similar on other
|
||||
// platforms) were sent to it, testing that it is interruptible.
|
||||
|
||||
td := t.TempDir()
|
||||
@ -1777,7 +1777,7 @@ func TestInit_cancelModules(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestInit_cancelProviders(t *testing.T) {
|
||||
// This test runs `opentf init` as if SIGINT (or similar on other
|
||||
// This test runs `tofu init` as if SIGINT (or similar on other
|
||||
// platforms) were sent to it, testing that it is interruptible.
|
||||
|
||||
td := t.TempDir()
|
||||
@ -2575,8 +2575,8 @@ func TestInit_pluginDirWithBuiltIn(t *testing.T) {
|
||||
}
|
||||
|
||||
outputStr := ui.OutputWriter.String()
|
||||
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)
|
||||
if subStr := "terraform.io/builtin/terraform is built in to OpenTofu"; !strings.Contains(outputStr, subStr) {
|
||||
t.Errorf("output should mention the tofu provider\nwant substr: %s\ngot:\n%s", subStr, outputStr)
|
||||
}
|
||||
}
|
||||
|
||||
@ -2641,7 +2641,7 @@ func TestInit_invalidSyntaxNoBackend(t *testing.T) {
|
||||
}
|
||||
|
||||
errStr := ui.ErrorWriter.String()
|
||||
if subStr := "OpenTF encountered problems during initialisation, including problems\nwith the configuration, described below."; !strings.Contains(errStr, subStr) {
|
||||
if subStr := "OpenTofu 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) {
|
||||
@ -2670,7 +2670,7 @@ func TestInit_invalidSyntaxWithBackend(t *testing.T) {
|
||||
}
|
||||
|
||||
errStr := ui.ErrorWriter.String()
|
||||
if subStr := "OpenTF encountered problems during initialisation, including problems\nwith the configuration, described below."; !strings.Contains(errStr, subStr) {
|
||||
if subStr := "OpenTofu 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) {
|
||||
@ -2699,7 +2699,7 @@ func TestInit_invalidSyntaxInvalidBackend(t *testing.T) {
|
||||
}
|
||||
|
||||
errStr := ui.ErrorWriter.String()
|
||||
if subStr := "OpenTF encountered problems during initialisation, including problems\nwith the configuration, described below."; !strings.Contains(errStr, subStr) {
|
||||
if subStr := "OpenTofu 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) {
|
||||
@ -2731,7 +2731,7 @@ func TestInit_invalidSyntaxBackendAttribute(t *testing.T) {
|
||||
}
|
||||
|
||||
errStr := ui.ErrorWriter.String()
|
||||
if subStr := "OpenTF encountered problems during initialisation, including problems\nwith the configuration, described below."; !strings.Contains(errStr, subStr) {
|
||||
if subStr := "OpenTofu 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) {
|
||||
|
@ -1,16 +1,16 @@
|
||||
# jsonformat
|
||||
|
||||
This package contains functionality around formatting and displaying the JSON
|
||||
structured output produced by adding the `-json` flag to various OpenTF
|
||||
structured output produced by adding the `-json` flag to various OpenTofu
|
||||
commands.
|
||||
|
||||
## OpenTF Structured Plan Renderer
|
||||
## OpenTofu Structured Plan Renderer
|
||||
|
||||
As of January 2023, this package contains only a single structure: the
|
||||
`Renderer`.
|
||||
|
||||
The renderer accepts the JSON structured output produced by the
|
||||
`opentf show <plan-file> -json` command and writes it in a human-readable
|
||||
`tofu show <plan-file> -json` command and writes it in a human-readable
|
||||
format.
|
||||
|
||||
Implementation details and decisions for the `Renderer` are discussed in the
|
||||
@ -30,9 +30,9 @@ concerned with the complex diff calculations.
|
||||
#### The `differ` package
|
||||
|
||||
The `differ` package operates on `Change` objects. These are produced from
|
||||
`jsonplan.Change` objects (which are produced by the `opentf show` command).
|
||||
`jsonplan.Change` objects (which are produced by the `tofu show` command).
|
||||
Each `jsonplan.Change` object represents a single resource within the overall
|
||||
OpenTF configuration.
|
||||
OpenTofu configuration.
|
||||
|
||||
The `differ` package will iterate through the `Change` objects and produce a
|
||||
single `Diff` that represents a processed summary of the changes described by
|
||||
|
@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
// Package computed contains types that represent the computed diffs for
|
||||
// OpenTF blocks, attributes, and outputs.
|
||||
// OpenTofu blocks, attributes, and outputs.
|
||||
//
|
||||
// Each Diff struct is made up of a renderer, an action, and a boolean
|
||||
// describing the diff. The renderer internally holds child diffs or concrete
|
||||
|
@ -2743,7 +2743,7 @@ func TestSpecificCases(t *testing.T) {
|
||||
}, nil, nil, nil, nil, plans.Create, false),
|
||||
},
|
||||
|
||||
// The following tests are from issue 33472. Basically OpenTF allows
|
||||
// The following tests are from issue 33472. Basically OpenTofu allows
|
||||
// callers to treat numbers as strings in references and expects us
|
||||
// to coerce the strings into numbers. For example the following are
|
||||
// equivalent.
|
||||
|
@ -26,7 +26,7 @@ func computeAttributeDiffAsList(change structured.Change, elementType cty.Type)
|
||||
// we just treat all children of a relevant list or set as also
|
||||
// relevant.
|
||||
//
|
||||
// Interestingly the opentf plan builder also agrees with this, and
|
||||
// Interestingly the tofu plan builder also agrees with this, and
|
||||
// never sets relevant attributes beneath lists or sets. We're just
|
||||
// going to enforce this logic here as well. If the collection is
|
||||
// relevant (decided elsewhere), then every element in the collection is
|
||||
|
@ -90,7 +90,7 @@ func processSet(change structured.Change, process func(value structured.Change))
|
||||
// we just treat all children of a relevant list or set as also
|
||||
// relevant.
|
||||
//
|
||||
// Interestingly the opentf plan builder also agrees with this, and
|
||||
// Interestingly the tofu plan builder also agrees with this, and
|
||||
// never sets relevant attributes beneath lists or sets. We're just
|
||||
// going to enforce this logic here as well. If the collection is
|
||||
// relevant (decided elsewhere), then every element in the collection is
|
||||
|
@ -108,7 +108,7 @@ func (opts JsonOpts) processArray(change structured.ChangeSlice) computed.Diff {
|
||||
// we just treat all children of a relevant list as also relevant, so we
|
||||
// ignore the relevant attributes field.
|
||||
//
|
||||
// Interestingly the opentf plan builder also agrees with this, and
|
||||
// Interestingly the tofu plan builder also agrees with this, and
|
||||
// never sets relevant attributes beneath lists or sets. We're just
|
||||
// going to enforce this logic here as well. If the list is relevant
|
||||
// (decided elsewhere), then every element in the list is also relevant.
|
||||
|
@ -103,7 +103,7 @@ func (plan Plan) renderHuman(renderer Renderer, mode plans.Mode, opts ...plans.Q
|
||||
renderer.Streams.Println()
|
||||
}
|
||||
renderer.Streams.Print(
|
||||
renderer.Colorize.Color("\n[reset][bold][red]Planning failed.[reset][bold] OpenTF encountered an error while generating this plan.[reset]\n\n"),
|
||||
renderer.Colorize.Color("\n[reset][bold][red]Planning failed.[reset][bold] OpenTofu encountered an error while generating this plan.[reset]\n\n"),
|
||||
)
|
||||
} else {
|
||||
switch mode {
|
||||
@ -117,7 +117,7 @@ func (plan Plan) renderHuman(renderer Renderer, mode plans.Mode, opts ...plans.Q
|
||||
|
||||
renderer.Streams.Print(renderer.Colorize.Color("\n[reset][bold][green]No changes.[reset][bold] Your infrastructure still matches the configuration.[reset]\n\n"))
|
||||
renderer.Streams.Println(format.WordWrap(
|
||||
"OpenTF has checked that the real remote objects still match the result of your most recent changes, and found no differences.",
|
||||
"OpenTofu has checked that the real remote objects still match the result of your most recent changes, and found no differences.",
|
||||
renderer.Streams.Stdout.Columns()))
|
||||
case plans.DestroyMode:
|
||||
if haveRefreshChanges {
|
||||
@ -126,7 +126,7 @@ func (plan Plan) renderHuman(renderer Renderer, mode plans.Mode, opts ...plans.Q
|
||||
}
|
||||
renderer.Streams.Print(renderer.Colorize.Color("\n[reset][bold][green]No changes.[reset][bold] No objects need to be destroyed.[reset]\n\n"))
|
||||
renderer.Streams.Println(format.WordWrap(
|
||||
"Either you have not created any objects yet or the existing objects were already deleted outside of OpenTF.",
|
||||
"Either you have not created any objects yet or the existing objects were already deleted outside of OpenTofu.",
|
||||
renderer.Streams.Stdout.Columns()))
|
||||
default:
|
||||
if haveRefreshChanges {
|
||||
@ -155,10 +155,10 @@ func (plan Plan) renderHuman(renderer Renderer, mode plans.Mode, opts ...plans.Q
|
||||
suggestion := "."
|
||||
if !renderer.RunningInAutomation {
|
||||
// The normal message includes a specific command line to run.
|
||||
suggestion = ":\n opentf apply -refresh-only"
|
||||
suggestion = ":\n tofu apply -refresh-only"
|
||||
}
|
||||
renderer.Streams.Println(format.WordWrap(
|
||||
"Your configuration already matches the changes detected above. If you'd like to update the OpenTF state to match, create and apply a refresh-only plan"+suggestion,
|
||||
"Your configuration already matches the changes detected above. If you'd like to update the OpenTofu state to match, create and apply a refresh-only plan"+suggestion,
|
||||
renderer.Streams.Stdout.Columns(),
|
||||
))
|
||||
}
|
||||
@ -168,7 +168,7 @@ func (plan Plan) renderHuman(renderer Renderer, mode plans.Mode, opts ...plans.Q
|
||||
// If we get down here then we're just in the simple situation where
|
||||
// the plan isn't applyable at all.
|
||||
renderer.Streams.Println(format.WordWrap(
|
||||
"OpenTF has compared your real infrastructure against your configuration and found no differences, so no changes are needed.",
|
||||
"OpenTofu has compared your real infrastructure against your configuration and found no differences, so no changes are needed.",
|
||||
renderer.Streams.Stdout.Columns(),
|
||||
))
|
||||
}
|
||||
@ -182,7 +182,7 @@ func (plan Plan) renderHuman(renderer Renderer, mode plans.Mode, opts ...plans.Q
|
||||
|
||||
if willPrintResourceChanges {
|
||||
renderer.Streams.Println(format.WordWrap(
|
||||
"\nOpenTF used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:",
|
||||
"\nOpenTofu used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:",
|
||||
renderer.Streams.Stdout.Columns()))
|
||||
if counts[plans.Create] > 0 {
|
||||
renderer.Streams.Println(renderer.Colorize.Color(actionDescription(plans.Create)))
|
||||
@ -206,9 +206,9 @@ func (plan Plan) renderHuman(renderer Renderer, mode plans.Mode, opts ...plans.Q
|
||||
|
||||
if len(changes) > 0 {
|
||||
if checkOpts(plans.Errored) {
|
||||
renderer.Streams.Printf("\nOpenTF planned the following actions, but then encountered a problem:\n")
|
||||
renderer.Streams.Printf("\nOpenTofu planned the following actions, but then encountered a problem:\n")
|
||||
} else {
|
||||
renderer.Streams.Printf("\nOpenTF will perform the following actions:\n")
|
||||
renderer.Streams.Printf("\nOpenTofu will perform the following actions:\n")
|
||||
}
|
||||
|
||||
for _, change := range changes {
|
||||
@ -245,7 +245,7 @@ func (plan Plan) renderHuman(renderer Renderer, mode plans.Mode, opts ...plans.Q
|
||||
// so we need some extra context about what it would mean to
|
||||
// apply a change that _only_ includes output changes.
|
||||
renderer.Streams.Println(format.WordWrap(
|
||||
"\nYou can apply this plan to save these new output values to the OpenTF state, without changing any real infrastructure.",
|
||||
"\nYou can apply this plan to save these new output values to the OpenTofu state, without changing any real infrastructure.",
|
||||
renderer.Streams.Stdout.Columns()))
|
||||
}
|
||||
}
|
||||
@ -304,10 +304,10 @@ func renderHumanDiffDrift(renderer Renderer, diffs diffs, mode plans.Mode) bool
|
||||
return false
|
||||
}
|
||||
|
||||
renderer.Streams.Print(renderer.Colorize.Color("\n[bold][cyan]Note:[reset][bold] Objects have changed outside of OpenTF\n"))
|
||||
renderer.Streams.Print(renderer.Colorize.Color("\n[bold][cyan]Note:[reset][bold] Objects have changed outside of OpenTofu\n"))
|
||||
renderer.Streams.Println()
|
||||
renderer.Streams.Print(format.WordWrap(
|
||||
"OpenTF detected the following changes made outside of OpenTF since the last \"opentf apply\" which may have affected this plan:\n",
|
||||
"OpenTofu detected the following changes made outside of OpenTofu since the last \"tofu apply\" which may have affected this plan:\n",
|
||||
renderer.Streams.Stdout.Columns()))
|
||||
|
||||
for _, drift := range drs {
|
||||
@ -321,7 +321,7 @@ func renderHumanDiffDrift(renderer Renderer, diffs diffs, mode plans.Mode) bool
|
||||
switch mode {
|
||||
case plans.RefreshOnlyMode:
|
||||
renderer.Streams.Println(format.WordWrap(
|
||||
"\n\nThis is a refresh-only plan, so OpenTF will not take any actions to undo these. If you were expecting these changes then you can apply this plan to record the updated values in the OpenTF state without changing any remote objects.",
|
||||
"\n\nThis is a refresh-only plan, so OpenTofu will not take any actions to undo these. If you were expecting these changes then you can apply this plan to record the updated values in the OpenTofu state without changing any remote objects.",
|
||||
renderer.Streams.Stdout.Columns(),
|
||||
))
|
||||
default:
|
||||
@ -426,7 +426,7 @@ func resourceChangeComment(resource jsonplan.ResourceChange, action plans.Action
|
||||
// FIXME: Ideally we'd truncate addr.Module to reflect the earliest
|
||||
// step that doesn't exist, so it's clearer which call this refers
|
||||
// to, but we don't have enough information out here in the UI layer
|
||||
// to decide that; only the "expander" in OpenTF Core knows
|
||||
// to decide that; only the "expander" in OpenTofu Core knows
|
||||
// which module instance keys are actually declared.
|
||||
buf.WriteString(fmt.Sprintf("\n # (because %s is not in configuration)", resource.ModuleAddress))
|
||||
case jsonplan.ResourceInstanceDeleteBecauseWrongRepetition:
|
||||
|
@ -39,7 +39,7 @@ func TestRenderHuman_EmptyPlan(t *testing.T) {
|
||||
want := `
|
||||
No changes. Your infrastructure matches the configuration.
|
||||
|
||||
OpenTF has compared your real infrastructure against your configuration and
|
||||
OpenTofu has compared your real infrastructure against your configuration and
|
||||
found no differences, so no changes are needed.
|
||||
`
|
||||
|
||||
@ -70,7 +70,7 @@ func TestRenderHuman_EmptyOutputs(t *testing.T) {
|
||||
want := `
|
||||
No changes. Your infrastructure matches the configuration.
|
||||
|
||||
OpenTF has compared your real infrastructure against your configuration and
|
||||
OpenTofu has compared your real infrastructure against your configuration and
|
||||
found no differences, so no changes are needed.
|
||||
`
|
||||
|
||||
@ -133,7 +133,7 @@ func TestRenderHuman_Imports(t *testing.T) {
|
||||
},
|
||||
},
|
||||
output: `
|
||||
OpenTF will perform the following actions:
|
||||
OpenTofu will perform the following actions:
|
||||
|
||||
# test_resource.resource will be imported
|
||||
resource "test_resource" "resource" {
|
||||
@ -175,7 +175,7 @@ Plan: 1 to import, 0 to add, 0 to change, 0 to destroy.
|
||||
},
|
||||
},
|
||||
output: `
|
||||
OpenTF will perform the following actions:
|
||||
OpenTofu will perform the following actions:
|
||||
|
||||
# test_resource.resource will be imported
|
||||
# (config will be generated)
|
||||
@ -215,7 +215,7 @@ Plan: 1 to import, 0 to add, 0 to change, 0 to destroy.
|
||||
},
|
||||
},
|
||||
output: `
|
||||
OpenTF will perform the following actions:
|
||||
OpenTofu will perform the following actions:
|
||||
|
||||
# test_resource.before has moved to test_resource.after
|
||||
# (imported from "1D5F5E9E-F2E5-401B-9ED5-692A215AC67E")
|
||||
@ -255,11 +255,11 @@ Plan: 1 to import, 0 to add, 0 to change, 0 to destroy.
|
||||
},
|
||||
},
|
||||
output: `
|
||||
OpenTF used the selected providers to generate the following execution plan.
|
||||
Resource actions are indicated with the following symbols:
|
||||
OpenTofu used the selected providers to generate the following execution
|
||||
plan. Resource actions are indicated with the following symbols:
|
||||
~ update in-place
|
||||
|
||||
OpenTF will perform the following actions:
|
||||
OpenTofu will perform the following actions:
|
||||
|
||||
# test_resource.after will be updated in-place
|
||||
# (moved from test_resource.before)
|
||||
@ -299,11 +299,11 @@ Plan: 1 to import, 0 to add, 1 to change, 0 to destroy.
|
||||
},
|
||||
},
|
||||
output: `
|
||||
OpenTF used the selected providers to generate the following execution plan.
|
||||
Resource actions are indicated with the following symbols:
|
||||
OpenTofu used the selected providers to generate the following execution
|
||||
plan. Resource actions are indicated with the following symbols:
|
||||
~ update in-place
|
||||
|
||||
OpenTF will perform the following actions:
|
||||
OpenTofu will perform the following actions:
|
||||
|
||||
# test_resource.resource will be updated in-place
|
||||
# (imported from "1D5F5E9E-F2E5-401B-9ED5-692A215AC67E")
|
||||
@ -340,11 +340,11 @@ Plan: 1 to import, 0 to add, 1 to change, 0 to destroy.
|
||||
},
|
||||
},
|
||||
output: `
|
||||
OpenTF used the selected providers to generate the following execution plan.
|
||||
Resource actions are indicated with the following symbols:
|
||||
OpenTofu used the selected providers to generate the following execution
|
||||
plan. Resource actions are indicated with the following symbols:
|
||||
~ update in-place
|
||||
|
||||
OpenTF will perform the following actions:
|
||||
OpenTofu will perform the following actions:
|
||||
|
||||
# test_resource.resource will be updated in-place
|
||||
# (will be imported first)
|
||||
@ -385,11 +385,11 @@ Plan: 1 to import, 0 to add, 1 to change, 0 to destroy.
|
||||
},
|
||||
},
|
||||
output: `
|
||||
OpenTF used the selected providers to generate the following execution plan.
|
||||
Resource actions are indicated with the following symbols:
|
||||
OpenTofu used the selected providers to generate the following execution
|
||||
plan. Resource actions are indicated with the following symbols:
|
||||
+/- create replacement and then destroy
|
||||
|
||||
OpenTF will perform the following actions:
|
||||
OpenTofu will perform the following actions:
|
||||
|
||||
# test_resource.resource must be replaced
|
||||
# (imported from "1D5F5E9E-F2E5-401B-9ED5-692A215AC67E")
|
||||
|
@ -85,7 +85,7 @@ type Renderer struct {
|
||||
func (renderer Renderer) RenderHumanPlan(plan Plan, mode plans.Mode, opts ...plans.Quality) {
|
||||
if incompatibleVersions(jsonplan.FormatVersion, plan.PlanFormatVersion) || incompatibleVersions(jsonprovider.FormatVersion, plan.ProviderFormatVersion) {
|
||||
renderer.Streams.Println(format.WordWrap(
|
||||
renderer.Colorize.Color("\n[bold][red]Warning:[reset][bold] This plan was generated using a different version of OpenTF, the diff presented here may be missing representations of recent features."),
|
||||
renderer.Colorize.Color("\n[bold][red]Warning:[reset][bold] This plan was generated using a different version of OpenTofu, the diff presented here may be missing representations of recent features."),
|
||||
renderer.Streams.Stdout.Columns()))
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ func (renderer Renderer) RenderHumanPlan(plan Plan, mode plans.Mode, opts ...pla
|
||||
func (renderer Renderer) RenderHumanState(state State) {
|
||||
if incompatibleVersions(jsonstate.FormatVersion, state.StateFormatVersion) || incompatibleVersions(jsonprovider.FormatVersion, state.ProviderFormatVersion) {
|
||||
renderer.Streams.Println(format.WordWrap(
|
||||
renderer.Colorize.Color("\n[bold][red]Warning:[reset][bold] This state was retrieved using a different version of OpenTF, the state presented here maybe missing representations of recent features."),
|
||||
renderer.Colorize.Color("\n[bold][red]Warning:[reset][bold] This state was retrieved using a different version of OpenTofu, the state presented here maybe missing representations of recent features."),
|
||||
renderer.Streams.Stdout.Columns()))
|
||||
}
|
||||
|
||||
|
@ -177,13 +177,13 @@ func (p *PathMatcher) GetChildWithIndex(index int) Matcher {
|
||||
continue
|
||||
}
|
||||
|
||||
// OpenTF actually allows user to provide strings into indexes as
|
||||
// OpenTofu actually allows user to provide strings into indexes as
|
||||
// long as the string can be interpreted into a number. For example, the
|
||||
// following are equivalent and we need to support them.
|
||||
// - test_resource.resource.list[0].attribute
|
||||
// - test_resource.resource.list["0"].attribute
|
||||
//
|
||||
// Note, that OpenTF will raise a validation error if the string
|
||||
// Note, that OpenTofu will raise a validation error if the string
|
||||
// can't be coerced into a number, so we will panic here if anything
|
||||
// goes wrong safe in the knowledge the validation should stop this from
|
||||
// happening.
|
||||
@ -196,13 +196,13 @@ func (p *PathMatcher) GetChildWithIndex(index int) Matcher {
|
||||
case string:
|
||||
f, err := strconv.ParseFloat(val, 64)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("found invalid type within path (%v:%T), the validation shouldn't have allowed this to happen; this is a bug in OpenTF, please report it", val, val))
|
||||
panic(fmt.Errorf("found invalid type within path (%v:%T), the validation shouldn't have allowed this to happen; this is a bug in OpenTofu, please report it", val, val))
|
||||
}
|
||||
if int(f) == index {
|
||||
child.Paths = append(child.Paths, path[1:])
|
||||
}
|
||||
default:
|
||||
panic(fmt.Errorf("found invalid type within path (%v:%T), the validation shouldn't have allowed this to happen; this is a bug in OpenTF, please report it", val, val))
|
||||
panic(fmt.Errorf("found invalid type within path (%v:%T), the validation shouldn't have allowed this to happen; this is a bug in OpenTofu, please report it", val, val))
|
||||
}
|
||||
}
|
||||
return child
|
||||
|
@ -64,7 +64,7 @@ func (c *LoginCommand) Run(args []string) int {
|
||||
diags = diags.Append(tfdiags.Sourceless(
|
||||
tfdiags.Error,
|
||||
"Login is an interactive command",
|
||||
"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.",
|
||||
"The \"tofu 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
|
||||
@ -123,14 +123,14 @@ func (c *LoginCommand) Run(args []string) int {
|
||||
case *disco.ErrVersionNotSupported:
|
||||
diags = diags.Append(tfdiags.Sourceless(
|
||||
tfdiags.Warning,
|
||||
"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),
|
||||
"Host does not support OpenTofu login",
|
||||
fmt.Sprintf("The given hostname %q allows creating OpenTofu authorization tokens, but requires a newer version of OpenTofu CLI to do so.", dispHostname),
|
||||
))
|
||||
default:
|
||||
diags = diags.Append(tfdiags.Sourceless(
|
||||
tfdiags.Warning,
|
||||
"Host does not support OpenTF login",
|
||||
fmt.Sprintf("The given hostname %q cannot support \"opentf login\": %s.", dispHostname, err),
|
||||
"Host does not support OpenTofu login",
|
||||
fmt.Sprintf("The given hostname %q cannot support \"tofu login\": %s.", dispHostname, err),
|
||||
))
|
||||
}
|
||||
|
||||
@ -144,20 +144,20 @@ func (c *LoginCommand) Run(args []string) int {
|
||||
case *disco.ErrServiceNotProvided:
|
||||
diags = diags.Append(tfdiags.Sourceless(
|
||||
tfdiags.Error,
|
||||
"Host does not support OpenTF tokens API",
|
||||
fmt.Sprintf("The given hostname %q does not support creating OpenTF authorization tokens.", dispHostname),
|
||||
"Host does not support OpenTofu tokens API",
|
||||
fmt.Sprintf("The given hostname %q does not support creating OpenTofu authorization tokens.", dispHostname),
|
||||
))
|
||||
case *disco.ErrVersionNotSupported:
|
||||
diags = diags.Append(tfdiags.Sourceless(
|
||||
tfdiags.Error,
|
||||
"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),
|
||||
"Host does not support OpenTofu tokens API",
|
||||
fmt.Sprintf("The given hostname %q allows creating OpenTofu authorization tokens, but requires a newer version of OpenTofu CLI to do so.", dispHostname),
|
||||
))
|
||||
default:
|
||||
diags = diags.Append(tfdiags.Sourceless(
|
||||
tfdiags.Error,
|
||||
"Host does not support OpenTF tokens API",
|
||||
fmt.Sprintf("The given hostname %q cannot support \"opentf login\": %s.", dispHostname, err),
|
||||
"Host does not support OpenTofu tokens API",
|
||||
fmt.Sprintf("The given hostname %q cannot support \"tofu login\": %s.", dispHostname, err),
|
||||
))
|
||||
}
|
||||
}
|
||||
@ -166,7 +166,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 \"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.",
|
||||
"The \"tofu 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.",
|
||||
))
|
||||
}
|
||||
|
||||
@ -178,7 +178,7 @@ func (c *LoginCommand) Run(args []string) int {
|
||||
var token svcauth.HostCredentialsToken
|
||||
var tokenDiags tfdiags.Diagnostics
|
||||
|
||||
// Prefer OpenTF login if available
|
||||
// Prefer OpenTofu login if available
|
||||
if clientConfig != nil {
|
||||
var oauthToken *oauth2.Token
|
||||
|
||||
@ -194,8 +194,8 @@ func (c *LoginCommand) Run(args []string) int {
|
||||
default:
|
||||
tokenDiags = tokenDiags.Append(tfdiags.Sourceless(
|
||||
tfdiags.Error,
|
||||
"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),
|
||||
"Host does not support OpenTofu login",
|
||||
fmt.Sprintf("The given hostname %q does not allow any OAuth grant types that are supported by this version of OpenTofu.", dispHostname),
|
||||
))
|
||||
}
|
||||
if oauthToken != nil {
|
||||
@ -216,7 +216,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 OpenTF failed to save it: %s.", err),
|
||||
fmt.Sprintf("The given host returned an API token, but OpenTofu failed to save it: %s.", err),
|
||||
))
|
||||
}
|
||||
|
||||
@ -288,9 +288,9 @@ func (c *LoginCommand) Run(args []string) int {
|
||||
c.Ui.Output(
|
||||
fmt.Sprintf(
|
||||
c.Colorize().Color(strings.TrimSpace(`
|
||||
[green][bold]Success![reset] [bold]OpenTF has obtained and saved an API token.[reset]
|
||||
[green][bold]Success![reset] [bold]OpenTofu has obtained and saved an API token.[reset]
|
||||
|
||||
The new API token will be used for any future OpenTF command that must make
|
||||
The new API token will be used for any future OpenTofu command that must make
|
||||
authenticated requests to %s.
|
||||
`)),
|
||||
dispHostname,
|
||||
@ -336,7 +336,7 @@ func (c *LoginCommand) Help() string {
|
||||
}
|
||||
|
||||
helpText := fmt.Sprintf(`
|
||||
Usage: opentf [global options] login [hostname]
|
||||
Usage: tofu [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.
|
||||
@ -481,7 +481,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("OpenTF must now open a web browser to the login page for %s.\n", hostname.ForDisplay()))
|
||||
c.Ui.Output(fmt.Sprintf("OpenTofu 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.
|
||||
@ -495,7 +495,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("OpenTF will now wait for the host to signal that login was successful.\n")
|
||||
c.Ui.Output("OpenTofu will now wait for the host to signal that login was successful.\n")
|
||||
|
||||
code, ok := <-codeCh
|
||||
if !ok {
|
||||
@ -538,7 +538,7 @@ func (c *LoginCommand) interactiveGetTokenByPassword(hostname svchost.Hostname,
|
||||
}
|
||||
|
||||
c.Ui.Output("\n---------------------------------------------------------------------------------\n")
|
||||
c.Ui.Output("OpenTF must temporarily use your password to request an API token.\nThis password will NOT be saved locally.\n")
|
||||
c.Ui.Output("OpenTofu 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(), &tofu.InputOpts{
|
||||
Id: "username",
|
||||
@ -602,7 +602,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("OpenTF must now open a web browser to the tokens page for %s.\n", hostname.ForDisplay()))
|
||||
c.Ui.Output(fmt.Sprintf("OpenTofu 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)
|
||||
@ -625,9 +625,9 @@ func (c *LoginCommand) interactiveGetTokenByUI(hostname svchost.Hostname, credsC
|
||||
if credsCtx != nil {
|
||||
switch credsCtx.Location {
|
||||
case cliconfig.CredentialsViaHelper:
|
||||
c.Ui.Output(fmt.Sprintf("OpenTF will store the token in the configured %q credentials helper\nfor use by subsequent commands.\n", credsCtx.HelperType))
|
||||
c.Ui.Output(fmt.Sprintf("OpenTofu 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("OpenTF 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("OpenTofu will store the token in plain text in the following file\nfor use by subsequent commands:\n %s\n", credsCtx.LocalFilename))
|
||||
}
|
||||
}
|
||||
|
||||
@ -673,7 +673,7 @@ func (c *LoginCommand) interactiveContextConsent(hostname svchost.Hostname, gran
|
||||
mechanism = "your browser"
|
||||
}
|
||||
|
||||
c.Ui.Output(fmt.Sprintf("OpenTF will request an API token for %s using %s.\n", hostname.ForDisplay(), mechanism))
|
||||
c.Ui.Output(fmt.Sprintf("OpenTofu will request an API token for %s using %s.\n", hostname.ForDisplay(), mechanism))
|
||||
|
||||
if grantType.UsesAuthorizationEndpoint() {
|
||||
c.Ui.Output(
|
||||
@ -686,9 +686,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, OpenTF 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, OpenTofu 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, OpenTF 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, OpenTofu will store the token in plain text in\nthe following file for use by subsequent commands:\n %s\n", credsCtx.LocalFilename))
|
||||
}
|
||||
}
|
||||
|
||||
@ -778,7 +778,7 @@ type loginCredentialsContext struct {
|
||||
const callbackSuccessMessage = `
|
||||
<html>
|
||||
<head>
|
||||
<title>OpenTF Login</title>
|
||||
<title>OpenTofu Login</title>
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-family: monospace;
|
||||
@ -789,8 +789,8 @@ body {
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<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>
|
||||
<p>The login server has returned an authentication code to OpenTofu.</p>
|
||||
<p>Now close this page and return to the terminal where <tt>tofu login</tt>
|
||||
is running to see the result of the login process.</p>
|
||||
|
||||
</body>
|
||||
|
@ -160,7 +160,7 @@ func TestLogin(t *testing.T) {
|
||||
t.Errorf("wrong token %q; want %q", got, want)
|
||||
}
|
||||
|
||||
if got, want := ui.OutputWriter.String(), "OpenTF has obtained and saved an API token."; !strings.Contains(got, want) {
|
||||
if got, want := ui.OutputWriter.String(), "OpenTofu has obtained and saved an API token."; !strings.Contains(got, want) {
|
||||
t.Errorf("expected output to contain %q, but was:\n%s", want, got)
|
||||
}
|
||||
}))
|
||||
@ -195,7 +195,7 @@ func TestLogin(t *testing.T) {
|
||||
t.Errorf("wrong token %q; want %q", got, want)
|
||||
}
|
||||
|
||||
if got, want := ui.OutputWriter.String(), "OpenTF has obtained and saved an API token."; !strings.Contains(got, want) {
|
||||
if got, want := ui.OutputWriter.String(), "OpenTofu has obtained and saved an API token."; !strings.Contains(got, want) {
|
||||
t.Errorf("expected output to contain %q, but was:\n%s", want, got)
|
||||
}
|
||||
}))
|
||||
@ -268,7 +268,7 @@ func TestLogin(t *testing.T) {
|
||||
t.Fatalf("successful exit; want error")
|
||||
}
|
||||
|
||||
if got, want := ui.ErrorWriter.String(), "Error: Host does not support OpenTF tokens API"; !strings.Contains(got, want) {
|
||||
if got, want := ui.ErrorWriter.String(), "Error: Host does not support OpenTofu tokens API"; !strings.Contains(got, want) {
|
||||
t.Fatalf("missing expected error message\nwant: %s\nfull output:\n%s", want, got)
|
||||
}
|
||||
}))
|
||||
|
@ -70,7 +70,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 \"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.",
|
||||
"The \"tofu 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.",
|
||||
))
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ func (c *LogoutCommand) Run(args []string) int {
|
||||
c.Ui.Output(
|
||||
fmt.Sprintf(
|
||||
c.Colorize().Color(strings.TrimSpace(`
|
||||
[green][bold]Success![reset] [bold]OpenTF has removed the stored API token for %s.[reset]
|
||||
[green][bold]Success![reset] [bold]OpenTofu has removed the stored API token for %s.[reset]
|
||||
`)),
|
||||
dispHostname,
|
||||
) + "\n",
|
||||
@ -129,7 +129,7 @@ func (c *LogoutCommand) Help() string {
|
||||
}
|
||||
|
||||
helpText := `
|
||||
Usage: opentf [global options] logout [hostname]
|
||||
Usage: tofu [global options] logout [hostname]
|
||||
|
||||
Removes locally-stored credentials for specified hostname.
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user