mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-23 15:40:07 -06:00
Renames
This commit is contained in:
parent
e650bab8d7
commit
88100e3d39
@ -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 Terraform, 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 OpenTF, 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 Terraform configuration or
|
||||
// references to specific objects within a OpenTF 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 Terraform modules a pair of types is
|
||||
// For object types that exist within OpenTF 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 Terraform does not presently
|
||||
// This is a temporary allowance for the fact that OpenTF 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 Terraform can retrieve
|
||||
// A ModulePackage represents a physical location where OpenTF can retrieve
|
||||
// a module package, which is an archive, repository, or other similar
|
||||
// container which delivers the source code for one or more Terraform modules.
|
||||
// container which delivers the source code for one or more OpenTF 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
|
||||
// Terraform considers them to belong to the same "package" as the caller.
|
||||
// OpenTF 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 Terraform v0.10 which
|
||||
// but matches behavior we've had since OpenTF 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 Terraform will
|
||||
// allow it and just normalize it away, so the rest of OpenTF 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
|
||||
// Terraform module registry.
|
||||
// OpenTF 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 Terraform will then download and
|
||||
// a concrete ModuleSourceRemote that OpenTF will then download and
|
||||
// install.
|
||||
type ModuleSourceRegistry tfaddr.Module
|
||||
|
||||
|
@ -311,7 +311,7 @@ func TestParseModuleSource(t *testing.T) {
|
||||
// just a general "this string doesn't match any of our source
|
||||
// address patterns" situation, not _necessarily_ about relative
|
||||
// local paths.
|
||||
wantErr: `Terraform cannot detect a supported external module source type for boop/bloop`,
|
||||
wantErr: `OpenTF cannot detect a supported external module source type for boop/bloop`,
|
||||
},
|
||||
|
||||
"go-getter will accept all sorts of garbage": {
|
||||
@ -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 Terraform Registry at registry.terraform.io
|
||||
// old package wasn't. The main OpenTF 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
|
||||
// Terraform hints about historical configuration changes that might
|
||||
// prompt creating a different plan than Terraform would by default.
|
||||
// OpenTF hints about historical configuration changes that might
|
||||
// prompt creating a different plan than OpenTF 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 Terraform
|
||||
// relative address, even though everywhere else in OpenTF
|
||||
// AbsMoveable always represents a fully-absolute address.
|
||||
// In practice, due to the implementation of ParseMoveEndpoint,
|
||||
// this is always either a ModuleInstance or an AbsResourceInstance,
|
||||
|
@ -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 Terraform language
|
||||
// traversal of the reciever in a way that resembles the OpenTF language
|
||||
// syntax that could've produced it.
|
||||
//
|
||||
// It's not guaranteed to actually be a valid Terraform language expression,
|
||||
// It's not guaranteed to actually be a valid OpenTF 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 Terraform language introduces a new
|
||||
// if a later edition of the OpenTF 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 Terraform 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 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),
|
||||
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 Terraform language introduces a new reserved word that
|
||||
// of the OpenTF 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 Terraform 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 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.`,
|
||||
},
|
||||
{
|
||||
`lazy.foo`,
|
||||
nil,
|
||||
`The symbol name "lazy" is reserved for use in a future Terraform 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 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.`,
|
||||
},
|
||||
{
|
||||
`arg.foo`,
|
||||
nil,
|
||||
`The symbol name "arg" is reserved for use in a future Terraform 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 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.`,
|
||||
},
|
||||
|
||||
// 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 Terraform versions.
|
||||
// which remains only for compatibility with older OpenTF 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 Terraform could implicitly select
|
||||
// otherwise older versions of OpenTF 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 Terraform v0.12 and earlier.
|
||||
// provider address in the legacy form used by OpenTF 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
|
||||
// Terraform v0.13. Later versions of Terraform reject state snapshots using
|
||||
// this format, and so users must follow the Terraform v0.13 upgrade guide
|
||||
// OpenTF v0.13. Later versions of OpenTF reject state snapshots using
|
||||
// this format, and so users must follow the OpenTF v0.13 upgrade guide
|
||||
// in that case.
|
||||
//
|
||||
// We will not use this address form for any new file formats.
|
||||
|
@ -414,16 +414,16 @@ func TestParseProviderSourceStr(t *testing.T) {
|
||||
true,
|
||||
},
|
||||
|
||||
// We forbid the terraform- prefix both because it's redundant to
|
||||
// include "terraform" in a Terraform provider name and because we use
|
||||
// the longer prefix terraform-provider- to hint for users who might be
|
||||
// We forbid the opentf- prefix both because it's redundant to
|
||||
// include "opentf" in a OpenTF provider name and because we use
|
||||
// the longer prefix opentf-provider- to hint for users who might be
|
||||
// accidentally using the git repository name or executable file name
|
||||
// instead of the provider type.
|
||||
"example.com/hashicorp/terraform-provider-bad": {
|
||||
"example.com/placeholderplaceholderplaceholder/opentf-provider-bad": {
|
||||
Provider{},
|
||||
true,
|
||||
},
|
||||
"example.com/hashicorp/terraform-bad": {
|
||||
"example.com/placeholderplaceholderplaceholder/opentf-bad": {
|
||||
Provider{},
|
||||
true,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user