mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Rename multiple packages to OpenTofu (#488)
This commit is contained in:
parent
0bac273d1c
commit
059190f273
@ -15,7 +15,7 @@ import (
|
||||
// the addrs package.
|
||||
//
|
||||
// This interface will grow each time a new type of reference is added, and so
|
||||
// implementations outside of the OpenTF codebases are not advised.
|
||||
// implementations outside of the OpenTofu codebases are not advised.
|
||||
//
|
||||
// Each method returns a suitable value and optionally some diagnostics. If the
|
||||
// returned diagnostics contains errors then the type of the returned value is
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
// Package lang deals with the runtime aspects of OpenTF's configuration
|
||||
// Package lang deals with the runtime aspects of OpenTofu's configuration
|
||||
// language, with concerns such as expression evaluation. It is closely related
|
||||
// to sibling package "configs", which is responsible for configuration
|
||||
// parsing and static validation.
|
||||
|
@ -625,10 +625,10 @@ var ListFunc = function.New(&function.Spec{
|
||||
AllowNull: true,
|
||||
},
|
||||
Type: func(args []cty.Value) (ret cty.Type, err error) {
|
||||
return cty.DynamicPseudoType, fmt.Errorf("the \"list\" function was deprecated in Terraform v0.12 and is not available in OpenTF; use tolist([ ... ]) syntax to write a literal list")
|
||||
return cty.DynamicPseudoType, fmt.Errorf("the \"list\" function was deprecated in Terraform v0.12 and is not available in OpenTofu; use tolist([ ... ]) syntax to write a literal list")
|
||||
},
|
||||
Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) {
|
||||
return cty.DynamicVal, fmt.Errorf("the \"list\" function was deprecated in Terraform v0.12 and is not available in OpenTF; use tolist([ ... ]) syntax to write a literal list")
|
||||
return cty.DynamicVal, fmt.Errorf("the \"list\" function was deprecated in Terraform v0.12 and is not available in OpenTofu; use tolist([ ... ]) syntax to write a literal list")
|
||||
},
|
||||
})
|
||||
|
||||
@ -646,10 +646,10 @@ var MapFunc = function.New(&function.Spec{
|
||||
AllowNull: true,
|
||||
},
|
||||
Type: func(args []cty.Value) (ret cty.Type, err error) {
|
||||
return cty.DynamicPseudoType, fmt.Errorf("the \"map\" function was deprecated in Terraform v0.12 and is not available in OpenTF; use tomap({ ... }) syntax to write a literal map")
|
||||
return cty.DynamicPseudoType, fmt.Errorf("the \"map\" function was deprecated in Terraform v0.12 and is not available in OpenTofu; use tomap({ ... }) syntax to write a literal map")
|
||||
},
|
||||
Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) {
|
||||
return cty.DynamicVal, fmt.Errorf("the \"map\" function was deprecated in Terraform v0.12 and is not available in OpenTF; use tomap({ ... }) syntax to write a literal map")
|
||||
return cty.DynamicVal, fmt.Errorf("the \"map\" function was deprecated in Terraform v0.12 and is not available in OpenTofu; use tomap({ ... }) syntax to write a literal map")
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -291,7 +291,7 @@ func UUIDV5(namespace cty.Value, name cty.Value) (cty.Value, error) {
|
||||
//
|
||||
// The given string is first encoded as UTF-8 and then the SHA256 algorithm is applied
|
||||
// as defined in RFC 4634. The raw hash is then encoded with Base64 before returning.
|
||||
// OpenTF uses the "standard" Base64 alphabet as defined in RFC 4648 section 4.
|
||||
// OpenTofu uses the "standard" Base64 alphabet as defined in RFC 4648 section 4.
|
||||
func Base64Sha256(str cty.Value) (cty.Value, error) {
|
||||
return Base64Sha256Func.Call([]cty.Value{str})
|
||||
}
|
||||
@ -301,7 +301,7 @@ func Base64Sha256(str cty.Value) (cty.Value, error) {
|
||||
//
|
||||
// The given string is first encoded as UTF-8 and then the SHA256 algorithm is applied
|
||||
// as defined in RFC 4634. The raw hash is then encoded with Base64 before returning.
|
||||
// OpenTF uses the "standard" Base64 alphabet as defined in RFC 4648 section 4
|
||||
// OpenTofu uses the "standard" Base64 alphabet as defined in RFC 4648 section 4
|
||||
func Base64Sha512(str cty.Value) (cty.Value, error) {
|
||||
return Base64Sha512Func.Call([]cty.Value{str})
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ var TimeCmpFunc = function.New(&function.Spec{
|
||||
|
||||
// Timestamp returns a string representation of the current date and time.
|
||||
//
|
||||
// In the OpenTF language, timestamps are conventionally represented as
|
||||
// In the OpenTofu language, timestamps are conventionally represented as
|
||||
// strings using RFC 3339 "Date and Time format" syntax, and so timestamp
|
||||
// returns a string in this format.
|
||||
func Timestamp() (cty.Value, error) {
|
||||
@ -108,7 +108,7 @@ func Timestamp() (cty.Value, error) {
|
||||
|
||||
// TimeAdd adds a duration to a timestamp, returning a new timestamp.
|
||||
//
|
||||
// In the OpenTF language, timestamps are conventionally represented as
|
||||
// In the OpenTofu language, timestamps are conventionally represented as
|
||||
// strings using RFC 3339 "Date and Time format" syntax. Timeadd requires
|
||||
// the timestamp argument to be a string conforming to this syntax.
|
||||
//
|
||||
@ -129,7 +129,7 @@ func TimeAdd(timestamp cty.Value, duration cty.Value) (cty.Value, error) {
|
||||
// TimeCmp considers the UTC offset of each given timestamp when making its
|
||||
// decision, so for example 6:00 +0200 and 4:00 UTC are equal.
|
||||
//
|
||||
// In the OpenTF language, timestamps are conventionally represented as
|
||||
// In the OpenTofu language, timestamps are conventionally represented as
|
||||
// strings using RFC 3339 "Date and Time format" syntax. TimeCmp requires
|
||||
// the timestamp argument to be a string conforming to this syntax.
|
||||
//
|
||||
|
@ -18,7 +18,7 @@ type descriptionEntry struct {
|
||||
}
|
||||
|
||||
// DescriptionList is a consolidated list containing all descriptions for all
|
||||
// functions available within OpenTF. A function's description should point
|
||||
// functions available within OpenTofu. A function's description should point
|
||||
// to the matching entry in this list.
|
||||
//
|
||||
// We keep this as a single list, so we can quickly review descriptions within
|
||||
@ -419,7 +419,7 @@ var DescriptionList = map[string]descriptionEntry{
|
||||
ParamDescription: []string{"", ""},
|
||||
},
|
||||
"textencodebase64": {
|
||||
Description: "`textencodebase64` encodes the unicode characters in a given string using a specified character encoding, returning the result base64 encoded because OpenTF language strings are always sequences of unicode characters.",
|
||||
Description: "`textencodebase64` encodes the unicode characters in a given string using a specified character encoding, returning the result base64 encoded because OpenTofu language strings are always sequences of unicode characters.",
|
||||
ParamDescription: []string{"", ""},
|
||||
},
|
||||
"timeadd": {
|
||||
|
@ -75,7 +75,7 @@ var TextEncodeBase64Func = function.New(&function.Spec{
|
||||
Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) {
|
||||
encoding, err := ianaindex.IANA.Encoding(args[1].AsString())
|
||||
if err != nil || encoding == nil {
|
||||
return cty.UnknownVal(cty.String), function.NewArgErrorf(1, "%q is not a supported IANA encoding name or alias in this OpenTF version", args[1].AsString())
|
||||
return cty.UnknownVal(cty.String), function.NewArgErrorf(1, "%q is not a supported IANA encoding name or alias in this OpenTofu version", args[1].AsString())
|
||||
}
|
||||
|
||||
encName, err := ianaindex.IANA.Name(encoding)
|
||||
@ -119,7 +119,7 @@ var TextDecodeBase64Func = function.New(&function.Spec{
|
||||
Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) {
|
||||
encoding, err := ianaindex.IANA.Encoding(args[1].AsString())
|
||||
if err != nil || encoding == nil {
|
||||
return cty.UnknownVal(cty.String), function.NewArgErrorf(1, "%q is not a supported IANA encoding name or alias in this OpenTF version", args[1].AsString())
|
||||
return cty.UnknownVal(cty.String), function.NewArgErrorf(1, "%q is not a supported IANA encoding name or alias in this OpenTofu version", args[1].AsString())
|
||||
}
|
||||
|
||||
encName, err := ianaindex.IANA.Name(encoding)
|
||||
@ -195,9 +195,9 @@ var URLEncodeFunc = function.New(&function.Spec{
|
||||
|
||||
// Base64Decode decodes a string containing a base64 sequence.
|
||||
//
|
||||
// OpenTF uses the "standard" Base64 alphabet as defined in RFC 4648 section 4.
|
||||
// OpenTofu uses the "standard" Base64 alphabet as defined in RFC 4648 section 4.
|
||||
//
|
||||
// Strings in the OpenTF language are sequences of unicode characters rather
|
||||
// Strings in the OpenTofu language are sequences of unicode characters rather
|
||||
// than bytes, so this function will also interpret the resulting bytes as
|
||||
// UTF-8. If the bytes after Base64 decoding are _not_ valid UTF-8, this function
|
||||
// produces an error.
|
||||
@ -207,9 +207,9 @@ func Base64Decode(str cty.Value) (cty.Value, error) {
|
||||
|
||||
// Base64Encode applies Base64 encoding to a string.
|
||||
//
|
||||
// OpenTF uses the "standard" Base64 alphabet as defined in RFC 4648 section 4.
|
||||
// OpenTofu uses the "standard" Base64 alphabet as defined in RFC 4648 section 4.
|
||||
//
|
||||
// Strings in the OpenTF language are sequences of unicode characters rather
|
||||
// Strings in the OpenTofu language are sequences of unicode characters rather
|
||||
// than bytes, so this function will first encode the characters from the string
|
||||
// as UTF-8, and then apply Base64 encoding to the result.
|
||||
func Base64Encode(str cty.Value) (cty.Value, error) {
|
||||
@ -219,9 +219,9 @@ func Base64Encode(str cty.Value) (cty.Value, error) {
|
||||
// Base64Gzip compresses a string with gzip and then encodes the result in
|
||||
// Base64 encoding.
|
||||
//
|
||||
// OpenTF uses the "standard" Base64 alphabet as defined in RFC 4648 section 4.
|
||||
// OpenTofu uses the "standard" Base64 alphabet as defined in RFC 4648 section 4.
|
||||
//
|
||||
// Strings in the OpenTF language are sequences of unicode characters rather
|
||||
// Strings in the OpenTofu language are sequences of unicode characters rather
|
||||
// than bytes, so this function will first encode the characters from the string
|
||||
// as UTF-8, then apply gzip compression, and then finally apply Base64 encoding.
|
||||
func Base64Gzip(str cty.Value) (cty.Value, error) {
|
||||
@ -242,10 +242,10 @@ func URLEncode(str cty.Value) (cty.Value, error) {
|
||||
|
||||
// TextEncodeBase64 applies Base64 encoding to a string that was encoded before with a target encoding.
|
||||
//
|
||||
// OpenTF uses the "standard" Base64 alphabet as defined in RFC 4648 section 4.
|
||||
// OpenTofu uses the "standard" Base64 alphabet as defined in RFC 4648 section 4.
|
||||
//
|
||||
// First step is to apply the target IANA encoding (e.g. UTF-16LE).
|
||||
// Strings in the OpenTF language are sequences of unicode characters rather
|
||||
// Strings in the OpenTofu language are sequences of unicode characters rather
|
||||
// than bytes, so this function will first encode the characters from the string
|
||||
// as UTF-8, and then apply Base64 encoding to the result.
|
||||
func TextEncodeBase64(str, enc cty.Value) (cty.Value, error) {
|
||||
@ -254,9 +254,9 @@ func TextEncodeBase64(str, enc cty.Value) (cty.Value, error) {
|
||||
|
||||
// TextDecodeBase64 decodes a string containing a base64 sequence whereas a specific encoding of the string is expected.
|
||||
//
|
||||
// OpenTF uses the "standard" Base64 alphabet as defined in RFC 4648 section 4.
|
||||
// OpenTofu uses the "standard" Base64 alphabet as defined in RFC 4648 section 4.
|
||||
//
|
||||
// Strings in the OpenTF language are sequences of unicode characters rather
|
||||
// Strings in the OpenTofu language are sequences of unicode characters rather
|
||||
// than bytes, so this function will also interpret the resulting bytes as
|
||||
// the target encoding.
|
||||
func TextDecodeBase64(str, enc cty.Value) (cty.Value, error) {
|
||||
|
@ -236,7 +236,7 @@ func TestBase64TextEncode(t *testing.T) {
|
||||
cty.StringVal("abc123!?$*&()'-=@~"),
|
||||
cty.StringVal("NOT-EXISTS"),
|
||||
cty.UnknownVal(cty.String).RefineNotNull(),
|
||||
`"NOT-EXISTS" is not a supported IANA encoding name or alias in this OpenTF version`,
|
||||
`"NOT-EXISTS" is not a supported IANA encoding name or alias in this OpenTofu version`,
|
||||
},
|
||||
{
|
||||
cty.StringVal("🤔"),
|
||||
@ -310,7 +310,7 @@ func TestBase64TextDecode(t *testing.T) {
|
||||
cty.StringVal("doesn't matter"),
|
||||
cty.StringVal("NOT-EXISTS"),
|
||||
cty.UnknownVal(cty.String).RefineNotNull(),
|
||||
`"NOT-EXISTS" is not a supported IANA encoding name or alias in this OpenTF version`,
|
||||
`"NOT-EXISTS" is not a supported IANA encoding name or alias in this OpenTofu version`,
|
||||
},
|
||||
{
|
||||
cty.StringVal("<invalid base64>"),
|
||||
|
@ -419,7 +419,7 @@ func readFileBytes(baseDir, path string, marks cty.ValueMarks) ([]byte, error) {
|
||||
f, err := openFile(baseDir, path)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
// An extra OpenTF-specific hint for this situation
|
||||
// An extra OpenTofu-specific hint for this situation
|
||||
return nil, fmt.Errorf("no file exists at %s; this function works only with files that are distributed as part of the configuration source code, so if this file will be created by a resource in this configuration you must instead obtain this result from an attribute of that resource", redactIfSensitive(path, marks))
|
||||
}
|
||||
return nil, err
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
// SensitiveFunc returns a value identical to its argument except that
|
||||
// OpenTF will consider it to be sensitive.
|
||||
// OpenTofu will consider it to be sensitive.
|
||||
var SensitiveFunc = function.New(&function.Spec{
|
||||
Params: []function.Parameter{
|
||||
{
|
||||
|
@ -87,7 +87,7 @@ func TestSensitive(t *testing.T) {
|
||||
// above. Any others are an error, even if they happen to
|
||||
// appear alongside "sensitive". (We might change this rule
|
||||
// if someday we decide to use marks for some additional
|
||||
// unrelated thing in OpenTF, but currently we assume that
|
||||
// unrelated thing in OpenTofu, but currently we assume that
|
||||
// _all_ marks imply sensitive, and so returning any other
|
||||
// marks would be confusing.)
|
||||
t.Errorf("extraneous marks %#v", gotMarks)
|
||||
|
@ -159,12 +159,12 @@ func (s *Scope) Functions() map[string]function.Function {
|
||||
})
|
||||
|
||||
if s.ConsoleMode {
|
||||
// The type function is only available in opentf console.
|
||||
// The type function is only available in OpenTofu console.
|
||||
s.funcs["type"] = funcs.TypeFunc
|
||||
}
|
||||
|
||||
if !s.ConsoleMode {
|
||||
// The plantimestamp function doesn't make sense in the opentf
|
||||
// The plantimestamp function doesn't make sense in the OpenTofu
|
||||
// console.
|
||||
s.funcs["plantimestamp"] = funcs.MakeStaticTimestampFunc(s.PlanTimestamp)
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ func TestFunctions(t *testing.T) {
|
||||
// Note: "can" only works with expressions that pass static
|
||||
// validation, because it only gets an opportunity to run in
|
||||
// that case. The following "works" (captures the error) because
|
||||
// OpenTF understands it as a reference to an attribute
|
||||
// OpenTofu understands it as a reference to an attribute
|
||||
// that does not exist during dynamic evaluation.
|
||||
//
|
||||
// "can" doesn't work with references that could never possibly
|
||||
@ -1076,7 +1076,7 @@ func TestFunctions(t *testing.T) {
|
||||
// Note: "try" only works with expressions that pass static
|
||||
// validation, because it only gets an opportunity to run in
|
||||
// that case. The following "works" (captures the error) because
|
||||
// OpenTF understands it as a reference to an attribute
|
||||
// OpenTofu understands it as a reference to an attribute
|
||||
// that does not exist during dynamic evaluation.
|
||||
//
|
||||
// "try" doesn't work with references that could never possibly
|
||||
@ -1084,7 +1084,7 @@ func TestFunctions(t *testing.T) {
|
||||
// as an expression like "foo" alone which would be understood
|
||||
// as an invalid resource reference. That's okay because this
|
||||
// function exists primarily to ease access to dynamically-typed
|
||||
// structures that OpenTF can't statically validate by
|
||||
// structures that OpenTofu can't statically validate by
|
||||
// definition.
|
||||
`try({}.baz, "fallback")`,
|
||||
cty.StringVal("fallback"),
|
||||
|
@ -15,7 +15,7 @@ import (
|
||||
// Reference combines an addrs.Reference with the address of the module
|
||||
// instance or resource instance where it was found.
|
||||
//
|
||||
// Because of the design of the OpenTF language, our main model of
|
||||
// Because of the design of the OpenTofu language, our main model of
|
||||
// references only captures the module-local part of the reference and assumes
|
||||
// that it's always clear from context which module a reference belongs to.
|
||||
// That's not true for globalref because our whole purpose is to work across
|
||||
@ -112,7 +112,7 @@ func (r Reference) ResourceInstance() (addrs.AbsResourceInstance, bool) {
|
||||
}
|
||||
}
|
||||
|
||||
// DebugString returns an internal (but still somewhat OpenTF-language-like)
|
||||
// DebugString returns an internal (but still somewhat OpenTofu-language-like)
|
||||
// compact string representation of the reciever, which isn't an address that
|
||||
// any of our usual address parsers could accept but still captures the
|
||||
// essence of what the reference represents.
|
||||
|
@ -36,7 +36,7 @@ func Contains(val cty.Value, mark valueMark) bool {
|
||||
}
|
||||
|
||||
// Sensitive indicates that this value is marked as sensitive in the context of
|
||||
// OpenTF.
|
||||
// OpenTofu.
|
||||
const Sensitive = valueMark("Sensitive")
|
||||
|
||||
// TypeType is used to indicate that the value contains a representation of
|
||||
|
@ -27,7 +27,7 @@ type Scope struct {
|
||||
// ParseRef is a function that the scope uses to extract references from
|
||||
// a hcl.Traversal. This controls the type of references the scope currently
|
||||
// supports. As an example, the testing scope can reference outputs directly
|
||||
// while the main OpenTF context scope can not. This means that this
|
||||
// while the main OpenTofu context scope can not. This means that this
|
||||
// function for the testing scope will happily return outputs, while the
|
||||
// main context scope would fail if a user attempts to reference an output.
|
||||
ParseRef ParseRef
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
// Package types contains non-standard cty types used only within OpenTF.
|
||||
// Package types contains non-standard cty types used only within OpenTofu.
|
||||
package types
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
"github.com/opentofu/opentofu/internal/states"
|
||||
)
|
||||
|
||||
// Changes describes various actions that OpenTF will attempt to take if
|
||||
// Changes describes various actions that OpenTofu will attempt to take if
|
||||
// the corresponding plan is applied.
|
||||
//
|
||||
// A Changes object can be rendered into a visual diff (by the caller, using
|
||||
@ -244,7 +244,7 @@ type ResourceInstanceChange struct {
|
||||
RequiredReplace cty.PathSet
|
||||
|
||||
// Private allows a provider to stash any extra data that is opaque to
|
||||
// OpenTF that relates to this change. OpenTF will save this
|
||||
// OpenTofu that relates to this change. OpenTofu will save this
|
||||
// byte-for-byte and return it to the provider in the apply call.
|
||||
Private []byte
|
||||
}
|
||||
@ -281,7 +281,7 @@ func (rc *ResourceInstanceChange) Moved() bool {
|
||||
|
||||
// Simplify will, where possible, produce a change with a simpler action than
|
||||
// the receiever given a flag indicating whether the caller is dealing with
|
||||
// a normal apply or a destroy. This flag deals with the fact that OpenTF
|
||||
// a normal apply or a destroy. This flag deals with the fact that OpenTofu
|
||||
// Core uses a specialized graph node type for destroying; only that
|
||||
// specialized node should set "destroying" to true.
|
||||
//
|
||||
|
@ -69,7 +69,7 @@ type ResourceInstanceChangeSrc struct {
|
||||
RequiredReplace cty.PathSet
|
||||
|
||||
// Private allows a provider to stash any extra data that is opaque to
|
||||
// OpenTF that relates to this change. OpenTF will save this
|
||||
// OpenTofu that relates to this change. OpenTofu will save this
|
||||
// byte-for-byte and return it to the provider in the apply call.
|
||||
Private []byte
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
// Package plans contains the types that are used to represent OpenTF plans.
|
||||
// Package plans contains the types that are used to represent OpenTofu plans.
|
||||
//
|
||||
// A plan describes a set of changes that OpenTF will make to update remote
|
||||
// A plan describes a set of changes that OpenTofu will make to update remote
|
||||
// objects to match with changes to the configuration.
|
||||
package plans
|
||||
|
@ -4,7 +4,7 @@
|
||||
// Package planproto is home to the Go stubs generated from the tfplan protobuf
|
||||
// schema.
|
||||
//
|
||||
// This is an internal package to be used only by OpenTF's planfile package.
|
||||
// From elsewhere in OpenTF, use the API exported by the planfile package
|
||||
// This is an internal package to be used only by OpenTofu's planfile package.
|
||||
// From elsewhere in OpenTofu, use the API exported by the planfile package
|
||||
// itself.
|
||||
package planproto
|
||||
|
@ -348,9 +348,9 @@ type Plan struct {
|
||||
Version uint64 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"`
|
||||
// The mode that was active when this plan was created.
|
||||
//
|
||||
// This is saved only for UI purposes, so that OpenTF can tailor its
|
||||
// This is saved only for UI purposes, so that OpenTofu can tailor its
|
||||
// rendering of the plan depending on the mode. This must never be used to
|
||||
// make decisions in OpenTF Core during the applying of a plan.
|
||||
// make decisions in OpenTofu Core during the applying of a plan.
|
||||
UiMode Mode `protobuf:"varint,17,opt,name=ui_mode,json=uiMode,proto3,enum=tfplan.Mode" json:"ui_mode,omitempty"`
|
||||
// Errored is true for any plan whose creation was interrupted by an
|
||||
// error. A plan with this flag set cannot be applied, and the changes
|
||||
@ -364,7 +364,7 @@ type Plan struct {
|
||||
// each resource to determine which module it belongs to.
|
||||
ResourceChanges []*ResourceInstanceChange `protobuf:"bytes,3,rep,name=resource_changes,json=resourceChanges,proto3" json:"resource_changes,omitempty"`
|
||||
// An unordered set of detected drift: changes made to resources outside of
|
||||
// OpenTF, computed by comparing the previous run's state to the state
|
||||
// OpenTofu, computed by comparing the previous run's state to the state
|
||||
// after refresh.
|
||||
ResourceDrift []*ResourceInstanceChange `protobuf:"bytes,18,rep,name=resource_drift,json=resourceDrift,proto3" json:"resource_drift,omitempty"`
|
||||
// An unordered set of proposed changes to outputs in the root module
|
||||
@ -387,7 +387,7 @@ type Plan struct {
|
||||
// plan, or else applying the plan will fail when it reaches a different
|
||||
// conclusion about what action a particular resource instance needs.
|
||||
ForceReplaceAddrs []string `protobuf:"bytes,16,rep,name=force_replace_addrs,json=forceReplaceAddrs,proto3" json:"force_replace_addrs,omitempty"`
|
||||
// The version string for the OpenTF binary that created this plan.
|
||||
// The version string for the OpenTofu binary that created this plan.
|
||||
TerraformVersion string `protobuf:"bytes,14,opt,name=terraform_version,json=terraformVersion,proto3" json:"terraform_version,omitempty"`
|
||||
// Backend is a description of the backend configuration and other related
|
||||
// settings at the time the plan was created.
|
||||
@ -715,7 +715,7 @@ type ResourceInstanceChange struct {
|
||||
// this resource instance was tracked during the previous apply operation.
|
||||
//
|
||||
// This is populated only if it would be different from addr due to
|
||||
// OpenTF having reacted to refactoring annotations in the configuration.
|
||||
// OpenTofu having reacted to refactoring annotations in the configuration.
|
||||
// If empty, the previous run address is the same as the current address.
|
||||
PrevRunAddr string `protobuf:"bytes,14,opt,name=prev_run_addr,json=prevRunAddr,proto3" json:"prev_run_addr,omitempty"`
|
||||
// deposed_key, if set, indicates that this change applies to a deposed
|
||||
|
@ -4,7 +4,7 @@
|
||||
syntax = "proto3";
|
||||
package tfplan;
|
||||
|
||||
// For OpenTF's own parsing, the proto stub types go into an internal Go
|
||||
// For OpenTofu's own parsing, the proto stub types go into an internal Go
|
||||
// package. The public API is in github.com/opentofu/opentofu/plans/planfile .
|
||||
option go_package = "github.com/opentofu/opentofu/internal/plans/internal/planproto";
|
||||
|
||||
@ -22,9 +22,9 @@ message Plan {
|
||||
|
||||
// The mode that was active when this plan was created.
|
||||
//
|
||||
// This is saved only for UI purposes, so that OpenTF can tailor its
|
||||
// This is saved only for UI purposes, so that OpenTofu can tailor its
|
||||
// rendering of the plan depending on the mode. This must never be used to
|
||||
// make decisions in OpenTF Core during the applying of a plan.
|
||||
// make decisions in OpenTofu Core during the applying of a plan.
|
||||
Mode ui_mode = 17;
|
||||
|
||||
// Errored is true for any plan whose creation was interrupted by an
|
||||
@ -42,7 +42,7 @@ message Plan {
|
||||
repeated ResourceInstanceChange resource_changes = 3;
|
||||
|
||||
// An unordered set of detected drift: changes made to resources outside of
|
||||
// OpenTF, computed by comparing the previous run's state to the state
|
||||
// OpenTofu, computed by comparing the previous run's state to the state
|
||||
// after refresh.
|
||||
repeated ResourceInstanceChange resource_drift = 18;
|
||||
|
||||
@ -70,7 +70,7 @@ message Plan {
|
||||
// conclusion about what action a particular resource instance needs.
|
||||
repeated string force_replace_addrs = 16;
|
||||
|
||||
// The version string for the OpenTF binary that created this plan.
|
||||
// The version string for the OpenTofu binary that created this plan.
|
||||
string terraform_version = 14;
|
||||
|
||||
// Backend is a description of the backend configuration and other related
|
||||
@ -183,14 +183,14 @@ message ResourceInstanceChange {
|
||||
// this resource instance was tracked during the previous apply operation.
|
||||
//
|
||||
// This is populated only if it would be different from addr due to
|
||||
// OpenTF having reacted to refactoring annotations in the configuration.
|
||||
// OpenTofu having reacted to refactoring annotations in the configuration.
|
||||
// If empty, the previous run address is the same as the current address.
|
||||
string prev_run_addr = 14;
|
||||
|
||||
// NOTE: Earlier versions of this format had fields 1 through 6 describing
|
||||
// various indivdual parts of "addr". We're now using our standard compact
|
||||
// string representation to capture the same information. We don't support
|
||||
// preserving plan files from one OpenTF version to the next, so we
|
||||
// preserving plan files from one OpenTofu version to the next, so we
|
||||
// no longer declare nor accept those fields.
|
||||
|
||||
// deposed_key, if set, indicates that this change applies to a deposed
|
||||
|
@ -19,8 +19,8 @@ const (
|
||||
// prior state, even if the configuration for those instances is still
|
||||
// present.
|
||||
//
|
||||
// This mode corresponds with the "-destroy" option to "opentf plan",
|
||||
// and with the plan created by the "opentf destroy" command.
|
||||
// This mode corresponds with the "-destroy" option to "tofu plan",
|
||||
// and with the plan created by the "tofu destroy" command.
|
||||
DestroyMode Mode = 'D'
|
||||
|
||||
// RefreshOnlyMode is a special planning mode which only performs the
|
||||
@ -29,6 +29,6 @@ const (
|
||||
// the configuration has changed relative to the state.
|
||||
//
|
||||
// This mode corresponds with the "-refresh-only" option to
|
||||
// "opentf plan".
|
||||
// "tofu plan".
|
||||
RefreshOnlyMode Mode = 'R'
|
||||
)
|
||||
|
@ -28,7 +28,7 @@ func ValueEqual(x, y cty.Value) bool {
|
||||
// elements in a sequence.
|
||||
//
|
||||
// The approached used here is a "naive" one, assuming that both xs and ys will
|
||||
// generally be small in most reasonable OpenTF configurations. For larger
|
||||
// generally be small in most reasonable OpenTofu configurations. For larger
|
||||
// lists the time/space usage may be sub-optimal.
|
||||
//
|
||||
// A pair of lists may have multiple longest common subsequences. In that
|
||||
|
@ -56,7 +56,7 @@ func ProposedNew(schema *configschema.Block, prior, config cty.Value) cty.Value
|
||||
// provider when the data resource is finally read.
|
||||
//
|
||||
// Data resources are different because the planning of them is handled
|
||||
// entirely within OpenTF Core and not subject to customization by the
|
||||
// entirely within OpenTofu Core and not subject to customization by the
|
||||
// provider. This function is, in effect, producing an equivalent result to
|
||||
// passing the proposedNewBlock result into a provider's PlanResourceChange
|
||||
// function, assuming a fixed implementation of PlanResourceChange that just
|
||||
|
@ -75,7 +75,7 @@ type Plan struct {
|
||||
// was derived from:
|
||||
//
|
||||
// PrevRunState is a representation of the outcome of the previous
|
||||
// OpenTF operation, without any updates from the remote system but
|
||||
// OpenTofu operation, without any updates from the remote system but
|
||||
// potentially including some changes that resulted from state upgrade
|
||||
// actions.
|
||||
//
|
||||
@ -98,7 +98,7 @@ type Plan struct {
|
||||
// updated resources. It is easier to build the testing scope with access
|
||||
// to same temporary state the plan used/built.
|
||||
//
|
||||
// This is never recorded outside of OpenTF. It is not written into the
|
||||
// This is never recorded outside of OpenTofu. It is not written into the
|
||||
// binary plan file, and it is not written into the JSON structured outputs.
|
||||
// The testing framework never writes the plans out but holds everything in
|
||||
// memory as it executes, so there is no need to add any kind of
|
||||
@ -108,7 +108,7 @@ type Plan struct {
|
||||
|
||||
// ExternalReferences are references that are being made to resources within
|
||||
// the plan from external sources. As with PlannedState this is used by the
|
||||
// opentf testing framework, and so isn't written into any external
|
||||
// OpenTofu testing framework, and so isn't written into any external
|
||||
// representation of the plan.
|
||||
ExternalReferences []*addrs.Reference
|
||||
|
||||
@ -118,7 +118,7 @@ type Plan struct {
|
||||
|
||||
// CanApply returns true if and only if the recieving plan includes content
|
||||
// that would make sense to apply. If it returns false, the plan operation
|
||||
// should indicate that there's nothing to do and OpenTF should exit
|
||||
// should indicate that there's nothing to do and OpenTofu should exit
|
||||
// without prompting the user to confirm the changes.
|
||||
//
|
||||
// This function represents our main business logic for making the decision
|
||||
@ -142,7 +142,7 @@ func (p *Plan) CanApply() bool {
|
||||
|
||||
case !p.PriorState.ManagedResourcesEqual(p.PrevRunState):
|
||||
// If there are no changes planned but we detected some
|
||||
// outside-OpenTF changes while refreshing then we consider
|
||||
// outside-OpenTofu changes while refreshing then we consider
|
||||
// that applyable in isolation only if this was a refresh-only
|
||||
// plan where we expect updating the state to include these
|
||||
// changes was the intended goal.
|
||||
|
@ -62,7 +62,7 @@ func Open(filename string) (*Reader, error) {
|
||||
// like our old plan format from versions prior to 0.12.
|
||||
if b, sErr := os.ReadFile(filename); sErr == nil {
|
||||
if bytes.HasPrefix(b, []byte("tfplan")) {
|
||||
return nil, errUnusable(fmt.Errorf("the given plan file was created by an earlier version of OpenTF, or an earlier version of Terraform; plan files cannot be shared between different OpenTF or Terraform versions"))
|
||||
return nil, errUnusable(fmt.Errorf("the given plan file was created by an earlier version of OpenTofu, or an earlier version of Terraform; plan files cannot be shared between different OpenTofu or Terraform versions"))
|
||||
}
|
||||
}
|
||||
return nil, err
|
||||
@ -94,7 +94,7 @@ func Open(filename string) (*Reader, error) {
|
||||
//
|
||||
// Errors can be returned for various reasons, including if the plan file
|
||||
// is not of an appropriate format version, if it was created by a different
|
||||
// version of OpenTF, if it is invalid, etc.
|
||||
// version of OpenTofu, if it is invalid, etc.
|
||||
func (r *Reader) ReadPlan() (*plans.Plan, error) {
|
||||
var planFile *zip.File
|
||||
for _, file := range r.zip.File {
|
||||
@ -256,7 +256,7 @@ func (r *Reader) ReadDependencyLocks() (*depsfile.Locks, tfdiags.Diagnostics) {
|
||||
diags = diags.Append(tfdiags.Sourceless(
|
||||
tfdiags.Error,
|
||||
"Saved plan has no dependency lock information",
|
||||
"The specified saved plan file does not include any dependency lock information. This is a bug in the previous run of OpenTF that created this file.",
|
||||
"The specified saved plan file does not include any dependency lock information. This is a bug in the previous run of OpenTofu that created this file.",
|
||||
))
|
||||
return nil, diags
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ func readTfplan(r io.Reader) (*plans.Plan, error) {
|
||||
}
|
||||
|
||||
if rawPlan.TerraformVersion != version.String() {
|
||||
return nil, fmt.Errorf("plan file was created by OpenTF or Terraform %s, but this is %s; plan files cannot be transferred between different versions of OpenTF / Terraform", rawPlan.TerraformVersion, version.String())
|
||||
return nil, fmt.Errorf("plan file was created by OpenTofu or Terraform %s, but this is %s; plan files cannot be transferred between different versions of OpenTofu / Terraform", rawPlan.TerraformVersion, version.String())
|
||||
}
|
||||
|
||||
plan := &plans.Plan{
|
||||
@ -272,7 +272,7 @@ func resourceChangeFromTfplan(rawChange *planproto.ResourceInstanceChange) (*pla
|
||||
// file created by an earlier version of Terraform, which had the
|
||||
// same information spread over various other fields:
|
||||
// ModulePath, Mode, Name, Type, and InstanceKey.
|
||||
return nil, fmt.Errorf("no instance address for resource instance change; perhaps this plan was created by a different version of OpenTF or a different version of Terraform?")
|
||||
return nil, fmt.Errorf("no instance address for resource instance change; perhaps this plan was created by a different version of OpenTofu or a different version of Terraform?")
|
||||
}
|
||||
|
||||
instAddr, diags := addrs.ParseAbsResourceInstanceStr(rawChange.Addr)
|
||||
|
@ -48,7 +48,7 @@ type CreateArgs struct {
|
||||
// file that might already exist there.
|
||||
//
|
||||
// A plan file contains both a snapshot of the configuration and of the latest
|
||||
// state file in addition to the plan itself, so that OpenTF can detect
|
||||
// state file in addition to the plan itself, so that OpenTofu can detect
|
||||
// if the world has changed since the plan was created and thus refuse to
|
||||
// apply it.
|
||||
func Create(filename string, args CreateArgs) error {
|
||||
|
Loading…
Reference in New Issue
Block a user