Rename legacy package to OpenTofu (#493)

This commit is contained in:
Yaron Yarimi 2023-09-20 16:10:32 +03:00 committed by GitHub
parent 0a12241c6b
commit c6aeb9e836
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
73 changed files with 1574 additions and 1574 deletions

View File

@ -5,7 +5,7 @@ package cloud
import (
"github.com/opentofu/opentofu/internal/configs"
legacy "github.com/opentofu/opentofu/internal/legacy/opentf"
legacy "github.com/opentofu/opentofu/internal/legacy/tofu"
)
// Most of the logic for migrating into and out of "cloud mode" actually lives

View File

@ -7,7 +7,7 @@ import (
"testing"
"github.com/opentofu/opentofu/internal/configs"
legacy "github.com/opentofu/opentofu/internal/legacy/opentf"
legacy "github.com/opentofu/opentofu/internal/legacy/tofu"
)
func TestDetectConfigChangeType(t *testing.T) {

View File

@ -14,7 +14,7 @@ import (
"time"
multierror "github.com/hashicorp/go-multierror"
"github.com/opentofu/opentofu/internal/legacy/opentf"
"github.com/opentofu/opentofu/internal/legacy/tofu"
"github.com/opentofu/opentofu/internal/states/statemgr"
)
@ -41,13 +41,13 @@ type LocalState struct {
// hurt to remove file we never wrote to.
created bool
state *opentf.State
readState *opentf.State
state *tofu.State
readState *tofu.State
written bool
}
// SetState will force a specific state in-memory for this local state.
func (s *LocalState) SetState(state *opentf.State) {
func (s *LocalState) SetState(state *tofu.State) {
s.mu.Lock()
defer s.mu.Unlock()
@ -56,7 +56,7 @@ func (s *LocalState) SetState(state *opentf.State) {
}
// StateReader impl.
func (s *LocalState) State() *opentf.State {
func (s *LocalState) State() *tofu.State {
return s.state.DeepCopy()
}
@ -66,7 +66,7 @@ func (s *LocalState) State() *opentf.State {
// the original.
//
// StateWriter impl.
func (s *LocalState) WriteState(state *opentf.State) error {
func (s *LocalState) WriteState(state *tofu.State) error {
s.mu.Lock()
defer s.mu.Unlock()
@ -102,7 +102,7 @@ func (s *LocalState) WriteState(state *opentf.State) error {
s.state.Serial++
}
if err := opentf.WriteState(s.state, s.stateFileOut); err != nil {
if err := tofu.WriteState(s.state, s.stateFileOut); err != nil {
return err
}
@ -163,9 +163,9 @@ func (s *LocalState) RefreshState() error {
reader = s.stateFileOut
}
state, err := opentf.ReadState(reader)
state, err := tofu.ReadState(reader)
// if there's no state we just assign the nil return value
if err != nil && err != opentf.ErrNoState {
if err != nil && err != tofu.ErrNoState {
return err
}

View File

@ -40,7 +40,7 @@ import (
"github.com/opentofu/opentofu/internal/depsfile"
"github.com/opentofu/opentofu/internal/getproviders"
"github.com/opentofu/opentofu/internal/initwd"
legacy "github.com/opentofu/opentofu/internal/legacy/opentf"
legacy "github.com/opentofu/opentofu/internal/legacy/tofu"
_ "github.com/opentofu/opentofu/internal/logging"
"github.com/opentofu/opentofu/internal/plans"
"github.com/opentofu/opentofu/internal/plans/planfile"

View File

@ -33,7 +33,7 @@ import (
"github.com/opentofu/opentofu/internal/configs"
"github.com/opentofu/opentofu/internal/configs/configload"
"github.com/opentofu/opentofu/internal/getproviders"
legacy "github.com/opentofu/opentofu/internal/legacy/opentf"
legacy "github.com/opentofu/opentofu/internal/legacy/tofu"
"github.com/opentofu/opentofu/internal/providers"
"github.com/opentofu/opentofu/internal/provisioners"
"github.com/opentofu/opentofu/internal/states"

View File

@ -35,7 +35,7 @@ import (
backendInit "github.com/opentofu/opentofu/internal/backend/init"
backendLocal "github.com/opentofu/opentofu/internal/backend/local"
legacy "github.com/opentofu/opentofu/internal/legacy/opentf"
legacy "github.com/opentofu/opentofu/internal/legacy/tofu"
)
// BackendOpts are the options used to initialize a backend.Backend.

View File

@ -10,7 +10,7 @@ import (
"github.com/mitchellh/cli"
"github.com/opentofu/opentofu/internal/backend/remote-state/inmem"
legacy "github.com/opentofu/opentofu/internal/legacy/opentf"
legacy "github.com/opentofu/opentofu/internal/legacy/tofu"
)
// Since we can't unlock a local state file, just test that calling unlock

View File

@ -14,7 +14,7 @@ import (
"github.com/opentofu/opentofu/internal/states"
"github.com/opentofu/opentofu/internal/tofu"
legacy "github.com/opentofu/opentofu/internal/legacy/opentf"
legacy "github.com/opentofu/opentofu/internal/legacy/tofu"
)
func TestCountHook_impl(t *testing.T) {

View File

@ -17,7 +17,7 @@ import (
"github.com/opentofu/opentofu/internal/states"
"github.com/opentofu/opentofu/internal/states/statemgr"
legacy "github.com/opentofu/opentofu/internal/legacy/opentf"
legacy "github.com/opentofu/opentofu/internal/legacy/tofu"
)
func TestWorkspace_createAndChange(t *testing.T) {

View File

@ -32,7 +32,7 @@ const UnknownVariableValue = "74D93920-ED26-11E3-AC10-0800200C9A66"
// function will panic or produce incorrect results.
//
// This is primarily useful for the final transition from new-style values to
// opentf.ResourceConfig before calling to a legacy provider, since
// tofu.ResourceConfig before calling to a legacy provider, since
// helper/schema (the old provider SDK) is particularly sensitive to these
// subtle differences within its validation code.
func ConfigValueFromHCL2Block(v cty.Value, schema *configschema.Block) map[string]interface{} {

View File

@ -12,7 +12,7 @@ import (
"github.com/opentofu/opentofu/internal/configs/configschema"
"github.com/opentofu/opentofu/internal/configs/hcl2shim"
"github.com/opentofu/opentofu/internal/legacy/opentf"
"github.com/opentofu/opentofu/internal/legacy/tofu"
ctyconvert "github.com/zclconf/go-cty/cty/convert"
)
@ -181,16 +181,16 @@ func (b *Backend) Configure(obj cty.Value) tfdiags.Diagnostics {
}
// shimConfig turns a new-style cty.Value configuration (which must be of
// an object type) into a minimal old-style *opentf.ResourceConfig object
// an object type) into a minimal old-style *tofu.ResourceConfig object
// that should be populated enough to appease the not-yet-updated functionality
// in this package. This should be removed once everything is updated.
func (b *Backend) shimConfig(obj cty.Value) *opentf.ResourceConfig {
func (b *Backend) shimConfig(obj cty.Value) *tofu.ResourceConfig {
shimMap, ok := hcl2shim.ConfigValueFromHCL2(obj).(map[string]interface{})
if !ok {
// If the configVal was nil, we still want a non-nil map here.
shimMap = map[string]interface{}{}
}
return &opentf.ResourceConfig{
return &tofu.ResourceConfig{
Config: shimMap,
Raw: shimMap,
}

View File

@ -11,7 +11,7 @@ import (
"sync"
"github.com/mitchellh/mapstructure"
"github.com/opentofu/opentofu/internal/legacy/opentf"
"github.com/opentofu/opentofu/internal/legacy/tofu"
)
// ConfigFieldReader reads fields out of an untyped map[string]string to the
@ -19,7 +19,7 @@ import (
// field readers do not need default handling because they source fully
// populated data structures.)
type ConfigFieldReader struct {
Config *opentf.ResourceConfig
Config *tofu.ResourceConfig
Schema map[string]*Schema
indexMaps map[string]map[string]int

View File

@ -11,7 +11,7 @@ import (
"github.com/opentofu/opentofu/internal/configs/hcl2shim"
"github.com/opentofu/opentofu/internal/legacy/helper/hashcode"
"github.com/opentofu/opentofu/internal/legacy/opentf"
"github.com/opentofu/opentofu/internal/legacy/tofu"
)
func TestConfigFieldReader_impl(t *testing.T) {
@ -80,7 +80,7 @@ func TestConfigFieldReader_custom(t *testing.T) {
cases := map[string]struct {
Addr []string
Result FieldReadResult
Config *opentf.ResourceConfig
Config *tofu.ResourceConfig
Err bool
}{
"basic": {
@ -146,7 +146,7 @@ func TestConfigFieldReader_DefaultHandling(t *testing.T) {
cases := map[string]struct {
Addr []string
Result FieldReadResult
Config *opentf.ResourceConfig
Config *tofu.ResourceConfig
Err bool
}{
"gets default value when no config set": {
@ -236,7 +236,7 @@ func TestConfigFieldReader_ComputedMap(t *testing.T) {
Name string
Addr []string
Result FieldReadResult
Config *opentf.ResourceConfig
Config *tofu.ResourceConfig
Err bool
}{
{
@ -403,7 +403,7 @@ func TestConfigFieldReader_ComputedSet(t *testing.T) {
cases := map[string]struct {
Addr []string
Result FieldReadResult
Config *opentf.ResourceConfig
Config *tofu.ResourceConfig
Err bool
}{
"set, normal": {
@ -489,7 +489,7 @@ func TestConfigFieldReader_computedComplexSet(t *testing.T) {
cases := map[string]struct {
Addr []string
Result FieldReadResult
Config *opentf.ResourceConfig
Config *tofu.ResourceConfig
Err bool
}{
"set, normal": {
@ -538,6 +538,6 @@ func TestConfigFieldReader_computedComplexSet(t *testing.T) {
}
}
func testConfig(t *testing.T, raw map[string]interface{}) *opentf.ResourceConfig {
return opentf.NewResourceConfigRaw(raw)
func testConfig(t *testing.T, raw map[string]interface{}) *tofu.ResourceConfig {
return tofu.NewResourceConfigRaw(raw)
}

View File

@ -8,7 +8,7 @@ import (
"strings"
"github.com/mitchellh/mapstructure"
"github.com/opentofu/opentofu/internal/legacy/opentf"
"github.com/opentofu/opentofu/internal/legacy/tofu"
)
// DiffFieldReader reads fields out of a diff structures.
@ -29,7 +29,7 @@ import (
// It cannot be determined whether a retrieved value is composed of
// diff elements.
type DiffFieldReader struct {
Diff *opentf.InstanceDiff
Diff *tofu.InstanceDiff
Source FieldReader
Schema map[string]*Schema

View File

@ -7,7 +7,7 @@ import (
"reflect"
"testing"
"github.com/opentofu/opentofu/internal/legacy/opentf"
"github.com/opentofu/opentofu/internal/legacy/tofu"
)
func TestDiffFieldReader_impl(t *testing.T) {
@ -61,14 +61,14 @@ func TestDiffFieldReader_NestedSetUpdate(t *testing.T) {
r := &DiffFieldReader{
Schema: schema,
Diff: &opentf.InstanceDiff{
Attributes: map[string]*opentf.ResourceAttrDiff{
"list_of_sets_1.0.nested_set.1.val": &opentf.ResourceAttrDiff{
Diff: &tofu.InstanceDiff{
Attributes: map[string]*tofu.ResourceAttrDiff{
"list_of_sets_1.0.nested_set.1.val": &tofu.ResourceAttrDiff{
Old: "1",
New: "0",
NewRemoved: true,
},
"list_of_sets_1.0.nested_set.2.val": &opentf.ResourceAttrDiff{
"list_of_sets_1.0.nested_set.2.val": &tofu.ResourceAttrDiff{
New: "2",
},
},
@ -121,13 +121,13 @@ func TestDiffFieldReader_MapHandling(t *testing.T) {
}
r := &DiffFieldReader{
Schema: schema,
Diff: &opentf.InstanceDiff{
Attributes: map[string]*opentf.ResourceAttrDiff{
"tags.%": &opentf.ResourceAttrDiff{
Diff: &tofu.InstanceDiff{
Attributes: map[string]*tofu.ResourceAttrDiff{
"tags.%": &tofu.ResourceAttrDiff{
Old: "1",
New: "2",
},
"tags.baz": &opentf.ResourceAttrDiff{
"tags.baz": &tofu.ResourceAttrDiff{
Old: "",
New: "qux",
},
@ -217,28 +217,28 @@ func TestDiffFieldReader_extra(t *testing.T) {
r := &DiffFieldReader{
Schema: schema,
Diff: &opentf.InstanceDiff{
Attributes: map[string]*opentf.ResourceAttrDiff{
"stringComputed": &opentf.ResourceAttrDiff{
Diff: &tofu.InstanceDiff{
Attributes: map[string]*tofu.ResourceAttrDiff{
"stringComputed": &tofu.ResourceAttrDiff{
Old: "foo",
New: "bar",
NewComputed: true,
},
"listMap.0.bar": &opentf.ResourceAttrDiff{
"listMap.0.bar": &tofu.ResourceAttrDiff{
NewRemoved: true,
},
"mapRemove.bar": &opentf.ResourceAttrDiff{
"mapRemove.bar": &tofu.ResourceAttrDiff{
NewRemoved: true,
},
"setChange.10.value": &opentf.ResourceAttrDiff{
"setChange.10.value": &tofu.ResourceAttrDiff{
Old: "50",
New: "80",
},
"setEmpty.#": &opentf.ResourceAttrDiff{
"setEmpty.#": &tofu.ResourceAttrDiff{
Old: "2",
New: "0",
},
@ -355,158 +355,158 @@ func TestDiffFieldReader(t *testing.T) {
testFieldReader(t, func(s map[string]*Schema) FieldReader {
return &DiffFieldReader{
Schema: s,
Diff: &opentf.InstanceDiff{
Attributes: map[string]*opentf.ResourceAttrDiff{
"bool": &opentf.ResourceAttrDiff{
Diff: &tofu.InstanceDiff{
Attributes: map[string]*tofu.ResourceAttrDiff{
"bool": &tofu.ResourceAttrDiff{
Old: "",
New: "true",
},
"int": &opentf.ResourceAttrDiff{
"int": &tofu.ResourceAttrDiff{
Old: "",
New: "42",
},
"float": &opentf.ResourceAttrDiff{
"float": &tofu.ResourceAttrDiff{
Old: "",
New: "3.1415",
},
"string": &opentf.ResourceAttrDiff{
"string": &tofu.ResourceAttrDiff{
Old: "",
New: "string",
},
"stringComputed": &opentf.ResourceAttrDiff{
"stringComputed": &tofu.ResourceAttrDiff{
Old: "foo",
New: "bar",
NewComputed: true,
},
"list.#": &opentf.ResourceAttrDiff{
"list.#": &tofu.ResourceAttrDiff{
Old: "0",
New: "2",
},
"list.0": &opentf.ResourceAttrDiff{
"list.0": &tofu.ResourceAttrDiff{
Old: "",
New: "foo",
},
"list.1": &opentf.ResourceAttrDiff{
"list.1": &tofu.ResourceAttrDiff{
Old: "",
New: "bar",
},
"listInt.#": &opentf.ResourceAttrDiff{
"listInt.#": &tofu.ResourceAttrDiff{
Old: "0",
New: "2",
},
"listInt.0": &opentf.ResourceAttrDiff{
"listInt.0": &tofu.ResourceAttrDiff{
Old: "",
New: "21",
},
"listInt.1": &opentf.ResourceAttrDiff{
"listInt.1": &tofu.ResourceAttrDiff{
Old: "",
New: "42",
},
"map.foo": &opentf.ResourceAttrDiff{
"map.foo": &tofu.ResourceAttrDiff{
Old: "",
New: "bar",
},
"map.bar": &opentf.ResourceAttrDiff{
"map.bar": &tofu.ResourceAttrDiff{
Old: "",
New: "baz",
},
"mapInt.%": &opentf.ResourceAttrDiff{
"mapInt.%": &tofu.ResourceAttrDiff{
Old: "",
New: "2",
},
"mapInt.one": &opentf.ResourceAttrDiff{
"mapInt.one": &tofu.ResourceAttrDiff{
Old: "",
New: "1",
},
"mapInt.two": &opentf.ResourceAttrDiff{
"mapInt.two": &tofu.ResourceAttrDiff{
Old: "",
New: "2",
},
"mapIntNestedSchema.%": &opentf.ResourceAttrDiff{
"mapIntNestedSchema.%": &tofu.ResourceAttrDiff{
Old: "",
New: "2",
},
"mapIntNestedSchema.one": &opentf.ResourceAttrDiff{
"mapIntNestedSchema.one": &tofu.ResourceAttrDiff{
Old: "",
New: "1",
},
"mapIntNestedSchema.two": &opentf.ResourceAttrDiff{
"mapIntNestedSchema.two": &tofu.ResourceAttrDiff{
Old: "",
New: "2",
},
"mapFloat.%": &opentf.ResourceAttrDiff{
"mapFloat.%": &tofu.ResourceAttrDiff{
Old: "",
New: "1",
},
"mapFloat.oneDotTwo": &opentf.ResourceAttrDiff{
"mapFloat.oneDotTwo": &tofu.ResourceAttrDiff{
Old: "",
New: "1.2",
},
"mapBool.%": &opentf.ResourceAttrDiff{
"mapBool.%": &tofu.ResourceAttrDiff{
Old: "",
New: "2",
},
"mapBool.True": &opentf.ResourceAttrDiff{
"mapBool.True": &tofu.ResourceAttrDiff{
Old: "",
New: "true",
},
"mapBool.False": &opentf.ResourceAttrDiff{
"mapBool.False": &tofu.ResourceAttrDiff{
Old: "",
New: "false",
},
"set.#": &opentf.ResourceAttrDiff{
"set.#": &tofu.ResourceAttrDiff{
Old: "0",
New: "2",
},
"set.10": &opentf.ResourceAttrDiff{
"set.10": &tofu.ResourceAttrDiff{
Old: "",
New: "10",
},
"set.50": &opentf.ResourceAttrDiff{
"set.50": &tofu.ResourceAttrDiff{
Old: "",
New: "50",
},
"setDeep.#": &opentf.ResourceAttrDiff{
"setDeep.#": &tofu.ResourceAttrDiff{
Old: "0",
New: "2",
},
"setDeep.10.index": &opentf.ResourceAttrDiff{
"setDeep.10.index": &tofu.ResourceAttrDiff{
Old: "",
New: "10",
},
"setDeep.10.value": &opentf.ResourceAttrDiff{
"setDeep.10.value": &tofu.ResourceAttrDiff{
Old: "",
New: "foo",
},
"setDeep.50.index": &opentf.ResourceAttrDiff{
"setDeep.50.index": &tofu.ResourceAttrDiff{
Old: "",
New: "50",
},
"setDeep.50.value": &opentf.ResourceAttrDiff{
"setDeep.50.value": &tofu.ResourceAttrDiff{
Old: "",
New: "bar",
},

View File

@ -8,7 +8,7 @@ import (
"strconv"
"testing"
"github.com/opentofu/opentofu/internal/legacy/opentf"
"github.com/opentofu/opentofu/internal/legacy/tofu"
)
func TestMultiLevelFieldReaderReadFieldExact(t *testing.T) {
@ -103,9 +103,9 @@ func TestMultiLevelFieldReaderReadFieldMerge(t *testing.T) {
}),
},
Diff: &opentf.InstanceDiff{
Attributes: map[string]*opentf.ResourceAttrDiff{
"availability_zone": &opentf.ResourceAttrDiff{
Diff: &tofu.InstanceDiff{
Attributes: map[string]*tofu.ResourceAttrDiff{
"availability_zone": &tofu.ResourceAttrDiff{
Old: "foo",
New: "bar",
RequiresNew: true,
@ -150,9 +150,9 @@ func TestMultiLevelFieldReaderReadFieldMerge(t *testing.T) {
}),
},
Diff: &opentf.InstanceDiff{
Attributes: map[string]*opentf.ResourceAttrDiff{
"availability_zone": &opentf.ResourceAttrDiff{
Diff: &tofu.InstanceDiff{
Attributes: map[string]*tofu.ResourceAttrDiff{
"availability_zone": &tofu.ResourceAttrDiff{
Old: "foo",
New: "bar",
NewComputed: true,
@ -197,9 +197,9 @@ func TestMultiLevelFieldReaderReadFieldMerge(t *testing.T) {
}),
},
Diff: &opentf.InstanceDiff{
Attributes: map[string]*opentf.ResourceAttrDiff{
"config_vars.0.bar": &opentf.ResourceAttrDiff{
Diff: &tofu.InstanceDiff{
Attributes: map[string]*tofu.ResourceAttrDiff{
"config_vars.0.bar": &tofu.ResourceAttrDiff{
NewRemoved: true,
},
},

View File

@ -12,7 +12,7 @@ import (
multierror "github.com/hashicorp/go-multierror"
"github.com/opentofu/opentofu/internal/configs/configschema"
"github.com/opentofu/opentofu/internal/legacy/opentf"
"github.com/opentofu/opentofu/internal/legacy/tofu"
)
var ReservedProviderFields = []string{
@ -180,7 +180,7 @@ func (p *Provider) stopInit() {
p.stopCtx, p.stopCtxCancel = context.WithCancel(context.Background())
}
// Stop implementation of opentf.ResourceProvider interface.
// Stop implementation of tofu.ResourceProvider interface.
func (p *Provider) Stop() error {
p.stopOnce.Do(p.stopInit)
@ -203,8 +203,8 @@ func (p *Provider) TestReset() error {
return nil
}
// GetSchema implementation of opentf.ResourceProvider interface
func (p *Provider) GetSchema(req *opentf.ProviderSchemaRequest) (*opentf.ProviderSchema, error) {
// GetSchema implementation of tofu.ResourceProvider interface
func (p *Provider) GetSchema(req *tofu.ProviderSchemaRequest) (*tofu.ProviderSchema, error) {
resourceTypes := map[string]*configschema.Block{}
dataSources := map[string]*configschema.Block{}
@ -219,22 +219,22 @@ func (p *Provider) GetSchema(req *opentf.ProviderSchemaRequest) (*opentf.Provide
}
}
return &opentf.ProviderSchema{
return &tofu.ProviderSchema{
Provider: schemaMap(p.Schema).CoreConfigSchema(),
ResourceTypes: resourceTypes,
DataSources: dataSources,
}, nil
}
// Input implementation of opentf.ResourceProvider interface.
// Input implementation of tofu.ResourceProvider interface.
func (p *Provider) Input(
input opentf.UIInput,
c *opentf.ResourceConfig) (*opentf.ResourceConfig, error) {
input tofu.UIInput,
c *tofu.ResourceConfig) (*tofu.ResourceConfig, error) {
return schemaMap(p.Schema).Input(input, c)
}
// Validate implementation of opentf.ResourceProvider interface.
func (p *Provider) Validate(c *opentf.ResourceConfig) ([]string, []error) {
// Validate implementation of tofu.ResourceProvider interface.
func (p *Provider) Validate(c *tofu.ResourceConfig) ([]string, []error) {
if err := p.InternalValidate(); err != nil {
return nil, []error{fmt.Errorf(
"Internal validation of the provider failed! This is always a bug\n"+
@ -245,9 +245,9 @@ func (p *Provider) Validate(c *opentf.ResourceConfig) ([]string, []error) {
return schemaMap(p.Schema).Validate(c)
}
// ValidateResource implementation of opentf.ResourceProvider interface.
// ValidateResource implementation of tofu.ResourceProvider interface.
func (p *Provider) ValidateResource(
t string, c *opentf.ResourceConfig) ([]string, []error) {
t string, c *tofu.ResourceConfig) ([]string, []error) {
r, ok := p.ResourcesMap[t]
if !ok {
return nil, []error{fmt.Errorf(
@ -257,8 +257,8 @@ func (p *Provider) ValidateResource(
return r.Validate(c)
}
// Configure implementation of opentf.ResourceProvider interface.
func (p *Provider) Configure(c *opentf.ResourceConfig) error {
// Configure implementation of tofu.ResourceProvider interface.
func (p *Provider) Configure(c *tofu.ResourceConfig) error {
// No configuration
if p.ConfigureFunc == nil {
return nil
@ -287,11 +287,11 @@ func (p *Provider) Configure(c *opentf.ResourceConfig) error {
return nil
}
// Apply implementation of opentf.ResourceProvider interface.
// Apply implementation of tofu.ResourceProvider interface.
func (p *Provider) Apply(
info *opentf.InstanceInfo,
s *opentf.InstanceState,
d *opentf.InstanceDiff) (*opentf.InstanceState, error) {
info *tofu.InstanceInfo,
s *tofu.InstanceState,
d *tofu.InstanceDiff) (*tofu.InstanceState, error) {
r, ok := p.ResourcesMap[info.Type]
if !ok {
return nil, fmt.Errorf("unknown resource type: %s", info.Type)
@ -300,11 +300,11 @@ func (p *Provider) Apply(
return r.Apply(s, d, p.meta)
}
// Diff implementation of opentf.ResourceProvider interface.
// Diff implementation of tofu.ResourceProvider interface.
func (p *Provider) Diff(
info *opentf.InstanceInfo,
s *opentf.InstanceState,
c *opentf.ResourceConfig) (*opentf.InstanceDiff, error) {
info *tofu.InstanceInfo,
s *tofu.InstanceState,
c *tofu.ResourceConfig) (*tofu.InstanceDiff, error) {
r, ok := p.ResourcesMap[info.Type]
if !ok {
return nil, fmt.Errorf("unknown resource type: %s", info.Type)
@ -316,9 +316,9 @@ func (p *Provider) Diff(
// SimpleDiff is used by the new protocol wrappers to get a diff that doesn't
// attempt to calculate ignore_changes.
func (p *Provider) SimpleDiff(
info *opentf.InstanceInfo,
s *opentf.InstanceState,
c *opentf.ResourceConfig) (*opentf.InstanceDiff, error) {
info *tofu.InstanceInfo,
s *tofu.InstanceState,
c *tofu.ResourceConfig) (*tofu.InstanceDiff, error) {
r, ok := p.ResourcesMap[info.Type]
if !ok {
return nil, fmt.Errorf("unknown resource type: %s", info.Type)
@ -327,10 +327,10 @@ func (p *Provider) SimpleDiff(
return r.simpleDiff(s, c, p.meta)
}
// Refresh implementation of opentf.ResourceProvider interface.
// Refresh implementation of tofu.ResourceProvider interface.
func (p *Provider) Refresh(
info *opentf.InstanceInfo,
s *opentf.InstanceState) (*opentf.InstanceState, error) {
info *tofu.InstanceInfo,
s *tofu.InstanceState) (*tofu.InstanceState, error) {
r, ok := p.ResourcesMap[info.Type]
if !ok {
return nil, fmt.Errorf("unknown resource type: %s", info.Type)
@ -339,15 +339,15 @@ func (p *Provider) Refresh(
return r.Refresh(s, p.meta)
}
// Resources implementation of opentf.ResourceProvider interface.
func (p *Provider) Resources() []opentf.ResourceType {
// Resources implementation of tofu.ResourceProvider interface.
func (p *Provider) Resources() []tofu.ResourceType {
keys := make([]string, 0, len(p.ResourcesMap))
for k := range p.ResourcesMap {
keys = append(keys, k)
}
sort.Strings(keys)
result := make([]opentf.ResourceType, 0, len(keys))
result := make([]tofu.ResourceType, 0, len(keys))
for _, k := range keys {
resource := p.ResourcesMap[k]
@ -357,7 +357,7 @@ func (p *Provider) Resources() []opentf.ResourceType {
resource = &Resource{}
}
result = append(result, opentf.ResourceType{
result = append(result, tofu.ResourceType{
Name: k,
Importable: resource.Importer != nil,
@ -371,8 +371,8 @@ func (p *Provider) Resources() []opentf.ResourceType {
}
func (p *Provider) ImportState(
info *opentf.InstanceInfo,
id string) ([]*opentf.InstanceState, error) {
info *tofu.InstanceInfo,
id string) ([]*tofu.InstanceState, error) {
// Find the resource
r, ok := p.ResourcesMap[info.Type]
if !ok {
@ -400,7 +400,7 @@ func (p *Provider) ImportState(
}
// Convert the results to InstanceState values and return it
states := make([]*opentf.InstanceState, len(results))
states := make([]*tofu.InstanceState, len(results))
for i, r := range results {
states[i] = r.State()
}
@ -419,9 +419,9 @@ func (p *Provider) ImportState(
return states, nil
}
// ValidateDataSource implementation of opentf.ResourceProvider interface.
// ValidateDataSource implementation of tofu.ResourceProvider interface.
func (p *Provider) ValidateDataSource(
t string, c *opentf.ResourceConfig) ([]string, []error) {
t string, c *tofu.ResourceConfig) ([]string, []error) {
r, ok := p.DataSourcesMap[t]
if !ok {
return nil, []error{fmt.Errorf(
@ -431,10 +431,10 @@ func (p *Provider) ValidateDataSource(
return r.Validate(c)
}
// ReadDataDiff implementation of opentf.ResourceProvider interface.
// ReadDataDiff implementation of tofu.ResourceProvider interface.
func (p *Provider) ReadDataDiff(
info *opentf.InstanceInfo,
c *opentf.ResourceConfig) (*opentf.InstanceDiff, error) {
info *tofu.InstanceInfo,
c *tofu.ResourceConfig) (*tofu.InstanceDiff, error) {
r, ok := p.DataSourcesMap[info.Type]
if !ok {
@ -444,10 +444,10 @@ func (p *Provider) ReadDataDiff(
return r.Diff(nil, c, p.meta)
}
// RefreshData implementation of opentf.ResourceProvider interface.
// RefreshData implementation of tofu.ResourceProvider interface.
func (p *Provider) ReadDataApply(
info *opentf.InstanceInfo,
d *opentf.InstanceDiff) (*opentf.InstanceState, error) {
info *tofu.InstanceInfo,
d *tofu.InstanceDiff) (*tofu.InstanceState, error) {
r, ok := p.DataSourcesMap[info.Type]
if !ok {
@ -457,17 +457,17 @@ func (p *Provider) ReadDataApply(
return r.ReadDataApply(d, p.meta)
}
// DataSources implementation of opentf.ResourceProvider interface.
func (p *Provider) DataSources() []opentf.DataSource {
// DataSources implementation of tofu.ResourceProvider interface.
func (p *Provider) DataSources() []tofu.DataSource {
keys := make([]string, 0, len(p.DataSourcesMap))
for k, _ := range p.DataSourcesMap {
keys = append(keys, k)
}
sort.Strings(keys)
result := make([]opentf.DataSource, 0, len(keys))
result := make([]tofu.DataSource, 0, len(keys))
for _, k := range keys {
result = append(result, opentf.DataSource{
result = append(result, tofu.DataSource{
Name: k,
// Indicates that a provider is compiled against a new enough

View File

@ -14,11 +14,11 @@ import (
"github.com/zclconf/go-cty/cty"
"github.com/opentofu/opentofu/internal/configs/configschema"
"github.com/opentofu/opentofu/internal/legacy/opentf"
"github.com/opentofu/opentofu/internal/legacy/tofu"
)
func TestProvider_impl(t *testing.T) {
var _ opentf.ResourceProvider = new(Provider)
var _ tofu.ResourceProvider = new(Provider)
}
func TestProviderGetSchema(t *testing.T) {
@ -53,7 +53,7 @@ func TestProviderGetSchema(t *testing.T) {
},
}
want := &opentf.ProviderSchema{
want := &tofu.ProviderSchema{
Provider: &configschema.Block{
Attributes: map[string]*configschema.Attribute{
"bar": &configschema.Attribute{
@ -86,7 +86,7 @@ func TestProviderGetSchema(t *testing.T) {
}),
},
}
got, err := p.GetSchema(&opentf.ProviderSchemaRequest{
got, err := p.GetSchema(&tofu.ProviderSchemaRequest{
ResourceTypes: []string{"foo", "bar"},
DataSources: []string{"baz", "bar"},
})
@ -159,7 +159,7 @@ func TestProviderConfigure(t *testing.T) {
}
for i, tc := range cases {
c := opentf.NewResourceConfigRaw(tc.Config)
c := tofu.NewResourceConfigRaw(tc.Config)
err := tc.P.Configure(c)
if err != nil != tc.Err {
t.Fatalf("%d: %s", i, err)
@ -170,11 +170,11 @@ func TestProviderConfigure(t *testing.T) {
func TestProviderResources(t *testing.T) {
cases := []struct {
P *Provider
Result []opentf.ResourceType
Result []tofu.ResourceType
}{
{
P: &Provider{},
Result: []opentf.ResourceType{},
Result: []tofu.ResourceType{},
},
{
@ -184,9 +184,9 @@ func TestProviderResources(t *testing.T) {
"bar": nil,
},
},
Result: []opentf.ResourceType{
opentf.ResourceType{Name: "bar", SchemaAvailable: true},
opentf.ResourceType{Name: "foo", SchemaAvailable: true},
Result: []tofu.ResourceType{
tofu.ResourceType{Name: "bar", SchemaAvailable: true},
tofu.ResourceType{Name: "foo", SchemaAvailable: true},
},
},
@ -198,10 +198,10 @@ func TestProviderResources(t *testing.T) {
"baz": nil,
},
},
Result: []opentf.ResourceType{
opentf.ResourceType{Name: "bar", Importable: true, SchemaAvailable: true},
opentf.ResourceType{Name: "baz", SchemaAvailable: true},
opentf.ResourceType{Name: "foo", SchemaAvailable: true},
Result: []tofu.ResourceType{
tofu.ResourceType{Name: "bar", Importable: true, SchemaAvailable: true},
tofu.ResourceType{Name: "baz", SchemaAvailable: true},
tofu.ResourceType{Name: "foo", SchemaAvailable: true},
},
},
}
@ -217,11 +217,11 @@ func TestProviderResources(t *testing.T) {
func TestProviderDataSources(t *testing.T) {
cases := []struct {
P *Provider
Result []opentf.DataSource
Result []tofu.DataSource
}{
{
P: &Provider{},
Result: []opentf.DataSource{},
Result: []tofu.DataSource{},
},
{
@ -231,9 +231,9 @@ func TestProviderDataSources(t *testing.T) {
"bar": nil,
},
},
Result: []opentf.DataSource{
opentf.DataSource{Name: "bar", SchemaAvailable: true},
opentf.DataSource{Name: "foo", SchemaAvailable: true},
Result: []tofu.DataSource{
tofu.DataSource{Name: "bar", SchemaAvailable: true},
tofu.DataSource{Name: "foo", SchemaAvailable: true},
},
},
}
@ -264,7 +264,7 @@ func TestProviderValidate(t *testing.T) {
}
for i, tc := range cases {
c := opentf.NewResourceConfigRaw(tc.Config)
c := tofu.NewResourceConfigRaw(tc.Config)
_, es := tc.P.Validate(c)
if len(es) > 0 != tc.Err {
t.Fatalf("%d: %#v", i, es)
@ -297,9 +297,9 @@ func TestProviderDiff_legacyTimeoutType(t *testing.T) {
},
},
}
ic := opentf.NewResourceConfigRaw(invalidCfg)
ic := tofu.NewResourceConfigRaw(invalidCfg)
_, err := p.Diff(
&opentf.InstanceInfo{
&tofu.InstanceInfo{
Type: "blah",
},
nil,
@ -333,9 +333,9 @@ func TestProviderDiff_timeoutInvalidValue(t *testing.T) {
"create": "invalid",
},
}
ic := opentf.NewResourceConfigRaw(invalidCfg)
ic := tofu.NewResourceConfigRaw(invalidCfg)
_, err := p.Diff(
&opentf.InstanceInfo{
&tofu.InstanceInfo{
Type: "blah",
},
nil,
@ -379,7 +379,7 @@ func TestProviderValidateResource(t *testing.T) {
}
for i, tc := range cases {
c := opentf.NewResourceConfigRaw(tc.Config)
c := tofu.NewResourceConfigRaw(tc.Config)
_, es := tc.P.ValidateResource(tc.Type, c)
if len(es) > 0 != tc.Err {
t.Fatalf("%d: %#v", i, es)
@ -396,7 +396,7 @@ func TestProviderImportState_default(t *testing.T) {
},
}
states, err := p.ImportState(&opentf.InstanceInfo{
states, err := p.ImportState(&tofu.InstanceInfo{
Type: "foo",
}, "bar")
if err != nil {
@ -428,7 +428,7 @@ func TestProviderImportState_setsId(t *testing.T) {
},
}
_, err := p.ImportState(&opentf.InstanceInfo{
_, err := p.ImportState(&tofu.InstanceInfo{
Type: "foo",
}, "bar")
if err != nil {
@ -458,7 +458,7 @@ func TestProviderImportState_setsType(t *testing.T) {
},
}
_, err := p.ImportState(&opentf.InstanceInfo{
_, err := p.ImportState(&tofu.InstanceInfo{
Type: "foo",
}, "bar")
if err != nil {

View File

@ -11,7 +11,7 @@ import (
"github.com/hashicorp/go-multierror"
"github.com/opentofu/opentofu/internal/configs/configschema"
"github.com/opentofu/opentofu/internal/legacy/opentf"
"github.com/opentofu/opentofu/internal/legacy/tofu"
)
// Provisioner represents a resource provisioner in Terraform and properly
@ -46,7 +46,7 @@ type Provisioner struct {
// ValidateFunc is a function for extended validation. This is optional
// and should be used when individual field validation is not enough.
ValidateFunc func(*opentf.ResourceConfig) ([]string, []error)
ValidateFunc func(*tofu.ResourceConfig) ([]string, []error)
stopCtx context.Context
stopCtxCancel context.CancelFunc
@ -117,23 +117,23 @@ func (p *Provisioner) stopInit() {
p.stopCtx, p.stopCtxCancel = context.WithCancel(context.Background())
}
// Stop implementation of opentf.ResourceProvisioner interface.
// Stop implementation of tofu.ResourceProvisioner interface.
func (p *Provisioner) Stop() error {
p.stopOnce.Do(p.stopInit)
p.stopCtxCancel()
return nil
}
// GetConfigSchema implementation of opentf.ResourceProvisioner interface.
// GetConfigSchema implementation of tofu.ResourceProvisioner interface.
func (p *Provisioner) GetConfigSchema() (*configschema.Block, error) {
return schemaMap(p.Schema).CoreConfigSchema(), nil
}
// Apply implementation of opentf.ResourceProvisioner interface.
// Apply implementation of tofu.ResourceProvisioner interface.
func (p *Provisioner) Apply(
o opentf.UIOutput,
s *opentf.InstanceState,
c *opentf.ResourceConfig) error {
o tofu.UIOutput,
s *tofu.InstanceState,
c *tofu.ResourceConfig) error {
var connData, configData *ResourceData
{
@ -148,7 +148,7 @@ func (p *Provisioner) Apply(
}
}
c := opentf.NewResourceConfigRaw(raw)
c := tofu.NewResourceConfigRaw(raw)
sm := schemaMap(p.ConnSchema)
diff, err := sm.Diff(nil, c, nil, nil, true)
if err != nil {
@ -183,8 +183,8 @@ func (p *Provisioner) Apply(
return p.ApplyFunc(ctx)
}
// Validate implements the opentf.ResourceProvisioner interface.
func (p *Provisioner) Validate(c *opentf.ResourceConfig) (ws []string, es []error) {
// Validate implements the tofu.ResourceProvisioner interface.
func (p *Provisioner) Validate(c *tofu.ResourceConfig) (ws []string, es []error) {
if err := p.InternalValidate(); err != nil {
return nil, []error{fmt.Errorf(
"Internal validation of the provisioner failed! This is always a bug\n"+

View File

@ -10,11 +10,11 @@ import (
"testing"
"time"
"github.com/opentofu/opentofu/internal/legacy/opentf"
"github.com/opentofu/opentofu/internal/legacy/tofu"
)
func TestProvisioner_impl(t *testing.T) {
var _ opentf.ResourceProvisioner = new(Provisioner)
var _ tofu.ResourceProvisioner = new(Provisioner)
}
func noopApply(ctx context.Context) error {
@ -114,7 +114,7 @@ func TestProvisionerValidate(t *testing.T) {
P: &Provisioner{
Schema: nil,
ApplyFunc: noopApply,
ValidateFunc: func(*opentf.ResourceConfig) (ws []string, errors []error) {
ValidateFunc: func(*tofu.ResourceConfig) (ws []string, errors []error) {
ws = append(ws, "Simple warning from provisioner ValidateFunc")
return
},
@ -127,7 +127,7 @@ func TestProvisionerValidate(t *testing.T) {
for i, tc := range cases {
t.Run(fmt.Sprintf("%d-%s", i, tc.Name), func(t *testing.T) {
c := opentf.NewResourceConfigRaw(tc.Config)
c := tofu.NewResourceConfigRaw(tc.Config)
ws, es := tc.P.Validate(c)
if len(es) > 0 != tc.Err {
t.Fatalf("%d: %#v %s", i, es, es)
@ -189,10 +189,10 @@ func TestProvisionerApply(t *testing.T) {
for i, tc := range cases {
t.Run(fmt.Sprintf("%d-%s", i, tc.Name), func(t *testing.T) {
c := opentf.NewResourceConfigRaw(tc.Config)
c := tofu.NewResourceConfigRaw(tc.Config)
state := &opentf.InstanceState{
Ephemeral: opentf.EphemeralState{
state := &tofu.InstanceState{
Ephemeral: tofu.EphemeralState{
ConnInfo: tc.Conn,
},
}
@ -230,7 +230,7 @@ func TestProvisionerApply_nilState(t *testing.T) {
"foo": 42,
}
c := opentf.NewResourceConfigRaw(conf)
c := tofu.NewResourceConfigRaw(conf)
err := p.Apply(nil, nil, c)
if err != nil {
t.Fatalf("err: %s", err)
@ -290,9 +290,9 @@ func TestProvisionerStop_apply(t *testing.T) {
"foo": 42,
}
c := opentf.NewResourceConfigRaw(conf)
state := &opentf.InstanceState{
Ephemeral: opentf.EphemeralState{
c := tofu.NewResourceConfigRaw(conf)
state := &tofu.InstanceState{
Ephemeral: tofu.EphemeralState{
ConnInfo: conn,
},
}

View File

@ -9,7 +9,7 @@ import (
"log"
"strconv"
"github.com/opentofu/opentofu/internal/legacy/opentf"
"github.com/opentofu/opentofu/internal/legacy/tofu"
"github.com/zclconf/go-cty/cty"
)
@ -178,11 +178,11 @@ type Resource struct {
}
// ShimInstanceStateFromValue converts a cty.Value to a
// opentf.InstanceState.
func (r *Resource) ShimInstanceStateFromValue(state cty.Value) (*opentf.InstanceState, error) {
// tofu.InstanceState.
func (r *Resource) ShimInstanceStateFromValue(state cty.Value) (*tofu.InstanceState, error) {
// Get the raw shimmed value. While this is correct, the set hashes don't
// match those from the Schema.
s := opentf.NewInstanceStateShimmedFromValue(state, r.SchemaVersion)
s := tofu.NewInstanceStateShimmedFromValue(state, r.SchemaVersion)
// We now rebuild the state through the ResourceData, so that the set indexes
// match what helper/schema expects.
@ -193,7 +193,7 @@ func (r *Resource) ShimInstanceStateFromValue(state cty.Value) (*opentf.Instance
s = data.State()
if s == nil {
s = &opentf.InstanceState{}
s = &tofu.InstanceState{}
}
return s, nil
}
@ -215,7 +215,7 @@ type ExistsFunc func(*ResourceData, interface{}) (bool, error)
// See Resource documentation.
type StateMigrateFunc func(
int, *opentf.InstanceState, interface{}) (*opentf.InstanceState, error)
int, *tofu.InstanceState, interface{}) (*tofu.InstanceState, error)
type StateUpgrader struct {
// Version is the version schema that this Upgrader will handle, converting
@ -243,9 +243,9 @@ type CustomizeDiffFunc func(*ResourceDiff, interface{}) error
// Apply creates, updates, and/or deletes a resource.
func (r *Resource) Apply(
s *opentf.InstanceState,
d *opentf.InstanceDiff,
meta interface{}) (*opentf.InstanceState, error) {
s *tofu.InstanceState,
d *tofu.InstanceDiff,
meta interface{}) (*tofu.InstanceState, error) {
data, err := schemaMap(r.Schema).Data(s, d)
if err != nil {
return s, err
@ -275,7 +275,7 @@ func (r *Resource) Apply(
if s == nil {
// The Terraform API dictates that this should never happen, but
// it doesn't hurt to be safe in this case.
s = new(opentf.InstanceState)
s = new(tofu.InstanceState)
}
if d.Destroy || d.RequiresNew() {
@ -322,9 +322,9 @@ func (r *Resource) Apply(
// Diff returns a diff of this resource.
func (r *Resource) Diff(
s *opentf.InstanceState,
c *opentf.ResourceConfig,
meta interface{}) (*opentf.InstanceDiff, error) {
s *tofu.InstanceState,
c *tofu.ResourceConfig,
meta interface{}) (*tofu.InstanceDiff, error) {
t := &ResourceTimeout{}
err := t.ConfigDecode(r, c)
@ -350,9 +350,9 @@ func (r *Resource) Diff(
}
func (r *Resource) simpleDiff(
s *opentf.InstanceState,
c *opentf.ResourceConfig,
meta interface{}) (*opentf.InstanceDiff, error) {
s *tofu.InstanceState,
c *tofu.ResourceConfig,
meta interface{}) (*tofu.InstanceDiff, error) {
instanceDiff, err := schemaMap(r.Schema).Diff(s, c, r.CustomizeDiff, meta, false)
if err != nil {
@ -360,7 +360,7 @@ func (r *Resource) simpleDiff(
}
if instanceDiff == nil {
instanceDiff = opentf.NewInstanceDiff()
instanceDiff = tofu.NewInstanceDiff()
}
// Make sure the old value is set in each of the instance diffs.
@ -378,7 +378,7 @@ func (r *Resource) simpleDiff(
}
// Validate validates the resource configuration against the schema.
func (r *Resource) Validate(c *opentf.ResourceConfig) ([]string, []error) {
func (r *Resource) Validate(c *tofu.ResourceConfig) ([]string, []error) {
warns, errs := schemaMap(r.Schema).Validate(c)
if r.DeprecationMessage != "" {
@ -391,9 +391,9 @@ func (r *Resource) Validate(c *opentf.ResourceConfig) ([]string, []error) {
// ReadDataApply loads the data for a data source, given a diff that
// describes the configuration arguments and desired computed attributes.
func (r *Resource) ReadDataApply(
d *opentf.InstanceDiff,
d *tofu.InstanceDiff,
meta interface{},
) (*opentf.InstanceState, error) {
) (*tofu.InstanceState, error) {
// Data sources are always built completely from scratch
// on each read, so the source state is always nil.
data, err := schemaMap(r.Schema).Data(nil, d)
@ -419,8 +419,8 @@ func (r *Resource) ReadDataApply(
// separate API call.
// RefreshWithoutUpgrade is part of the new plugin shims.
func (r *Resource) RefreshWithoutUpgrade(
s *opentf.InstanceState,
meta interface{}) (*opentf.InstanceState, error) {
s *tofu.InstanceState,
meta interface{}) (*tofu.InstanceState, error) {
// If the ID is already somehow blank, it doesn't exist
if s.ID == "" {
return nil, nil
@ -477,8 +477,8 @@ func (r *Resource) RefreshWithoutUpgrade(
// Refresh refreshes the state of the resource.
func (r *Resource) Refresh(
s *opentf.InstanceState,
meta interface{}) (*opentf.InstanceState, error) {
s *tofu.InstanceState,
meta interface{}) (*tofu.InstanceState, error) {
// If the ID is already somehow blank, it doesn't exist
if s.ID == "" {
return nil, nil
@ -531,7 +531,7 @@ func (r *Resource) Refresh(
return r.recordCurrentSchemaVersion(state), err
}
func (r *Resource) upgradeState(s *opentf.InstanceState, meta interface{}) (*opentf.InstanceState, error) {
func (r *Resource) upgradeState(s *tofu.InstanceState, meta interface{}) (*tofu.InstanceState, error) {
var err error
needsMigration, stateSchemaVersion := r.checkSchemaVersion(s)
@ -744,7 +744,7 @@ func isReservedResourceFieldName(name string, s *Schema) bool {
// itself (including the state given to this function).
//
// This function is useful for unit tests and ResourceImporter functions.
func (r *Resource) Data(s *opentf.InstanceState) *ResourceData {
func (r *Resource) Data(s *tofu.InstanceState) *ResourceData {
result, err := schemaMap(r.Schema).Data(s, nil)
if err != nil {
// At the time of writing, this isn't possible (Data never returns
@ -791,7 +791,7 @@ func (r *Resource) isTopLevel() bool {
// Determines if a given InstanceState needs to be migrated by checking the
// stored version number with the current SchemaVersion
func (r *Resource) checkSchemaVersion(is *opentf.InstanceState) (bool, int) {
func (r *Resource) checkSchemaVersion(is *tofu.InstanceState) (bool, int) {
// Get the raw interface{} value for the schema version. If it doesn't
// exist or is nil then set it to zero.
raw := is.Meta["schema_version"]
@ -820,7 +820,7 @@ func (r *Resource) checkSchemaVersion(is *opentf.InstanceState) (bool, int) {
}
func (r *Resource) recordCurrentSchemaVersion(
state *opentf.InstanceState) *opentf.InstanceState {
state *tofu.InstanceState) *tofu.InstanceState {
if state != nil && r.SchemaVersion > 0 {
if state.Meta == nil {
state.Meta = make(map[string]interface{})

View File

@ -10,7 +10,7 @@ import (
"sync"
"time"
"github.com/opentofu/opentofu/internal/legacy/opentf"
"github.com/opentofu/opentofu/internal/legacy/tofu"
"github.com/zclconf/go-cty/cty"
"github.com/zclconf/go-cty/cty/gocty"
)
@ -26,9 +26,9 @@ import (
type ResourceData struct {
// Settable (internally)
schema map[string]*Schema
config *opentf.ResourceConfig
state *opentf.InstanceState
diff *opentf.InstanceDiff
config *tofu.ResourceConfig
state *tofu.InstanceState
diff *tofu.InstanceDiff
meta map[string]interface{}
timeouts *ResourceTimeout
providerMeta cty.Value
@ -36,7 +36,7 @@ type ResourceData struct {
// Don't set
multiReader *MultiLevelFieldReader
setWriter *MapFieldWriter
newState *opentf.InstanceState
newState *tofu.InstanceState
partial bool
partialMap map[string]struct{}
once sync.Once
@ -289,8 +289,8 @@ func (d *ResourceData) SetType(t string) {
// State returns the new InstanceState after the diff and any Set
// calls.
func (d *ResourceData) State() *opentf.InstanceState {
var result opentf.InstanceState
func (d *ResourceData) State() *tofu.InstanceState {
var result tofu.InstanceState
result.ID = d.Id()
result.Meta = d.meta
@ -425,7 +425,7 @@ func (d *ResourceData) Timeout(key string) time.Duration {
func (d *ResourceData) init() {
// Initialize the field that will store our new state
var copyState opentf.InstanceState
var copyState tofu.InstanceState
if d.state != nil {
copyState = *d.state.DeepCopy()
}

File diff suppressed because it is too large Load Diff

View File

@ -10,7 +10,7 @@ import (
"strings"
"sync"
"github.com/opentofu/opentofu/internal/legacy/opentf"
"github.com/opentofu/opentofu/internal/legacy/tofu"
)
// newValueWriter is a minor re-implementation of MapFieldWriter to include
@ -116,16 +116,16 @@ type ResourceDiff struct {
schema map[string]*Schema
// The current config for this resource.
config *opentf.ResourceConfig
config *tofu.ResourceConfig
// The state for this resource as it exists post-refresh, after the initial
// diff.
state *opentf.InstanceState
state *tofu.InstanceState
// The diff created by Terraform. This diff is used, along with state,
// config, and custom-set diff data, to provide a multi-level reader
// experience similar to ResourceData.
diff *opentf.InstanceDiff
diff *tofu.InstanceDiff
// The internal reader structure that contains the state, config, the default
// diff, and the new diff.
@ -145,7 +145,7 @@ type ResourceDiff struct {
}
// newResourceDiff creates a new ResourceDiff instance.
func newResourceDiff(schema map[string]*Schema, config *opentf.ResourceConfig, state *opentf.InstanceState, diff *opentf.InstanceDiff) *ResourceDiff {
func newResourceDiff(schema map[string]*Schema, config *tofu.ResourceConfig, state *tofu.InstanceState, diff *tofu.InstanceDiff) *ResourceDiff {
d := &ResourceDiff{
config: config,
state: state,

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,7 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/opentofu/opentofu/internal/configs/hcl2shim"
"github.com/opentofu/opentofu/internal/legacy/opentf"
"github.com/opentofu/opentofu/internal/legacy/tofu"
"github.com/zclconf/go-cty/cty"
ctyjson "github.com/zclconf/go-cty/cty/json"
@ -37,11 +37,11 @@ func TestResourceApply_create(t *testing.T) {
return nil
}
var s *opentf.InstanceState = nil
var s *tofu.InstanceState = nil
d := &opentf.InstanceDiff{
Attributes: map[string]*opentf.ResourceAttrDiff{
"foo": &opentf.ResourceAttrDiff{
d := &tofu.InstanceDiff{
Attributes: map[string]*tofu.ResourceAttrDiff{
"foo": &tofu.ResourceAttrDiff{
New: "42",
},
},
@ -56,7 +56,7 @@ func TestResourceApply_create(t *testing.T) {
t.Fatal("not called")
}
expected := &opentf.InstanceState{
expected := &tofu.InstanceState{
ID: "foo",
Attributes: map[string]string{
"id": "foo",
@ -95,11 +95,11 @@ func TestResourceApply_Timeout_state(t *testing.T) {
return nil
}
var s *opentf.InstanceState = nil
var s *tofu.InstanceState = nil
d := &opentf.InstanceDiff{
Attributes: map[string]*opentf.ResourceAttrDiff{
"foo": &opentf.ResourceAttrDiff{
d := &tofu.InstanceDiff{
Attributes: map[string]*tofu.ResourceAttrDiff{
"foo": &tofu.ResourceAttrDiff{
New: "42",
},
},
@ -124,7 +124,7 @@ func TestResourceApply_Timeout_state(t *testing.T) {
t.Fatal("not called")
}
expected := &opentf.InstanceState{
expected := &tofu.InstanceState{
ID: "foo",
Attributes: map[string]string{
"id": "foo",
@ -169,7 +169,7 @@ func TestResourceApply_Timeout_destroy(t *testing.T) {
return nil
}
s := &opentf.InstanceState{
s := &tofu.InstanceState{
ID: "bar",
}
@ -177,7 +177,7 @@ func TestResourceApply_Timeout_destroy(t *testing.T) {
t.Fatalf("Error encoding to state: %s", err)
}
d := &opentf.InstanceDiff{
d := &tofu.InstanceDiff{
Destroy: true,
}
@ -219,7 +219,7 @@ func TestResourceDiff_Timeout_diff(t *testing.T) {
return nil
}
conf := opentf.NewResourceConfigRaw(
conf := tofu.NewResourceConfigRaw(
map[string]interface{}{
"foo": 42,
TimeoutsConfigKey: map[string]interface{}{
@ -227,16 +227,16 @@ func TestResourceDiff_Timeout_diff(t *testing.T) {
},
},
)
var s *opentf.InstanceState
var s *tofu.InstanceState
actual, err := r.Diff(s, conf, nil)
if err != nil {
t.Fatalf("err: %s", err)
}
expected := &opentf.InstanceDiff{
Attributes: map[string]*opentf.ResourceAttrDiff{
"foo": &opentf.ResourceAttrDiff{
expected := &tofu.InstanceDiff{
Attributes: map[string]*tofu.ResourceAttrDiff{
"foo": &tofu.ResourceAttrDiff{
New: "42",
},
},
@ -274,13 +274,13 @@ func TestResourceDiff_CustomizeFunc(t *testing.T) {
return nil
}
conf := opentf.NewResourceConfigRaw(
conf := tofu.NewResourceConfigRaw(
map[string]interface{}{
"foo": 42,
},
)
var s *opentf.InstanceState
var s *tofu.InstanceState
_, err := r.Diff(s, conf, nil)
if err != nil {
@ -308,11 +308,11 @@ func TestResourceApply_destroy(t *testing.T) {
return nil
}
s := &opentf.InstanceState{
s := &tofu.InstanceState{
ID: "bar",
}
d := &opentf.InstanceDiff{
d := &tofu.InstanceDiff{
Destroy: true,
}
@ -356,7 +356,7 @@ func TestResourceApply_destroyCreate(t *testing.T) {
return nil
}
var s *opentf.InstanceState = &opentf.InstanceState{
var s *tofu.InstanceState = &tofu.InstanceState{
ID: "bar",
Attributes: map[string]string{
"foo": "bar",
@ -364,13 +364,13 @@ func TestResourceApply_destroyCreate(t *testing.T) {
},
}
d := &opentf.InstanceDiff{
Attributes: map[string]*opentf.ResourceAttrDiff{
"foo": &opentf.ResourceAttrDiff{
d := &tofu.InstanceDiff{
Attributes: map[string]*tofu.ResourceAttrDiff{
"foo": &tofu.ResourceAttrDiff{
New: "42",
RequiresNew: true,
},
"tags.Name": &opentf.ResourceAttrDiff{
"tags.Name": &tofu.ResourceAttrDiff{
Old: "foo",
New: "foo",
RequiresNew: true,
@ -387,7 +387,7 @@ func TestResourceApply_destroyCreate(t *testing.T) {
t.Fatal("should have change")
}
expected := &opentf.InstanceState{
expected := &tofu.InstanceState{
ID: "foo",
Attributes: map[string]string{
"id": "foo",
@ -418,14 +418,14 @@ func TestResourceApply_destroyPartial(t *testing.T) {
return fmt.Errorf("some error")
}
s := &opentf.InstanceState{
s := &tofu.InstanceState{
ID: "bar",
Attributes: map[string]string{
"foo": "12",
},
}
d := &opentf.InstanceDiff{
d := &tofu.InstanceDiff{
Destroy: true,
}
@ -434,7 +434,7 @@ func TestResourceApply_destroyPartial(t *testing.T) {
t.Fatal("should error")
}
expected := &opentf.InstanceState{
expected := &tofu.InstanceState{
ID: "bar",
Attributes: map[string]string{
"id": "bar",
@ -465,16 +465,16 @@ func TestResourceApply_update(t *testing.T) {
return nil
}
s := &opentf.InstanceState{
s := &tofu.InstanceState{
ID: "foo",
Attributes: map[string]string{
"foo": "12",
},
}
d := &opentf.InstanceDiff{
Attributes: map[string]*opentf.ResourceAttrDiff{
"foo": &opentf.ResourceAttrDiff{
d := &tofu.InstanceDiff{
Attributes: map[string]*tofu.ResourceAttrDiff{
"foo": &tofu.ResourceAttrDiff{
New: "13",
},
},
@ -485,7 +485,7 @@ func TestResourceApply_update(t *testing.T) {
t.Fatalf("err: %s", err)
}
expected := &opentf.InstanceState{
expected := &tofu.InstanceState{
ID: "foo",
Attributes: map[string]string{
"id": "foo",
@ -510,16 +510,16 @@ func TestResourceApply_updateNoCallback(t *testing.T) {
r.Update = nil
s := &opentf.InstanceState{
s := &tofu.InstanceState{
ID: "foo",
Attributes: map[string]string{
"foo": "12",
},
}
d := &opentf.InstanceDiff{
Attributes: map[string]*opentf.ResourceAttrDiff{
"foo": &opentf.ResourceAttrDiff{
d := &tofu.InstanceDiff{
Attributes: map[string]*tofu.ResourceAttrDiff{
"foo": &tofu.ResourceAttrDiff{
New: "13",
},
},
@ -530,7 +530,7 @@ func TestResourceApply_updateNoCallback(t *testing.T) {
t.Fatal("should error")
}
expected := &opentf.InstanceState{
expected := &tofu.InstanceState{
ID: "foo",
Attributes: map[string]string{
"foo": "12",
@ -566,23 +566,23 @@ func TestResourceApply_isNewResource(t *testing.T) {
}
r.Update = updateFunc
d := &opentf.InstanceDiff{
Attributes: map[string]*opentf.ResourceAttrDiff{
"foo": &opentf.ResourceAttrDiff{
d := &tofu.InstanceDiff{
Attributes: map[string]*tofu.ResourceAttrDiff{
"foo": &tofu.ResourceAttrDiff{
New: "bla-blah",
},
},
}
// positive test
var s *opentf.InstanceState = nil
var s *tofu.InstanceState = nil
actual, err := r.Apply(s, d, nil)
if err != nil {
t.Fatalf("err: %s", err)
}
expected := &opentf.InstanceState{
expected := &tofu.InstanceState{
ID: "foo",
Attributes: map[string]string{
"id": "foo",
@ -596,7 +596,7 @@ func TestResourceApply_isNewResource(t *testing.T) {
}
// negative test
s = &opentf.InstanceState{
s = &tofu.InstanceState{
ID: "foo",
Attributes: map[string]string{
"id": "foo",
@ -609,7 +609,7 @@ func TestResourceApply_isNewResource(t *testing.T) {
t.Fatalf("err: %s", err)
}
expected = &opentf.InstanceState{
expected = &tofu.InstanceState{
ID: "foo",
Attributes: map[string]string{
"id": "foo",
@ -903,14 +903,14 @@ func TestResourceRefresh(t *testing.T) {
return d.Set("foo", d.Get("foo").(int)+1)
}
s := &opentf.InstanceState{
s := &tofu.InstanceState{
ID: "bar",
Attributes: map[string]string{
"foo": "12",
},
}
expected := &opentf.InstanceState{
expected := &tofu.InstanceState{
ID: "bar",
Attributes: map[string]string{
"id": "bar",
@ -946,7 +946,7 @@ func TestResourceRefresh_blankId(t *testing.T) {
return nil
}
s := &opentf.InstanceState{
s := &tofu.InstanceState{
ID: "",
Attributes: map[string]string{},
}
@ -975,7 +975,7 @@ func TestResourceRefresh_delete(t *testing.T) {
return nil
}
s := &opentf.InstanceState{
s := &tofu.InstanceState{
ID: "bar",
Attributes: map[string]string{
"foo": "12",
@ -1010,7 +1010,7 @@ func TestResourceRefresh_existsError(t *testing.T) {
panic("shouldn't be called")
}
s := &opentf.InstanceState{
s := &tofu.InstanceState{
ID: "bar",
Attributes: map[string]string{
"foo": "12",
@ -1044,7 +1044,7 @@ func TestResourceRefresh_noExists(t *testing.T) {
panic("shouldn't be called")
}
s := &opentf.InstanceState{
s := &tofu.InstanceState{
ID: "bar",
Attributes: map[string]string{
"foo": "12",
@ -1078,8 +1078,8 @@ func TestResourceRefresh_needsMigration(t *testing.T) {
r.MigrateState = func(
v int,
s *opentf.InstanceState,
meta interface{}) (*opentf.InstanceState, error) {
s *tofu.InstanceState,
meta interface{}) (*tofu.InstanceState, error) {
// Real state migration functions will probably switch on this value,
// but we'll just assert on it for now.
if v != 1 {
@ -1102,7 +1102,7 @@ func TestResourceRefresh_needsMigration(t *testing.T) {
// State is v1 and deals in oldfoo, which tracked foo as a float at 1/10th
// the scale of newfoo
s := &opentf.InstanceState{
s := &tofu.InstanceState{
ID: "bar",
Attributes: map[string]string{
"oldfoo": "1.2",
@ -1117,7 +1117,7 @@ func TestResourceRefresh_needsMigration(t *testing.T) {
t.Fatalf("err: %s", err)
}
expected := &opentf.InstanceState{
expected := &tofu.InstanceState{
ID: "bar",
Attributes: map[string]string{
"id": "bar",
@ -1150,13 +1150,13 @@ func TestResourceRefresh_noMigrationNeeded(t *testing.T) {
r.MigrateState = func(
v int,
s *opentf.InstanceState,
meta interface{}) (*opentf.InstanceState, error) {
s *tofu.InstanceState,
meta interface{}) (*tofu.InstanceState, error) {
t.Fatal("Migrate function shouldn't be called!")
return nil, nil
}
s := &opentf.InstanceState{
s := &tofu.InstanceState{
ID: "bar",
Attributes: map[string]string{
"newfoo": "12",
@ -1171,7 +1171,7 @@ func TestResourceRefresh_noMigrationNeeded(t *testing.T) {
t.Fatalf("err: %s", err)
}
expected := &opentf.InstanceState{
expected := &tofu.InstanceState{
ID: "bar",
Attributes: map[string]string{
"id": "bar",
@ -1205,13 +1205,13 @@ func TestResourceRefresh_stateSchemaVersionUnset(t *testing.T) {
r.MigrateState = func(
v int,
s *opentf.InstanceState,
meta interface{}) (*opentf.InstanceState, error) {
s *tofu.InstanceState,
meta interface{}) (*tofu.InstanceState, error) {
s.Attributes["newfoo"] = s.Attributes["oldfoo"]
return s, nil
}
s := &opentf.InstanceState{
s := &tofu.InstanceState{
ID: "bar",
Attributes: map[string]string{
"oldfoo": "12",
@ -1223,7 +1223,7 @@ func TestResourceRefresh_stateSchemaVersionUnset(t *testing.T) {
t.Fatalf("err: %s", err)
}
expected := &opentf.InstanceState{
expected := &tofu.InstanceState{
ID: "bar",
Attributes: map[string]string{
"id": "bar",
@ -1257,12 +1257,12 @@ func TestResourceRefresh_migrateStateErr(t *testing.T) {
r.MigrateState = func(
v int,
s *opentf.InstanceState,
meta interface{}) (*opentf.InstanceState, error) {
s *tofu.InstanceState,
meta interface{}) (*tofu.InstanceState, error) {
return s, fmt.Errorf("triggering an error")
}
s := &opentf.InstanceState{
s := &tofu.InstanceState{
ID: "bar",
Attributes: map[string]string{
"oldfoo": "12",
@ -1286,7 +1286,7 @@ func TestResourceData(t *testing.T) {
},
}
state := &opentf.InstanceState{
state := &tofu.InstanceState{
ID: "foo",
Attributes: map[string]string{
"id": "foo",
@ -1548,7 +1548,7 @@ func TestResource_migrateAndUpgrade(t *testing.T) {
},
},
// this MigrateState will take the state to version 2
MigrateState: func(v int, is *opentf.InstanceState, _ interface{}) (*opentf.InstanceState, error) {
MigrateState: func(v int, is *tofu.InstanceState, _ interface{}) (*tofu.InstanceState, error) {
switch v {
case 0:
_, ok := is.Attributes["zero"]
@ -1611,7 +1611,7 @@ func TestResource_migrateAndUpgrade(t *testing.T) {
},
}
testStates := []*opentf.InstanceState{
testStates := []*tofu.InstanceState{
{
ID: "bar",
Attributes: map[string]string{
@ -1671,7 +1671,7 @@ func TestResource_migrateAndUpgrade(t *testing.T) {
t.Fatal(err)
}
expected := &opentf.InstanceState{
expected := &tofu.InstanceState{
ID: "bar",
Attributes: map[string]string{
"id": "bar",

View File

@ -10,7 +10,7 @@ import (
"github.com/mitchellh/copystructure"
"github.com/opentofu/opentofu/internal/configs/hcl2shim"
"github.com/opentofu/opentofu/internal/legacy/opentf"
"github.com/opentofu/opentofu/internal/legacy/tofu"
)
const TimeoutKey = "e2bfb730-ecaa-11e6-8f88-34363bc7c4c0"
@ -56,7 +56,7 @@ type ResourceTimeout struct {
// ConfigDecode takes a schema and the configuration (available in Diff) and
// validates, parses the timeouts into `t`
func (t *ResourceTimeout) ConfigDecode(s *Resource, c *opentf.ResourceConfig) error {
func (t *ResourceTimeout) ConfigDecode(s *Resource, c *tofu.ResourceConfig) error {
if s.Timeouts != nil {
raw, err := copystructure.Copy(s.Timeouts)
if err != nil {
@ -156,18 +156,18 @@ func unsupportedTimeoutKeyError(key string) error {
//
// StateEncode encodes the timeout into the ResourceData's InstanceState for
// saving to state
func (t *ResourceTimeout) DiffEncode(id *opentf.InstanceDiff) error {
func (t *ResourceTimeout) DiffEncode(id *tofu.InstanceDiff) error {
return t.metaEncode(id)
}
func (t *ResourceTimeout) StateEncode(is *opentf.InstanceState) error {
func (t *ResourceTimeout) StateEncode(is *tofu.InstanceState) error {
return t.metaEncode(is)
}
// metaEncode encodes the ResourceTimeout into a map[string]interface{} format
// and stores it in the Meta field of the interface it's given.
// Assumes the interface is either *opentf.InstanceState or
// *opentf.InstanceDiff, returns an error otherwise
// Assumes the interface is either *tofu.InstanceState or
// *tofu.InstanceDiff, returns an error otherwise
func (t *ResourceTimeout) metaEncode(ids interface{}) error {
m := make(map[string]interface{})
@ -197,12 +197,12 @@ func (t *ResourceTimeout) metaEncode(ids interface{}) error {
// only add the Timeout to the Meta if we have values
if len(m) > 0 {
switch instance := ids.(type) {
case *opentf.InstanceDiff:
case *tofu.InstanceDiff:
if instance.Meta == nil {
instance.Meta = make(map[string]interface{})
}
instance.Meta[TimeoutKey] = m
case *opentf.InstanceState:
case *tofu.InstanceState:
if instance.Meta == nil {
instance.Meta = make(map[string]interface{})
}
@ -215,10 +215,10 @@ func (t *ResourceTimeout) metaEncode(ids interface{}) error {
return nil
}
func (t *ResourceTimeout) StateDecode(id *opentf.InstanceState) error {
func (t *ResourceTimeout) StateDecode(id *tofu.InstanceState) error {
return t.metaDecode(id)
}
func (t *ResourceTimeout) DiffDecode(is *opentf.InstanceDiff) error {
func (t *ResourceTimeout) DiffDecode(is *tofu.InstanceDiff) error {
return t.metaDecode(is)
}
@ -226,12 +226,12 @@ func (t *ResourceTimeout) metaDecode(ids interface{}) error {
var rawMeta interface{}
var ok bool
switch rawInstance := ids.(type) {
case *opentf.InstanceDiff:
case *tofu.InstanceDiff:
rawMeta, ok = rawInstance.Meta[TimeoutKey]
if !ok {
return nil
}
case *opentf.InstanceState:
case *tofu.InstanceState:
rawMeta, ok = rawInstance.Meta[TimeoutKey]
if !ok {
return nil

View File

@ -9,7 +9,7 @@ import (
"testing"
"time"
"github.com/opentofu/opentofu/internal/legacy/opentf"
"github.com/opentofu/opentofu/internal/legacy/tofu"
)
func TestResourceTimeout_ConfigDecode_badkey(t *testing.T) {
@ -62,7 +62,7 @@ func TestResourceTimeout_ConfigDecode_badkey(t *testing.T) {
Timeouts: c.ResourceDefaultTimeout,
}
conf := opentf.NewResourceConfigRaw(
conf := tofu.NewResourceConfigRaw(
map[string]interface{}{
"foo": "bar",
TimeoutsConfigKey: c.Config,
@ -99,7 +99,7 @@ func TestResourceTimeout_ConfigDecode(t *testing.T) {
},
}
c := opentf.NewResourceConfigRaw(
c := tofu.NewResourceConfigRaw(
map[string]interface{}{
"foo": "bar",
TimeoutsConfigKey: map[string]interface{}{
@ -133,7 +133,7 @@ func TestResourceTimeout_legacyConfigDecode(t *testing.T) {
},
}
c := opentf.NewResourceConfigRaw(
c := tofu.NewResourceConfigRaw(
map[string]interface{}{
"foo": "bar",
TimeoutsConfigKey: []interface{}{
@ -195,7 +195,7 @@ func TestResourceTimeout_DiffEncode_basic(t *testing.T) {
}
for _, c := range cases {
state := &opentf.InstanceDiff{}
state := &tofu.InstanceDiff{}
err := c.Timeout.DiffEncode(state)
if err != nil && !c.ShouldErr {
t.Fatalf("Error, expected:\n%#v\n got:\n%#v\n", c.Expected, state.Meta)
@ -209,7 +209,7 @@ func TestResourceTimeout_DiffEncode_basic(t *testing.T) {
}
// same test cases but for InstanceState
for _, c := range cases {
state := &opentf.InstanceState{}
state := &tofu.InstanceState{}
err := c.Timeout.StateEncode(state)
if err != nil && !c.ShouldErr {
t.Fatalf("Error, expected:\n%#v\n got:\n%#v\n", c.Expected, state.Meta)
@ -225,32 +225,32 @@ func TestResourceTimeout_DiffEncode_basic(t *testing.T) {
func TestResourceTimeout_MetaDecode_basic(t *testing.T) {
cases := []struct {
State *opentf.InstanceDiff
State *tofu.InstanceDiff
Expected *ResourceTimeout
// Not immediately clear when an error would hit
ShouldErr bool
}{
// Two fields
{
State: &opentf.InstanceDiff{Meta: map[string]interface{}{TimeoutKey: expectedForValues(10, 0, 5, 0, 0)}},
State: &tofu.InstanceDiff{Meta: map[string]interface{}{TimeoutKey: expectedForValues(10, 0, 5, 0, 0)}},
Expected: timeoutForValues(10, 0, 5, 0, 0),
ShouldErr: false,
},
// Two fields, one is Default
{
State: &opentf.InstanceDiff{Meta: map[string]interface{}{TimeoutKey: expectedForValues(10, 0, 0, 0, 7)}},
State: &tofu.InstanceDiff{Meta: map[string]interface{}{TimeoutKey: expectedForValues(10, 0, 0, 0, 7)}},
Expected: timeoutForValues(10, 7, 7, 7, 7),
ShouldErr: false,
},
// All fields
{
State: &opentf.InstanceDiff{Meta: map[string]interface{}{TimeoutKey: expectedForValues(10, 3, 4, 1, 7)}},
State: &tofu.InstanceDiff{Meta: map[string]interface{}{TimeoutKey: expectedForValues(10, 3, 4, 1, 7)}},
Expected: timeoutForValues(10, 3, 4, 1, 7),
ShouldErr: false,
},
// No fields
{
State: &opentf.InstanceDiff{},
State: &tofu.InstanceDiff{},
Expected: &ResourceTimeout{},
ShouldErr: false,
},

View File

@ -28,7 +28,7 @@ import (
"github.com/mitchellh/copystructure"
"github.com/mitchellh/mapstructure"
"github.com/opentofu/opentofu/internal/configs/hcl2shim"
"github.com/opentofu/opentofu/internal/legacy/opentf"
"github.com/opentofu/opentofu/internal/legacy/tofu"
)
// Name of ENV variable which (if not empty) prefers panic over error
@ -360,7 +360,7 @@ func (s *Schema) ZeroValue() interface{} {
}
}
func (s *Schema) finalizeDiff(d *opentf.ResourceAttrDiff, customized bool) *opentf.ResourceAttrDiff {
func (s *Schema) finalizeDiff(d *tofu.ResourceAttrDiff, customized bool) *tofu.ResourceAttrDiff {
if d == nil {
return d
}
@ -447,8 +447,8 @@ func (m schemaMap) panicOnError() bool {
//
// The diff is optional.
func (m schemaMap) Data(
s *opentf.InstanceState,
d *opentf.InstanceDiff) (*ResourceData, error) {
s *tofu.InstanceState,
d *tofu.InstanceDiff) (*ResourceData, error) {
return &ResourceData{
schema: m,
state: s,
@ -470,13 +470,13 @@ func (m *schemaMap) DeepCopy() schemaMap {
// Diff returns the diff for a resource given the schema map,
// state, and configuration.
func (m schemaMap) Diff(
s *opentf.InstanceState,
c *opentf.ResourceConfig,
s *tofu.InstanceState,
c *tofu.ResourceConfig,
customizeDiff CustomizeDiffFunc,
meta interface{},
handleRequiresNew bool) (*opentf.InstanceDiff, error) {
result := new(opentf.InstanceDiff)
result.Attributes = make(map[string]*opentf.ResourceAttrDiff)
handleRequiresNew bool) (*tofu.InstanceDiff, error) {
result := new(tofu.InstanceDiff)
result.Attributes = make(map[string]*tofu.ResourceAttrDiff)
// Make sure to mark if the resource is tainted
if s != nil {
@ -527,8 +527,8 @@ func (m schemaMap) Diff(
// caused that.
if result.RequiresNew() {
// Create the new diff
result2 := new(opentf.InstanceDiff)
result2.Attributes = make(map[string]*opentf.ResourceAttrDiff)
result2 := new(tofu.InstanceDiff)
result2.Attributes = make(map[string]*tofu.ResourceAttrDiff)
// Preserve the DestroyTainted flag
result2.DestroyTainted = result.DestroyTainted
@ -613,11 +613,11 @@ func (m schemaMap) Diff(
return result, nil
}
// Input implements the opentf.ResourceProvider method by asking
// Input implements the tofu.ResourceProvider method by asking
// for input for required configuration keys that don't have a value.
func (m schemaMap) Input(
input opentf.UIInput,
c *opentf.ResourceConfig) (*opentf.ResourceConfig, error) {
input tofu.UIInput,
c *tofu.ResourceConfig) (*tofu.ResourceConfig, error) {
keys := make([]string, 0, len(m))
for k, _ := range m {
keys = append(keys, k)
@ -676,7 +676,7 @@ func (m schemaMap) Input(
}
// Validate validates the configuration against this schema mapping.
func (m schemaMap) Validate(c *opentf.ResourceConfig) ([]string, []error) {
func (m schemaMap) Validate(c *tofu.ResourceConfig) ([]string, []error) {
return m.validateObject("", m, c)
}
@ -868,12 +868,12 @@ type resourceDiffer interface {
func (m schemaMap) diff(
k string,
schema *Schema,
diff *opentf.InstanceDiff,
diff *tofu.InstanceDiff,
d resourceDiffer,
all bool) error {
unsupressedDiff := new(opentf.InstanceDiff)
unsupressedDiff.Attributes = make(map[string]*opentf.ResourceAttrDiff)
unsupressedDiff := new(tofu.InstanceDiff)
unsupressedDiff.Attributes = make(map[string]*tofu.ResourceAttrDiff)
var err error
switch schema.Type {
@ -901,7 +901,7 @@ func (m schemaMap) diff(
continue
}
attrV = &opentf.ResourceAttrDiff{
attrV = &tofu.ResourceAttrDiff{
Old: attrV.Old,
New: attrV.Old,
}
@ -916,7 +916,7 @@ func (m schemaMap) diff(
func (m schemaMap) diffList(
k string,
schema *Schema,
diff *opentf.InstanceDiff,
diff *tofu.InstanceDiff,
d resourceDiffer,
all bool) error {
o, n, _, computedList, customized := d.diffChange(k)
@ -961,7 +961,7 @@ func (m schemaMap) diffList(
// If the whole list is computed, then say that the # is computed
if computedList {
diff.Attributes[k+".#"] = &opentf.ResourceAttrDiff{
diff.Attributes[k+".#"] = &tofu.ResourceAttrDiff{
Old: oldStr,
NewComputed: true,
RequiresNew: schema.ForceNew,
@ -987,7 +987,7 @@ func (m schemaMap) diffList(
}
diff.Attributes[k+".#"] = countSchema.finalizeDiff(
&opentf.ResourceAttrDiff{
&tofu.ResourceAttrDiff{
Old: oldStr,
New: newStr,
},
@ -1038,7 +1038,7 @@ func (m schemaMap) diffList(
func (m schemaMap) diffMap(
k string,
schema *Schema,
diff *opentf.InstanceDiff,
diff *tofu.InstanceDiff,
d resourceDiffer,
all bool) error {
prefix := k + "."
@ -1093,7 +1093,7 @@ func (m schemaMap) diffMap(
}
diff.Attributes[k+".%"] = countSchema.finalizeDiff(
&opentf.ResourceAttrDiff{
&tofu.ResourceAttrDiff{
Old: oldStr,
New: newStr,
},
@ -1116,7 +1116,7 @@ func (m schemaMap) diffMap(
}
diff.Attributes[prefix+k] = schema.finalizeDiff(
&opentf.ResourceAttrDiff{
&tofu.ResourceAttrDiff{
Old: old,
New: v,
},
@ -1125,7 +1125,7 @@ func (m schemaMap) diffMap(
}
for k, v := range stateMap {
diff.Attributes[prefix+k] = schema.finalizeDiff(
&opentf.ResourceAttrDiff{
&tofu.ResourceAttrDiff{
Old: v,
NewRemoved: true,
},
@ -1139,7 +1139,7 @@ func (m schemaMap) diffMap(
func (m schemaMap) diffSet(
k string,
schema *Schema,
diff *opentf.InstanceDiff,
diff *tofu.InstanceDiff,
d resourceDiffer,
all bool) error {
@ -1203,7 +1203,7 @@ func (m schemaMap) diffSet(
}
diff.Attributes[k+".#"] = countSchema.finalizeDiff(
&opentf.ResourceAttrDiff{
&tofu.ResourceAttrDiff{
Old: countStr,
NewComputed: true,
},
@ -1216,7 +1216,7 @@ func (m schemaMap) diffSet(
changed := oldLen != newLen
if changed || all {
diff.Attributes[k+".#"] = countSchema.finalizeDiff(
&opentf.ResourceAttrDiff{
&tofu.ResourceAttrDiff{
Old: oldStr,
New: newStr,
},
@ -1266,7 +1266,7 @@ func (m schemaMap) diffSet(
func (m schemaMap) diffString(
k string,
schema *Schema,
diff *opentf.InstanceDiff,
diff *tofu.InstanceDiff,
d resourceDiffer,
all bool) error {
var originalN interface{}
@ -1309,7 +1309,7 @@ func (m schemaMap) diffString(
}
diff.Attributes[k] = schema.finalizeDiff(
&opentf.ResourceAttrDiff{
&tofu.ResourceAttrDiff{
Old: os,
New: ns,
NewExtra: originalN,
@ -1323,10 +1323,10 @@ func (m schemaMap) diffString(
}
func (m schemaMap) inputString(
input opentf.UIInput,
input tofu.UIInput,
k string,
schema *Schema) (interface{}, error) {
result, err := input.Input(context.Background(), &opentf.InputOpts{
result, err := input.Input(context.Background(), &tofu.InputOpts{
Id: k,
Query: k,
Description: schema.Description,
@ -1339,7 +1339,7 @@ func (m schemaMap) inputString(
func (m schemaMap) validate(
k string,
schema *Schema,
c *opentf.ResourceConfig) ([]string, []error) {
c *tofu.ResourceConfig) ([]string, []error) {
raw, ok := c.Get(k)
if !ok && schema.DefaultFunc != nil {
// We have a dynamic default. Check if we have a value.
@ -1413,7 +1413,7 @@ func isWhollyKnown(raw interface{}) bool {
func (m schemaMap) validateConflictingAttributes(
k string,
schema *Schema,
c *opentf.ResourceConfig) error {
c *tofu.ResourceConfig) error {
if len(schema.ConflictsWith) == 0 {
return nil
@ -1438,7 +1438,7 @@ func (m schemaMap) validateList(
k string,
raw interface{},
schema *Schema,
c *opentf.ResourceConfig) ([]string, []error) {
c *tofu.ResourceConfig) ([]string, []error) {
// first check if the list is wholly unknown
if s, ok := raw.(string); ok {
if s == hcl2shim.UnknownVariableValue {
@ -1530,7 +1530,7 @@ func (m schemaMap) validateMap(
k string,
raw interface{},
schema *Schema,
c *opentf.ResourceConfig) ([]string, []error) {
c *tofu.ResourceConfig) ([]string, []error) {
// first check if the list is wholly unknown
if s, ok := raw.(string); ok {
if s == hcl2shim.UnknownVariableValue {
@ -1666,7 +1666,7 @@ func getValueType(k string, schema *Schema) (ValueType, error) {
func (m schemaMap) validateObject(
k string,
schema map[string]*Schema,
c *opentf.ResourceConfig) ([]string, []error) {
c *tofu.ResourceConfig) ([]string, []error) {
raw, _ := c.Get(k)
// schemaMap can't validate nil
@ -1717,7 +1717,7 @@ func (m schemaMap) validatePrimitive(
k string,
raw interface{},
schema *Schema,
c *opentf.ResourceConfig) ([]string, []error) {
c *tofu.ResourceConfig) ([]string, []error) {
// a nil value shouldn't happen in the old protocol, and in the new
// protocol the types have already been validated. Either way, we can't
@ -1805,7 +1805,7 @@ func (m schemaMap) validateType(
k string,
raw interface{},
schema *Schema,
c *opentf.ResourceConfig) ([]string, []error) {
c *tofu.ResourceConfig) ([]string, []error) {
var ws []string
var es []error
switch schema.Type {

File diff suppressed because it is too large Load Diff

View File

@ -11,14 +11,14 @@ import (
"github.com/opentofu/opentofu/internal/configs/configschema"
"github.com/opentofu/opentofu/internal/configs/hcl2shim"
"github.com/opentofu/opentofu/internal/legacy/opentf"
"github.com/opentofu/opentofu/internal/legacy/tofu"
)
// DiffFromValues takes the current state and desired state as cty.Values and
// derives a opentf.InstanceDiff to give to the legacy providers. This is
// derives a tofu.InstanceDiff to give to the legacy providers. This is
// used to take the states provided by the new ApplyResourceChange method and
// convert them to a state+diff required for the legacy Apply method.
func DiffFromValues(prior, planned cty.Value, res *Resource) (*opentf.InstanceDiff, error) {
func DiffFromValues(prior, planned cty.Value, res *Resource) (*tofu.InstanceDiff, error) {
return diffFromValues(prior, planned, res, nil)
}
@ -26,7 +26,7 @@ func DiffFromValues(prior, planned cty.Value, res *Resource) (*opentf.InstanceDi
// test fixtures from the legacy tests. In the new provider protocol the diff
// only needs to be created for the apply operation, and any customizations
// have already been done.
func diffFromValues(prior, planned cty.Value, res *Resource, cust CustomizeDiffFunc) (*opentf.InstanceDiff, error) {
func diffFromValues(prior, planned cty.Value, res *Resource, cust CustomizeDiffFunc) (*tofu.InstanceDiff, error) {
instanceState, err := res.ShimInstanceStateFromValue(prior)
if err != nil {
return nil, err
@ -34,7 +34,7 @@ func diffFromValues(prior, planned cty.Value, res *Resource, cust CustomizeDiffF
configSchema := res.CoreConfigSchema()
cfg := opentf.NewResourceConfigShimmed(planned, configSchema)
cfg := tofu.NewResourceConfigShimmed(planned, configSchema)
removeConfigUnknowns(cfg.Config)
removeConfigUnknowns(cfg.Raw)
@ -68,11 +68,11 @@ func removeConfigUnknowns(cfg map[string]interface{}) {
}
}
// ApplyDiff takes a cty.Value state and applies a opentf.InstanceDiff to
// ApplyDiff takes a cty.Value state and applies a tofu.InstanceDiff to
// get a new cty.Value state. This is used to convert the diff returned from
// the legacy provider Diff method to the state required for the new
// PlanResourceChange method.
func ApplyDiff(base cty.Value, d *opentf.InstanceDiff, schema *configschema.Block) (cty.Value, error) {
func ApplyDiff(base cty.Value, d *tofu.InstanceDiff, schema *configschema.Block) (cty.Value, error) {
return d.ApplyToValue(base, schema)
}
@ -110,9 +110,9 @@ func JSONMapToStateValue(m map[string]interface{}, block *configschema.Block) (c
return block.CoerceValue(val)
}
// StateValueFromInstanceState converts a opentf.InstanceState to a
// StateValueFromInstanceState converts a tofu.InstanceState to a
// cty.Value as described by the provided cty.Type, and maintains the resource
// ID as the "id" attribute.
func StateValueFromInstanceState(is *opentf.InstanceState, ty cty.Type) (cty.Value, error) {
func StateValueFromInstanceState(is *tofu.InstanceState, ty cty.Type) (cty.Value, error) {
return is.AttrsAsObjectValue(ty)
}

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@ package schema
import (
"testing"
"github.com/opentofu/opentofu/internal/legacy/opentf"
"github.com/opentofu/opentofu/internal/legacy/tofu"
)
// TestResourceDataRaw creates a ResourceData from a raw configuration map.
@ -14,7 +14,7 @@ func TestResourceDataRaw(
t *testing.T, schema map[string]*Schema, raw map[string]interface{}) *ResourceData {
t.Helper()
c := opentf.NewResourceConfigRaw(raw)
c := tofu.NewResourceConfigRaw(raw)
sm := schemaMap(schema)
diff, err := sm.Diff(nil, c, nil, nil, true)

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import (
"fmt"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import (
"bufio"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import (
"fmt"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import "os"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
//go:generate go run golang.org/x/tools/cmd/stringer -type=InstanceType instancetype.go

View File

@ -1,6 +1,6 @@
// Code generated by "stringer -type=InstanceType instancetype.go"; DO NOT EDIT.
package opentf
package tofu
import "strconv"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import (
"encoding/json"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import (
"sync"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import (
"fmt"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import (
"fmt"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import (
"fmt"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
//go:generate go run golang.org/x/tools/cmd/stringer -type=ResourceMode -output=resource_mode_string.go resource_mode.go

View File

@ -1,6 +1,6 @@
// Code generated by "stringer -type=ResourceMode -output=resource_mode_string.go resource_mode.go"; DO NOT EDIT.
package opentf
package tofu
import "strconv"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
// ResourceProvider is a legacy interface for providers.
//
@ -225,15 +225,15 @@ func ProviderHasDataSource(p ResourceProvider, n string) bool {
}
const errPluginInit = `
Plugin reinitialization required. Please run "opentf init".
Plugin reinitialization required. Please run "tofu init".
Plugins are external binaries that OpenTF uses to access and manipulate
Plugins are external binaries that OpenTofu uses to access and manipulate
resources. The configuration provided requires plugins which can't be located,
don't satisfy the version constraints, or are otherwise incompatible.
OpenTF automatically discovers provider requirements from your
OpenTofu automatically discovers provider requirements from your
configuration, including providers used in child modules. To see the
requirements and constraints, run "opentf providers".
requirements and constraints, run "tofu providers".
%s
`

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import (
"sync"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import (
"github.com/opentofu/opentofu/internal/configs/configschema"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import (
"sync"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import (
"fmt"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import (
"fmt"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import (
"bufio"
@ -1921,10 +1921,10 @@ func testForV0State(buf *bufio.Reader) error {
return fmt.Errorf("Failed to check for magic bytes: %w", err)
}
if string(start) == "tfstate" {
return fmt.Errorf("OpenTF 0.7 no longer supports upgrading the binary state\n" +
"format which was used prior to OpenTF 0.3. Please upgrade\n" +
"this state file using OpenTF 0.6.16 prior to using it with\n" +
"OpenTF 0.7.")
return fmt.Errorf("OpenTofu 0.7 no longer supports upgrading the binary state\n" +
"format which was used prior to OpenTofu 0.3. Please upgrade\n" +
"this state file using OpenTofu 0.6.16 prior to using it with\n" +
"OpenTofu 0.7.")
}
return nil
@ -2010,7 +2010,7 @@ func ReadState(src io.Reader) (*State, error) {
result = v3State
default:
return nil, fmt.Errorf("OpenTF %s does not support state version %d, please update.",
return nil, fmt.Errorf("OpenTofu %s does not support state version %d, please update.",
tfversion.SemVer.String(), versionIdentifier.Version)
}
@ -2054,7 +2054,7 @@ func ReadStateV2(jsonBytes []byte) (*State, error) {
// Check the version, this to ensure we don't read a future
// version that we don't understand
if state.Version > StateVersion {
return nil, fmt.Errorf("OpenTF %s does not support state version %d, please update.",
return nil, fmt.Errorf("OpenTofu %s does not support state version %d, please update.",
tfversion.SemVer.String(), state.Version)
}
@ -2063,9 +2063,9 @@ func ReadStateV2(jsonBytes []byte) (*State, error) {
if _, err := version.NewVersion(state.TFVersion); err != nil {
return nil, fmt.Errorf(
"State contains invalid version: %s\n\n"+
"OpenTF validates the version format prior to writing it. This\n"+
"OpenTofu validates the version format prior to writing it. This\n"+
"means that this is invalid of the state becoming corrupted through\n"+
"some external means. Please manually modify the OpenTF version\n"+
"some external means. Please manually modify the OpenTofu version\n"+
"field to be a proper semantic version.",
state.TFVersion)
}
@ -2089,7 +2089,7 @@ func ReadStateV3(jsonBytes []byte) (*State, error) {
// Check the version, this to ensure we don't read a future
// version that we don't understand
if state.Version > StateVersion {
return nil, fmt.Errorf("OpenTF %s does not support state version %d, please update.",
return nil, fmt.Errorf("OpenTofu %s does not support state version %d, please update.",
tfversion.SemVer.String(), state.Version)
}
@ -2098,9 +2098,9 @@ func ReadStateV3(jsonBytes []byte) (*State, error) {
if _, err := version.NewVersion(state.TFVersion); err != nil {
return nil, fmt.Errorf(
"State contains invalid version: %s\n\n"+
"OpenTF validates the version format prior to writing it. This\n"+
"OpenTofu validates the version format prior to writing it. This\n"+
"means that this is invalid of the state becoming corrupted through\n"+
"some external means. Please manually modify the OpenTF version\n"+
"some external means. Please manually modify the OpenTofu version\n"+
"field to be a proper semantic version.",
state.TFVersion)
}
@ -2152,7 +2152,7 @@ func WriteState(d *State, dst io.Writer) error {
if _, err := version.NewVersion(d.TFVersion); err != nil {
return fmt.Errorf(
"Error writing state, invalid version: %s\n\n"+
"The OpenTF version when writing the state must be a semantic\n"+
"The OpenTofu version when writing the state must be a semantic\n"+
"version.",
d.TFVersion)
}

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import (
"fmt"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import (
"bytes"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import (
"fmt"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import (
"fmt"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
// stateV1 keeps track of a snapshot state-of-the-world that Terraform
// can use to keep track of what real world resources it is actually

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import (
"os"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import "context"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import "context"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import (
"context"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import (
"context"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
// UIOutput is the interface that must be implemented to output
// data to the end user.

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
type CallbackUIOutput struct {
OutputFn func(string)

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import (
"testing"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import "sync"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import (
"testing"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import (
"bytes"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import (
"bytes"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import (
"sort"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import (
"fmt"

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package opentf
package tofu
import (
"github.com/opentofu/opentofu/version"