From 19239936a44ff7c13d6d9aebf77424b430ddddd6 Mon Sep 17 00:00:00 2001 From: RLRabinowitz Date: Sun, 27 Aug 2023 15:56:06 +0300 Subject: [PATCH] Rename internal/legacy/terraform to internal/legacy/opentf --- internal/cloud/migration.go | 2 +- internal/cloud/migration_test.go | 2 +- internal/command/clistate/local_state.go | 18 +- internal/command/command_test.go | 2 +- internal/command/meta.go | 2 +- internal/command/meta_backend.go | 2 +- internal/command/unlock_test.go | 2 +- internal/command/views/hook_count_test.go | 2 +- internal/command/workspace_command_test.go | 2 +- internal/configs/hcl2shim/values.go | 2 +- internal/legacy/helper/schema/backend.go | 8 +- .../helper/schema/field_reader_config.go | 4 +- .../helper/schema/field_reader_config_test.go | 16 +- .../legacy/helper/schema/field_reader_diff.go | 4 +- .../helper/schema/field_reader_diff_test.go | 100 +-- .../helper/schema/field_reader_multi_test.go | 20 +- internal/legacy/helper/schema/provider.go | 94 +-- .../legacy/helper/schema/provider_test.go | 56 +- internal/legacy/helper/schema/provisioner.go | 22 +- .../legacy/helper/schema/provisioner_test.go | 22 +- internal/legacy/helper/schema/resource.go | 56 +- .../legacy/helper/schema/resource_data.go | 16 +- .../helper/schema/resource_data_test.go | 508 +++++++------- .../legacy/helper/schema/resource_diff.go | 10 +- .../helper/schema/resource_diff_test.go | 492 ++++++------- .../legacy/helper/schema/resource_test.go | 146 ++-- .../legacy/helper/schema/resource_timeout.go | 24 +- .../helper/schema/resource_timeout_test.go | 22 +- internal/legacy/helper/schema/schema.go | 80 +-- internal/legacy/helper/schema/schema_test.go | 658 +++++++++--------- internal/legacy/helper/schema/shims.go | 18 +- internal/legacy/helper/schema/shims_test.go | 620 ++++++++--------- internal/legacy/helper/schema/testing.go | 4 +- .../context_components.go | 2 +- internal/legacy/{terraform => opentf}/diff.go | 2 +- .../legacy/{terraform => opentf}/diff_test.go | 2 +- .../legacy/{terraform => opentf}/features.go | 2 +- .../{terraform => opentf}/instancetype.go | 2 +- .../instancetype_string.go | 2 +- .../{terraform => opentf}/provider_mock.go | 2 +- .../{terraform => opentf}/provisioner_mock.go | 2 +- .../legacy/{terraform => opentf}/resource.go | 2 +- .../{terraform => opentf}/resource_address.go | 2 +- .../resource_address_test.go | 2 +- .../{terraform => opentf}/resource_mode.go | 2 +- .../resource_mode_string.go | 2 +- .../resource_provider.go | 2 +- .../resource_provider_mock.go | 2 +- .../resource_provisioner.go | 2 +- .../resource_provisioner_mock.go | 2 +- .../{terraform => opentf}/resource_test.go | 2 +- .../legacy/{terraform => opentf}/schemas.go | 2 +- .../legacy/{terraform => opentf}/state.go | 2 +- .../{terraform => opentf}/state_filter.go | 2 +- .../{terraform => opentf}/state_test.go | 2 +- .../state_upgrade_v1_to_v2.go | 2 +- .../state_upgrade_v2_to_v3.go | 2 +- .../legacy/{terraform => opentf}/state_v1.go | 2 +- .../legacy/{terraform => opentf}/testing.go | 2 +- .../legacy/{terraform => opentf}/ui_input.go | 2 +- .../{terraform => opentf}/ui_input_mock.go | 2 +- .../{terraform => opentf}/ui_input_prefix.go | 2 +- .../ui_input_prefix_test.go | 2 +- .../legacy/{terraform => opentf}/ui_output.go | 2 +- .../ui_output_callback.go | 2 +- .../ui_output_callback_test.go | 2 +- .../{terraform => opentf}/ui_output_mock.go | 2 +- .../ui_output_mock_test.go | 2 +- .../upgrade_state_v1_test.go | 2 +- .../upgrade_state_v2_test.go | 2 +- internal/legacy/{terraform => opentf}/util.go | 2 +- .../legacy/{terraform => opentf}/util_test.go | 2 +- .../legacy/{terraform => opentf}/version.go | 2 +- 73 files changed, 1558 insertions(+), 1558 deletions(-) rename internal/legacy/{terraform => opentf}/context_components.go (99%) rename internal/legacy/{terraform => opentf}/diff.go (99%) rename internal/legacy/{terraform => opentf}/diff_test.go (99%) rename internal/legacy/{terraform => opentf}/features.go (92%) rename internal/legacy/{terraform => opentf}/instancetype.go (95%) rename internal/legacy/{terraform => opentf}/instancetype_string.go (97%) rename internal/legacy/{terraform => opentf}/provider_mock.go (99%) rename internal/legacy/{terraform => opentf}/provisioner_mock.go (99%) rename internal/legacy/{terraform => opentf}/resource.go (99%) rename internal/legacy/{terraform => opentf}/resource_address.go (99%) rename internal/legacy/{terraform => opentf}/resource_address_test.go (99%) rename internal/legacy/{terraform => opentf}/resource_mode.go (95%) rename internal/legacy/{terraform => opentf}/resource_mode_string.go (97%) rename internal/legacy/{terraform => opentf}/resource_provider.go (99%) rename internal/legacy/{terraform => opentf}/resource_provider_mock.go (99%) rename internal/legacy/{terraform => opentf}/resource_provisioner.go (99%) rename internal/legacy/{terraform => opentf}/resource_provisioner_mock.go (99%) rename internal/legacy/{terraform => opentf}/resource_test.go (99%) rename internal/legacy/{terraform => opentf}/schemas.go (99%) rename internal/legacy/{terraform => opentf}/state.go (99%) rename internal/legacy/{terraform => opentf}/state_filter.go (99%) rename internal/legacy/{terraform => opentf}/state_test.go (99%) rename internal/legacy/{terraform => opentf}/state_upgrade_v1_to_v2.go (99%) rename internal/legacy/{terraform => opentf}/state_upgrade_v2_to_v3.go (99%) rename internal/legacy/{terraform => opentf}/state_v1.go (99%) rename internal/legacy/{terraform => opentf}/testing.go (95%) rename internal/legacy/{terraform => opentf}/ui_input.go (98%) rename internal/legacy/{terraform => opentf}/ui_input_mock.go (97%) rename internal/legacy/{terraform => opentf}/ui_input_prefix.go (96%) rename internal/legacy/{terraform => opentf}/ui_input_prefix_test.go (96%) rename internal/legacy/{terraform => opentf}/ui_output.go (91%) rename internal/legacy/{terraform => opentf}/ui_output_callback.go (91%) rename internal/legacy/{terraform => opentf}/ui_output_callback_test.go (91%) rename internal/legacy/{terraform => opentf}/ui_output_mock.go (96%) rename internal/legacy/{terraform => opentf}/ui_output_mock_test.go (90%) rename internal/legacy/{terraform => opentf}/upgrade_state_v1_test.go (99%) rename internal/legacy/{terraform => opentf}/upgrade_state_v2_test.go (99%) rename internal/legacy/{terraform => opentf}/util.go (98%) rename internal/legacy/{terraform => opentf}/util_test.go (98%) rename internal/legacy/{terraform => opentf}/version.go (93%) diff --git a/internal/cloud/migration.go b/internal/cloud/migration.go index 5fcaf3e95a..05183915c6 100644 --- a/internal/cloud/migration.go +++ b/internal/cloud/migration.go @@ -5,7 +5,7 @@ package cloud import ( "github.com/placeholderplaceholderplaceholder/opentf/internal/configs" - legacy "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + legacy "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" ) // Most of the logic for migrating into and out of "cloud mode" actually lives diff --git a/internal/cloud/migration_test.go b/internal/cloud/migration_test.go index 0c5763c449..555016ceea 100644 --- a/internal/cloud/migration_test.go +++ b/internal/cloud/migration_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/placeholderplaceholderplaceholder/opentf/internal/configs" - legacy "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + legacy "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" ) func TestDetectConfigChangeType(t *testing.T) { diff --git a/internal/command/clistate/local_state.go b/internal/command/clistate/local_state.go index 79f32fb70b..2902586231 100644 --- a/internal/command/clistate/local_state.go +++ b/internal/command/clistate/local_state.go @@ -15,7 +15,7 @@ import ( "time" multierror "github.com/hashicorp/go-multierror" - "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" "github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr" ) @@ -42,13 +42,13 @@ type LocalState struct { // hurt to remove file we never wrote to. created bool - state *terraform.State - readState *terraform.State + state *opentf.State + readState *opentf.State written bool } // SetState will force a specific state in-memory for this local state. -func (s *LocalState) SetState(state *terraform.State) { +func (s *LocalState) SetState(state *opentf.State) { s.mu.Lock() defer s.mu.Unlock() @@ -57,7 +57,7 @@ func (s *LocalState) SetState(state *terraform.State) { } // StateReader impl. -func (s *LocalState) State() *terraform.State { +func (s *LocalState) State() *opentf.State { return s.state.DeepCopy() } @@ -67,7 +67,7 @@ func (s *LocalState) State() *terraform.State { // the original. // // StateWriter impl. -func (s *LocalState) WriteState(state *terraform.State) error { +func (s *LocalState) WriteState(state *opentf.State) error { s.mu.Lock() defer s.mu.Unlock() @@ -103,7 +103,7 @@ func (s *LocalState) WriteState(state *terraform.State) error { s.state.Serial++ } - if err := terraform.WriteState(s.state, s.stateFileOut); err != nil { + if err := opentf.WriteState(s.state, s.stateFileOut); err != nil { return err } @@ -164,9 +164,9 @@ func (s *LocalState) RefreshState() error { reader = s.stateFileOut } - state, err := terraform.ReadState(reader) + state, err := opentf.ReadState(reader) // if there's no state we just assign the nil return value - if err != nil && err != terraform.ErrNoState { + if err != nil && err != opentf.ErrNoState { return err } diff --git a/internal/command/command_test.go b/internal/command/command_test.go index 82ef150341..dc63b66f83 100644 --- a/internal/command/command_test.go +++ b/internal/command/command_test.go @@ -40,7 +40,7 @@ import ( "github.com/placeholderplaceholderplaceholder/opentf/internal/depsfile" "github.com/placeholderplaceholderplaceholder/opentf/internal/getproviders" "github.com/placeholderplaceholderplaceholder/opentf/internal/initwd" - legacy "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + legacy "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" _ "github.com/placeholderplaceholderplaceholder/opentf/internal/logging" "github.com/placeholderplaceholderplaceholder/opentf/internal/plans" "github.com/placeholderplaceholderplaceholder/opentf/internal/plans/planfile" diff --git a/internal/command/meta.go b/internal/command/meta.go index 4c1168029c..3a5dfca460 100644 --- a/internal/command/meta.go +++ b/internal/command/meta.go @@ -33,7 +33,7 @@ import ( "github.com/placeholderplaceholderplaceholder/opentf/internal/configs" "github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configload" "github.com/placeholderplaceholderplaceholder/opentf/internal/getproviders" - legacy "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + legacy "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" "github.com/placeholderplaceholderplaceholder/opentf/internal/providers" "github.com/placeholderplaceholderplaceholder/opentf/internal/provisioners" "github.com/placeholderplaceholderplaceholder/opentf/internal/states" diff --git a/internal/command/meta_backend.go b/internal/command/meta_backend.go index 8eb903dc81..2f2a8555c3 100644 --- a/internal/command/meta_backend.go +++ b/internal/command/meta_backend.go @@ -35,7 +35,7 @@ import ( backendInit "github.com/placeholderplaceholderplaceholder/opentf/internal/backend/init" backendLocal "github.com/placeholderplaceholderplaceholder/opentf/internal/backend/local" - legacy "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + legacy "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" ) // BackendOpts are the options used to initialize a backend.Backend. diff --git a/internal/command/unlock_test.go b/internal/command/unlock_test.go index 0b445861e0..2314551119 100644 --- a/internal/command/unlock_test.go +++ b/internal/command/unlock_test.go @@ -10,7 +10,7 @@ import ( "github.com/mitchellh/cli" "github.com/placeholderplaceholderplaceholder/opentf/internal/backend/remote-state/inmem" - legacy "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + legacy "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" ) // Since we can't unlock a local state file, just test that calling unlock diff --git a/internal/command/views/hook_count_test.go b/internal/command/views/hook_count_test.go index bff4601a4e..7cbc093dc2 100644 --- a/internal/command/views/hook_count_test.go +++ b/internal/command/views/hook_count_test.go @@ -14,7 +14,7 @@ import ( "github.com/placeholderplaceholderplaceholder/opentf/internal/states" "github.com/placeholderplaceholderplaceholder/opentf/internal/terraform" - legacy "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + legacy "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" ) func TestCountHook_impl(t *testing.T) { diff --git a/internal/command/workspace_command_test.go b/internal/command/workspace_command_test.go index acfcbfd01b..1779b2fea0 100644 --- a/internal/command/workspace_command_test.go +++ b/internal/command/workspace_command_test.go @@ -18,7 +18,7 @@ import ( "github.com/placeholderplaceholderplaceholder/opentf/internal/states" "github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr" - legacy "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + legacy "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" ) func TestWorkspace_createAndChange(t *testing.T) { diff --git a/internal/configs/hcl2shim/values.go b/internal/configs/hcl2shim/values.go index fe60a5a030..53fa6db931 100644 --- a/internal/configs/hcl2shim/values.go +++ b/internal/configs/hcl2shim/values.go @@ -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 -// terraform.ResourceConfig before calling to a legacy provider, since +// opentf.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{} { diff --git a/internal/legacy/helper/schema/backend.go b/internal/legacy/helper/schema/backend.go index 85601ffb39..61714f985d 100644 --- a/internal/legacy/helper/schema/backend.go +++ b/internal/legacy/helper/schema/backend.go @@ -12,7 +12,7 @@ import ( "github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema" "github.com/placeholderplaceholderplaceholder/opentf/internal/configs/hcl2shim" - "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" 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 *terraform.ResourceConfig object +// an object type) into a minimal old-style *opentf.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) *terraform.ResourceConfig { +func (b *Backend) shimConfig(obj cty.Value) *opentf.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 &terraform.ResourceConfig{ + return &opentf.ResourceConfig{ Config: shimMap, Raw: shimMap, } diff --git a/internal/legacy/helper/schema/field_reader_config.go b/internal/legacy/helper/schema/field_reader_config.go index cd2544851a..11be894c86 100644 --- a/internal/legacy/helper/schema/field_reader_config.go +++ b/internal/legacy/helper/schema/field_reader_config.go @@ -11,7 +11,7 @@ import ( "sync" "github.com/mitchellh/mapstructure" - "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" ) // 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 *terraform.ResourceConfig + Config *opentf.ResourceConfig Schema map[string]*Schema indexMaps map[string]map[string]int diff --git a/internal/legacy/helper/schema/field_reader_config_test.go b/internal/legacy/helper/schema/field_reader_config_test.go index 6820635471..7d84d574cb 100644 --- a/internal/legacy/helper/schema/field_reader_config_test.go +++ b/internal/legacy/helper/schema/field_reader_config_test.go @@ -11,7 +11,7 @@ import ( "github.com/placeholderplaceholderplaceholder/opentf/internal/configs/hcl2shim" "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/helper/hashcode" - "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" ) 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 *terraform.ResourceConfig + Config *opentf.ResourceConfig Err bool }{ "basic": { @@ -146,7 +146,7 @@ func TestConfigFieldReader_DefaultHandling(t *testing.T) { cases := map[string]struct { Addr []string Result FieldReadResult - Config *terraform.ResourceConfig + Config *opentf.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 *terraform.ResourceConfig + Config *opentf.ResourceConfig Err bool }{ { @@ -403,7 +403,7 @@ func TestConfigFieldReader_ComputedSet(t *testing.T) { cases := map[string]struct { Addr []string Result FieldReadResult - Config *terraform.ResourceConfig + Config *opentf.ResourceConfig Err bool }{ "set, normal": { @@ -489,7 +489,7 @@ func TestConfigFieldReader_computedComplexSet(t *testing.T) { cases := map[string]struct { Addr []string Result FieldReadResult - Config *terraform.ResourceConfig + Config *opentf.ResourceConfig Err bool }{ "set, normal": { @@ -538,6 +538,6 @@ func TestConfigFieldReader_computedComplexSet(t *testing.T) { } } -func testConfig(t *testing.T, raw map[string]interface{}) *terraform.ResourceConfig { - return terraform.NewResourceConfigRaw(raw) +func testConfig(t *testing.T, raw map[string]interface{}) *opentf.ResourceConfig { + return opentf.NewResourceConfigRaw(raw) } diff --git a/internal/legacy/helper/schema/field_reader_diff.go b/internal/legacy/helper/schema/field_reader_diff.go index 886a88dbea..9e759c3527 100644 --- a/internal/legacy/helper/schema/field_reader_diff.go +++ b/internal/legacy/helper/schema/field_reader_diff.go @@ -8,7 +8,7 @@ import ( "strings" "github.com/mitchellh/mapstructure" - "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" ) // 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 *terraform.InstanceDiff + Diff *opentf.InstanceDiff Source FieldReader Schema map[string]*Schema diff --git a/internal/legacy/helper/schema/field_reader_diff_test.go b/internal/legacy/helper/schema/field_reader_diff_test.go index 14e6c02b0f..a1f6c3d6b1 100644 --- a/internal/legacy/helper/schema/field_reader_diff_test.go +++ b/internal/legacy/helper/schema/field_reader_diff_test.go @@ -7,7 +7,7 @@ import ( "reflect" "testing" - "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" ) func TestDiffFieldReader_impl(t *testing.T) { @@ -61,14 +61,14 @@ func TestDiffFieldReader_NestedSetUpdate(t *testing.T) { r := &DiffFieldReader{ Schema: schema, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "list_of_sets_1.0.nested_set.1.val": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "list_of_sets_1.0.nested_set.1.val": &opentf.ResourceAttrDiff{ Old: "1", New: "0", NewRemoved: true, }, - "list_of_sets_1.0.nested_set.2.val": &terraform.ResourceAttrDiff{ + "list_of_sets_1.0.nested_set.2.val": &opentf.ResourceAttrDiff{ New: "2", }, }, @@ -121,13 +121,13 @@ func TestDiffFieldReader_MapHandling(t *testing.T) { } r := &DiffFieldReader{ Schema: schema, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "tags.%": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "tags.%": &opentf.ResourceAttrDiff{ Old: "1", New: "2", }, - "tags.baz": &terraform.ResourceAttrDiff{ + "tags.baz": &opentf.ResourceAttrDiff{ Old: "", New: "qux", }, @@ -217,28 +217,28 @@ func TestDiffFieldReader_extra(t *testing.T) { r := &DiffFieldReader{ Schema: schema, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "stringComputed": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "stringComputed": &opentf.ResourceAttrDiff{ Old: "foo", New: "bar", NewComputed: true, }, - "listMap.0.bar": &terraform.ResourceAttrDiff{ + "listMap.0.bar": &opentf.ResourceAttrDiff{ NewRemoved: true, }, - "mapRemove.bar": &terraform.ResourceAttrDiff{ + "mapRemove.bar": &opentf.ResourceAttrDiff{ NewRemoved: true, }, - "setChange.10.value": &terraform.ResourceAttrDiff{ + "setChange.10.value": &opentf.ResourceAttrDiff{ Old: "50", New: "80", }, - "setEmpty.#": &terraform.ResourceAttrDiff{ + "setEmpty.#": &opentf.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: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "bool": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "bool": &opentf.ResourceAttrDiff{ Old: "", New: "true", }, - "int": &terraform.ResourceAttrDiff{ + "int": &opentf.ResourceAttrDiff{ Old: "", New: "42", }, - "float": &terraform.ResourceAttrDiff{ + "float": &opentf.ResourceAttrDiff{ Old: "", New: "3.1415", }, - "string": &terraform.ResourceAttrDiff{ + "string": &opentf.ResourceAttrDiff{ Old: "", New: "string", }, - "stringComputed": &terraform.ResourceAttrDiff{ + "stringComputed": &opentf.ResourceAttrDiff{ Old: "foo", New: "bar", NewComputed: true, }, - "list.#": &terraform.ResourceAttrDiff{ + "list.#": &opentf.ResourceAttrDiff{ Old: "0", New: "2", }, - "list.0": &terraform.ResourceAttrDiff{ + "list.0": &opentf.ResourceAttrDiff{ Old: "", New: "foo", }, - "list.1": &terraform.ResourceAttrDiff{ + "list.1": &opentf.ResourceAttrDiff{ Old: "", New: "bar", }, - "listInt.#": &terraform.ResourceAttrDiff{ + "listInt.#": &opentf.ResourceAttrDiff{ Old: "0", New: "2", }, - "listInt.0": &terraform.ResourceAttrDiff{ + "listInt.0": &opentf.ResourceAttrDiff{ Old: "", New: "21", }, - "listInt.1": &terraform.ResourceAttrDiff{ + "listInt.1": &opentf.ResourceAttrDiff{ Old: "", New: "42", }, - "map.foo": &terraform.ResourceAttrDiff{ + "map.foo": &opentf.ResourceAttrDiff{ Old: "", New: "bar", }, - "map.bar": &terraform.ResourceAttrDiff{ + "map.bar": &opentf.ResourceAttrDiff{ Old: "", New: "baz", }, - "mapInt.%": &terraform.ResourceAttrDiff{ + "mapInt.%": &opentf.ResourceAttrDiff{ Old: "", New: "2", }, - "mapInt.one": &terraform.ResourceAttrDiff{ + "mapInt.one": &opentf.ResourceAttrDiff{ Old: "", New: "1", }, - "mapInt.two": &terraform.ResourceAttrDiff{ + "mapInt.two": &opentf.ResourceAttrDiff{ Old: "", New: "2", }, - "mapIntNestedSchema.%": &terraform.ResourceAttrDiff{ + "mapIntNestedSchema.%": &opentf.ResourceAttrDiff{ Old: "", New: "2", }, - "mapIntNestedSchema.one": &terraform.ResourceAttrDiff{ + "mapIntNestedSchema.one": &opentf.ResourceAttrDiff{ Old: "", New: "1", }, - "mapIntNestedSchema.two": &terraform.ResourceAttrDiff{ + "mapIntNestedSchema.two": &opentf.ResourceAttrDiff{ Old: "", New: "2", }, - "mapFloat.%": &terraform.ResourceAttrDiff{ + "mapFloat.%": &opentf.ResourceAttrDiff{ Old: "", New: "1", }, - "mapFloat.oneDotTwo": &terraform.ResourceAttrDiff{ + "mapFloat.oneDotTwo": &opentf.ResourceAttrDiff{ Old: "", New: "1.2", }, - "mapBool.%": &terraform.ResourceAttrDiff{ + "mapBool.%": &opentf.ResourceAttrDiff{ Old: "", New: "2", }, - "mapBool.True": &terraform.ResourceAttrDiff{ + "mapBool.True": &opentf.ResourceAttrDiff{ Old: "", New: "true", }, - "mapBool.False": &terraform.ResourceAttrDiff{ + "mapBool.False": &opentf.ResourceAttrDiff{ Old: "", New: "false", }, - "set.#": &terraform.ResourceAttrDiff{ + "set.#": &opentf.ResourceAttrDiff{ Old: "0", New: "2", }, - "set.10": &terraform.ResourceAttrDiff{ + "set.10": &opentf.ResourceAttrDiff{ Old: "", New: "10", }, - "set.50": &terraform.ResourceAttrDiff{ + "set.50": &opentf.ResourceAttrDiff{ Old: "", New: "50", }, - "setDeep.#": &terraform.ResourceAttrDiff{ + "setDeep.#": &opentf.ResourceAttrDiff{ Old: "0", New: "2", }, - "setDeep.10.index": &terraform.ResourceAttrDiff{ + "setDeep.10.index": &opentf.ResourceAttrDiff{ Old: "", New: "10", }, - "setDeep.10.value": &terraform.ResourceAttrDiff{ + "setDeep.10.value": &opentf.ResourceAttrDiff{ Old: "", New: "foo", }, - "setDeep.50.index": &terraform.ResourceAttrDiff{ + "setDeep.50.index": &opentf.ResourceAttrDiff{ Old: "", New: "50", }, - "setDeep.50.value": &terraform.ResourceAttrDiff{ + "setDeep.50.value": &opentf.ResourceAttrDiff{ Old: "", New: "bar", }, diff --git a/internal/legacy/helper/schema/field_reader_multi_test.go b/internal/legacy/helper/schema/field_reader_multi_test.go index db631e6921..fca48e4f6e 100644 --- a/internal/legacy/helper/schema/field_reader_multi_test.go +++ b/internal/legacy/helper/schema/field_reader_multi_test.go @@ -8,7 +8,7 @@ import ( "strconv" "testing" - "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" ) func TestMultiLevelFieldReaderReadFieldExact(t *testing.T) { @@ -103,9 +103,9 @@ func TestMultiLevelFieldReaderReadFieldMerge(t *testing.T) { }), }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "foo", New: "bar", RequiresNew: true, @@ -150,9 +150,9 @@ func TestMultiLevelFieldReaderReadFieldMerge(t *testing.T) { }), }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "foo", New: "bar", NewComputed: true, @@ -197,9 +197,9 @@ func TestMultiLevelFieldReaderReadFieldMerge(t *testing.T) { }), }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "config_vars.0.bar": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "config_vars.0.bar": &opentf.ResourceAttrDiff{ NewRemoved: true, }, }, diff --git a/internal/legacy/helper/schema/provider.go b/internal/legacy/helper/schema/provider.go index 08c2be0963..8af4b4d6ef 100644 --- a/internal/legacy/helper/schema/provider.go +++ b/internal/legacy/helper/schema/provider.go @@ -12,7 +12,7 @@ import ( multierror "github.com/hashicorp/go-multierror" "github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema" - "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" ) var ReservedProviderFields = []string{ @@ -180,7 +180,7 @@ func (p *Provider) stopInit() { p.stopCtx, p.stopCtxCancel = context.WithCancel(context.Background()) } -// Stop implementation of terraform.ResourceProvider interface. +// Stop implementation of opentf.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 terraform.ResourceProvider interface -func (p *Provider) GetSchema(req *terraform.ProviderSchemaRequest) (*terraform.ProviderSchema, error) { +// GetSchema implementation of opentf.ResourceProvider interface +func (p *Provider) GetSchema(req *opentf.ProviderSchemaRequest) (*opentf.ProviderSchema, error) { resourceTypes := map[string]*configschema.Block{} dataSources := map[string]*configschema.Block{} @@ -219,22 +219,22 @@ func (p *Provider) GetSchema(req *terraform.ProviderSchemaRequest) (*terraform.P } } - return &terraform.ProviderSchema{ + return &opentf.ProviderSchema{ Provider: schemaMap(p.Schema).CoreConfigSchema(), ResourceTypes: resourceTypes, DataSources: dataSources, }, nil } -// Input implementation of terraform.ResourceProvider interface. +// Input implementation of opentf.ResourceProvider interface. func (p *Provider) Input( - input terraform.UIInput, - c *terraform.ResourceConfig) (*terraform.ResourceConfig, error) { + input opentf.UIInput, + c *opentf.ResourceConfig) (*opentf.ResourceConfig, error) { return schemaMap(p.Schema).Input(input, c) } -// Validate implementation of terraform.ResourceProvider interface. -func (p *Provider) Validate(c *terraform.ResourceConfig) ([]string, []error) { +// Validate implementation of opentf.ResourceProvider interface. +func (p *Provider) Validate(c *opentf.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 *terraform.ResourceConfig) ([]string, []error) { return schemaMap(p.Schema).Validate(c) } -// ValidateResource implementation of terraform.ResourceProvider interface. +// ValidateResource implementation of opentf.ResourceProvider interface. func (p *Provider) ValidateResource( - t string, c *terraform.ResourceConfig) ([]string, []error) { + t string, c *opentf.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 terraform.ResourceProvider interface. -func (p *Provider) Configure(c *terraform.ResourceConfig) error { +// Configure implementation of opentf.ResourceProvider interface. +func (p *Provider) Configure(c *opentf.ResourceConfig) error { // No configuration if p.ConfigureFunc == nil { return nil @@ -287,11 +287,11 @@ func (p *Provider) Configure(c *terraform.ResourceConfig) error { return nil } -// Apply implementation of terraform.ResourceProvider interface. +// Apply implementation of opentf.ResourceProvider interface. func (p *Provider) Apply( - info *terraform.InstanceInfo, - s *terraform.InstanceState, - d *terraform.InstanceDiff) (*terraform.InstanceState, error) { + info *opentf.InstanceInfo, + s *opentf.InstanceState, + d *opentf.InstanceDiff) (*opentf.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 terraform.ResourceProvider interface. +// Diff implementation of opentf.ResourceProvider interface. func (p *Provider) Diff( - info *terraform.InstanceInfo, - s *terraform.InstanceState, - c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) { + info *opentf.InstanceInfo, + s *opentf.InstanceState, + c *opentf.ResourceConfig) (*opentf.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 *terraform.InstanceInfo, - s *terraform.InstanceState, - c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) { + info *opentf.InstanceInfo, + s *opentf.InstanceState, + c *opentf.ResourceConfig) (*opentf.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 terraform.ResourceProvider interface. +// Refresh implementation of opentf.ResourceProvider interface. func (p *Provider) Refresh( - info *terraform.InstanceInfo, - s *terraform.InstanceState) (*terraform.InstanceState, error) { + info *opentf.InstanceInfo, + s *opentf.InstanceState) (*opentf.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 terraform.ResourceProvider interface. -func (p *Provider) Resources() []terraform.ResourceType { +// Resources implementation of opentf.ResourceProvider interface. +func (p *Provider) Resources() []opentf.ResourceType { keys := make([]string, 0, len(p.ResourcesMap)) for k := range p.ResourcesMap { keys = append(keys, k) } sort.Strings(keys) - result := make([]terraform.ResourceType, 0, len(keys)) + result := make([]opentf.ResourceType, 0, len(keys)) for _, k := range keys { resource := p.ResourcesMap[k] @@ -357,7 +357,7 @@ func (p *Provider) Resources() []terraform.ResourceType { resource = &Resource{} } - result = append(result, terraform.ResourceType{ + result = append(result, opentf.ResourceType{ Name: k, Importable: resource.Importer != nil, @@ -371,8 +371,8 @@ func (p *Provider) Resources() []terraform.ResourceType { } func (p *Provider) ImportState( - info *terraform.InstanceInfo, - id string) ([]*terraform.InstanceState, error) { + info *opentf.InstanceInfo, + id string) ([]*opentf.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([]*terraform.InstanceState, len(results)) + states := make([]*opentf.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 terraform.ResourceProvider interface. +// ValidateDataSource implementation of opentf.ResourceProvider interface. func (p *Provider) ValidateDataSource( - t string, c *terraform.ResourceConfig) ([]string, []error) { + t string, c *opentf.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 terraform.ResourceProvider interface. +// ReadDataDiff implementation of opentf.ResourceProvider interface. func (p *Provider) ReadDataDiff( - info *terraform.InstanceInfo, - c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) { + info *opentf.InstanceInfo, + c *opentf.ResourceConfig) (*opentf.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 terraform.ResourceProvider interface. +// RefreshData implementation of opentf.ResourceProvider interface. func (p *Provider) ReadDataApply( - info *terraform.InstanceInfo, - d *terraform.InstanceDiff) (*terraform.InstanceState, error) { + info *opentf.InstanceInfo, + d *opentf.InstanceDiff) (*opentf.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 terraform.ResourceProvider interface. -func (p *Provider) DataSources() []terraform.DataSource { +// DataSources implementation of opentf.ResourceProvider interface. +func (p *Provider) DataSources() []opentf.DataSource { keys := make([]string, 0, len(p.DataSourcesMap)) for k, _ := range p.DataSourcesMap { keys = append(keys, k) } sort.Strings(keys) - result := make([]terraform.DataSource, 0, len(keys)) + result := make([]opentf.DataSource, 0, len(keys)) for _, k := range keys { - result = append(result, terraform.DataSource{ + result = append(result, opentf.DataSource{ Name: k, // Indicates that a provider is compiled against a new enough diff --git a/internal/legacy/helper/schema/provider_test.go b/internal/legacy/helper/schema/provider_test.go index f0611b2d76..7a2aa899cb 100644 --- a/internal/legacy/helper/schema/provider_test.go +++ b/internal/legacy/helper/schema/provider_test.go @@ -14,11 +14,11 @@ import ( "github.com/zclconf/go-cty/cty" "github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema" - "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" ) func TestProvider_impl(t *testing.T) { - var _ terraform.ResourceProvider = new(Provider) + var _ opentf.ResourceProvider = new(Provider) } func TestProviderGetSchema(t *testing.T) { @@ -53,7 +53,7 @@ func TestProviderGetSchema(t *testing.T) { }, } - want := &terraform.ProviderSchema{ + want := &opentf.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(&terraform.ProviderSchemaRequest{ + got, err := p.GetSchema(&opentf.ProviderSchemaRequest{ ResourceTypes: []string{"foo", "bar"}, DataSources: []string{"baz", "bar"}, }) @@ -159,7 +159,7 @@ func TestProviderConfigure(t *testing.T) { } for i, tc := range cases { - c := terraform.NewResourceConfigRaw(tc.Config) + c := opentf.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 []terraform.ResourceType + Result []opentf.ResourceType }{ { P: &Provider{}, - Result: []terraform.ResourceType{}, + Result: []opentf.ResourceType{}, }, { @@ -184,9 +184,9 @@ func TestProviderResources(t *testing.T) { "bar": nil, }, }, - Result: []terraform.ResourceType{ - terraform.ResourceType{Name: "bar", SchemaAvailable: true}, - terraform.ResourceType{Name: "foo", SchemaAvailable: true}, + Result: []opentf.ResourceType{ + opentf.ResourceType{Name: "bar", SchemaAvailable: true}, + opentf.ResourceType{Name: "foo", SchemaAvailable: true}, }, }, @@ -198,10 +198,10 @@ func TestProviderResources(t *testing.T) { "baz": nil, }, }, - Result: []terraform.ResourceType{ - terraform.ResourceType{Name: "bar", Importable: true, SchemaAvailable: true}, - terraform.ResourceType{Name: "baz", SchemaAvailable: true}, - terraform.ResourceType{Name: "foo", SchemaAvailable: true}, + Result: []opentf.ResourceType{ + opentf.ResourceType{Name: "bar", Importable: true, SchemaAvailable: true}, + opentf.ResourceType{Name: "baz", SchemaAvailable: true}, + opentf.ResourceType{Name: "foo", SchemaAvailable: true}, }, }, } @@ -217,11 +217,11 @@ func TestProviderResources(t *testing.T) { func TestProviderDataSources(t *testing.T) { cases := []struct { P *Provider - Result []terraform.DataSource + Result []opentf.DataSource }{ { P: &Provider{}, - Result: []terraform.DataSource{}, + Result: []opentf.DataSource{}, }, { @@ -231,9 +231,9 @@ func TestProviderDataSources(t *testing.T) { "bar": nil, }, }, - Result: []terraform.DataSource{ - terraform.DataSource{Name: "bar", SchemaAvailable: true}, - terraform.DataSource{Name: "foo", SchemaAvailable: true}, + Result: []opentf.DataSource{ + opentf.DataSource{Name: "bar", SchemaAvailable: true}, + opentf.DataSource{Name: "foo", SchemaAvailable: true}, }, }, } @@ -264,7 +264,7 @@ func TestProviderValidate(t *testing.T) { } for i, tc := range cases { - c := terraform.NewResourceConfigRaw(tc.Config) + c := opentf.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 := terraform.NewResourceConfigRaw(invalidCfg) + ic := opentf.NewResourceConfigRaw(invalidCfg) _, err := p.Diff( - &terraform.InstanceInfo{ + &opentf.InstanceInfo{ Type: "blah", }, nil, @@ -333,9 +333,9 @@ func TestProviderDiff_timeoutInvalidValue(t *testing.T) { "create": "invalid", }, } - ic := terraform.NewResourceConfigRaw(invalidCfg) + ic := opentf.NewResourceConfigRaw(invalidCfg) _, err := p.Diff( - &terraform.InstanceInfo{ + &opentf.InstanceInfo{ Type: "blah", }, nil, @@ -379,7 +379,7 @@ func TestProviderValidateResource(t *testing.T) { } for i, tc := range cases { - c := terraform.NewResourceConfigRaw(tc.Config) + c := opentf.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(&terraform.InstanceInfo{ + states, err := p.ImportState(&opentf.InstanceInfo{ Type: "foo", }, "bar") if err != nil { @@ -428,7 +428,7 @@ func TestProviderImportState_setsId(t *testing.T) { }, } - _, err := p.ImportState(&terraform.InstanceInfo{ + _, err := p.ImportState(&opentf.InstanceInfo{ Type: "foo", }, "bar") if err != nil { @@ -458,7 +458,7 @@ func TestProviderImportState_setsType(t *testing.T) { }, } - _, err := p.ImportState(&terraform.InstanceInfo{ + _, err := p.ImportState(&opentf.InstanceInfo{ Type: "foo", }, "bar") if err != nil { diff --git a/internal/legacy/helper/schema/provisioner.go b/internal/legacy/helper/schema/provisioner.go index 77eeb080ff..27b11a67b8 100644 --- a/internal/legacy/helper/schema/provisioner.go +++ b/internal/legacy/helper/schema/provisioner.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/go-multierror" "github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema" - "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" ) // 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(*terraform.ResourceConfig) ([]string, []error) + ValidateFunc func(*opentf.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 terraform.ResourceProvisioner interface. +// Stop implementation of opentf.ResourceProvisioner interface. func (p *Provisioner) Stop() error { p.stopOnce.Do(p.stopInit) p.stopCtxCancel() return nil } -// GetConfigSchema implementation of terraform.ResourceProvisioner interface. +// GetConfigSchema implementation of opentf.ResourceProvisioner interface. func (p *Provisioner) GetConfigSchema() (*configschema.Block, error) { return schemaMap(p.Schema).CoreConfigSchema(), nil } -// Apply implementation of terraform.ResourceProvisioner interface. +// Apply implementation of opentf.ResourceProvisioner interface. func (p *Provisioner) Apply( - o terraform.UIOutput, - s *terraform.InstanceState, - c *terraform.ResourceConfig) error { + o opentf.UIOutput, + s *opentf.InstanceState, + c *opentf.ResourceConfig) error { var connData, configData *ResourceData { @@ -148,7 +148,7 @@ func (p *Provisioner) Apply( } } - c := terraform.NewResourceConfigRaw(raw) + c := opentf.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 terraform.ResourceProvisioner interface. -func (p *Provisioner) Validate(c *terraform.ResourceConfig) (ws []string, es []error) { +// Validate implements the opentf.ResourceProvisioner interface. +func (p *Provisioner) Validate(c *opentf.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"+ diff --git a/internal/legacy/helper/schema/provisioner_test.go b/internal/legacy/helper/schema/provisioner_test.go index 8d4863b804..817d8ea654 100644 --- a/internal/legacy/helper/schema/provisioner_test.go +++ b/internal/legacy/helper/schema/provisioner_test.go @@ -10,11 +10,11 @@ import ( "testing" "time" - "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" ) func TestProvisioner_impl(t *testing.T) { - var _ terraform.ResourceProvisioner = new(Provisioner) + var _ opentf.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(*terraform.ResourceConfig) (ws []string, errors []error) { + ValidateFunc: func(*opentf.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 := terraform.NewResourceConfigRaw(tc.Config) + c := opentf.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 := terraform.NewResourceConfigRaw(tc.Config) + c := opentf.NewResourceConfigRaw(tc.Config) - state := &terraform.InstanceState{ - Ephemeral: terraform.EphemeralState{ + state := &opentf.InstanceState{ + Ephemeral: opentf.EphemeralState{ ConnInfo: tc.Conn, }, } @@ -230,7 +230,7 @@ func TestProvisionerApply_nilState(t *testing.T) { "foo": 42, } - c := terraform.NewResourceConfigRaw(conf) + c := opentf.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 := terraform.NewResourceConfigRaw(conf) - state := &terraform.InstanceState{ - Ephemeral: terraform.EphemeralState{ + c := opentf.NewResourceConfigRaw(conf) + state := &opentf.InstanceState{ + Ephemeral: opentf.EphemeralState{ ConnInfo: conn, }, } diff --git a/internal/legacy/helper/schema/resource.go b/internal/legacy/helper/schema/resource.go index c0af7aa253..ae80d7156f 100644 --- a/internal/legacy/helper/schema/resource.go +++ b/internal/legacy/helper/schema/resource.go @@ -9,7 +9,7 @@ import ( "log" "strconv" - "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" "github.com/zclconf/go-cty/cty" ) @@ -178,11 +178,11 @@ type Resource struct { } // ShimInstanceStateFromValue converts a cty.Value to a -// terraform.InstanceState. -func (r *Resource) ShimInstanceStateFromValue(state cty.Value) (*terraform.InstanceState, error) { +// opentf.InstanceState. +func (r *Resource) ShimInstanceStateFromValue(state cty.Value) (*opentf.InstanceState, error) { // Get the raw shimmed value. While this is correct, the set hashes don't // match those from the Schema. - s := terraform.NewInstanceStateShimmedFromValue(state, r.SchemaVersion) + s := opentf.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) (*terraform.Insta s = data.State() if s == nil { - s = &terraform.InstanceState{} + s = &opentf.InstanceState{} } return s, nil } @@ -215,7 +215,7 @@ type ExistsFunc func(*ResourceData, interface{}) (bool, error) // See Resource documentation. type StateMigrateFunc func( - int, *terraform.InstanceState, interface{}) (*terraform.InstanceState, error) + int, *opentf.InstanceState, interface{}) (*opentf.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 *terraform.InstanceState, - d *terraform.InstanceDiff, - meta interface{}) (*terraform.InstanceState, error) { + s *opentf.InstanceState, + d *opentf.InstanceDiff, + meta interface{}) (*opentf.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(terraform.InstanceState) + s = new(opentf.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 *terraform.InstanceState, - c *terraform.ResourceConfig, - meta interface{}) (*terraform.InstanceDiff, error) { + s *opentf.InstanceState, + c *opentf.ResourceConfig, + meta interface{}) (*opentf.InstanceDiff, error) { t := &ResourceTimeout{} err := t.ConfigDecode(r, c) @@ -350,9 +350,9 @@ func (r *Resource) Diff( } func (r *Resource) simpleDiff( - s *terraform.InstanceState, - c *terraform.ResourceConfig, - meta interface{}) (*terraform.InstanceDiff, error) { + s *opentf.InstanceState, + c *opentf.ResourceConfig, + meta interface{}) (*opentf.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 = terraform.NewInstanceDiff() + instanceDiff = opentf.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 *terraform.ResourceConfig) ([]string, []error) { +func (r *Resource) Validate(c *opentf.ResourceConfig) ([]string, []error) { warns, errs := schemaMap(r.Schema).Validate(c) if r.DeprecationMessage != "" { @@ -391,9 +391,9 @@ func (r *Resource) Validate(c *terraform.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 *terraform.InstanceDiff, + d *opentf.InstanceDiff, meta interface{}, -) (*terraform.InstanceState, error) { +) (*opentf.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 *terraform.InstanceState, - meta interface{}) (*terraform.InstanceState, error) { + s *opentf.InstanceState, + meta interface{}) (*opentf.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 *terraform.InstanceState, - meta interface{}) (*terraform.InstanceState, error) { + s *opentf.InstanceState, + meta interface{}) (*opentf.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 *terraform.InstanceState, meta interface{}) (*terraform.InstanceState, error) { +func (r *Resource) upgradeState(s *opentf.InstanceState, meta interface{}) (*opentf.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 *terraform.InstanceState) *ResourceData { +func (r *Resource) Data(s *opentf.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 *terraform.InstanceState) (bool, int) { +func (r *Resource) checkSchemaVersion(is *opentf.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 *terraform.InstanceState) (bool, int) { } func (r *Resource) recordCurrentSchemaVersion( - state *terraform.InstanceState) *terraform.InstanceState { + state *opentf.InstanceState) *opentf.InstanceState { if state != nil && r.SchemaVersion > 0 { if state.Meta == nil { state.Meta = make(map[string]interface{}) diff --git a/internal/legacy/helper/schema/resource_data.go b/internal/legacy/helper/schema/resource_data.go index 2630fd2d29..5fb1777c4d 100644 --- a/internal/legacy/helper/schema/resource_data.go +++ b/internal/legacy/helper/schema/resource_data.go @@ -10,7 +10,7 @@ import ( "sync" "time" - "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" "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 *terraform.ResourceConfig - state *terraform.InstanceState - diff *terraform.InstanceDiff + config *opentf.ResourceConfig + state *opentf.InstanceState + diff *opentf.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 *terraform.InstanceState + newState *opentf.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() *terraform.InstanceState { - var result terraform.InstanceState +func (d *ResourceData) State() *opentf.InstanceState { + var result opentf.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 terraform.InstanceState + var copyState opentf.InstanceState if d.state != nil { copyState = *d.state.DeepCopy() } diff --git a/internal/legacy/helper/schema/resource_data_test.go b/internal/legacy/helper/schema/resource_data_test.go index 1412db0410..9054b48100 100644 --- a/internal/legacy/helper/schema/resource_data_test.go +++ b/internal/legacy/helper/schema/resource_data_test.go @@ -11,14 +11,14 @@ import ( "testing" "time" - "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" ) func TestResourceDataGet(t *testing.T) { cases := []struct { Schema map[string]*Schema - State *terraform.InstanceState - Diff *terraform.InstanceDiff + State *opentf.InstanceState + Diff *opentf.InstanceDiff Key string Value interface{} }{ @@ -35,9 +35,9 @@ func TestResourceDataGet(t *testing.T) { State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "foo", New: "bar", NewComputed: true, @@ -62,9 +62,9 @@ func TestResourceDataGet(t *testing.T) { State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "foo", RequiresNew: true, @@ -90,9 +90,9 @@ func TestResourceDataGet(t *testing.T) { State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "foo!", NewExtra: "foo", @@ -115,7 +115,7 @@ func TestResourceDataGet(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "availability_zone": "bar", }, @@ -139,15 +139,15 @@ func TestResourceDataGet(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "availability_zone": "foo", }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "foo", New: "bar", NewComputed: true, @@ -170,7 +170,7 @@ func TestResourceDataGet(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "port": "80", }, @@ -193,7 +193,7 @@ func TestResourceDataGet(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "3", "ports.0": "1", @@ -217,7 +217,7 @@ func TestResourceDataGet(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "3", "ports.0": "1", @@ -258,7 +258,7 @@ func TestResourceDataGet(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "3", "ports.0": "1", @@ -291,13 +291,13 @@ func TestResourceDataGet(t *testing.T) { State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ingress.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ingress.#": &opentf.ResourceAttrDiff{ Old: "", New: "1", }, - "ingress.0.from": &terraform.ResourceAttrDiff{ + "ingress.0.from": &opentf.ResourceAttrDiff{ Old: "", New: "8080", }, @@ -330,13 +330,13 @@ func TestResourceDataGet(t *testing.T) { State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ingress.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ingress.#": &opentf.ResourceAttrDiff{ Old: "", New: "1", }, - "ingress.0.from": &terraform.ResourceAttrDiff{ + "ingress.0.from": &opentf.ResourceAttrDiff{ Old: "", New: "8080", }, @@ -361,7 +361,7 @@ func TestResourceDataGet(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "availability_zone": "foo", }, @@ -385,9 +385,9 @@ func TestResourceDataGet(t *testing.T) { State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "foo", RequiresNew: true, @@ -417,17 +417,17 @@ func TestResourceDataGet(t *testing.T) { State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "config_vars.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "config_vars.#": &opentf.ResourceAttrDiff{ Old: "0", New: "2", }, - "config_vars.0.foo": &terraform.ResourceAttrDiff{ + "config_vars.0.foo": &opentf.ResourceAttrDiff{ Old: "", New: "bar", }, - "config_vars.1.bar": &terraform.ResourceAttrDiff{ + "config_vars.1.bar": &opentf.ResourceAttrDiff{ Old: "", New: "baz", }, @@ -459,7 +459,7 @@ func TestResourceDataGet(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "config_vars.#": "2", "config_vars.0.foo": "baz", @@ -494,20 +494,20 @@ func TestResourceDataGet(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "config_vars.#": "1", "config_vars.0.FOO": "bar", }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "config_vars.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "config_vars.#": &opentf.ResourceAttrDiff{ Old: "1", New: "0", }, - "config_vars.0.FOO": &terraform.ResourceAttrDiff{ + "config_vars.0.FOO": &opentf.ResourceAttrDiff{ Old: "bar", NewRemoved: true, }, @@ -533,7 +533,7 @@ func TestResourceDataGet(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "1", "ports.80": "80", @@ -573,7 +573,7 @@ func TestResourceDataGet(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "data.#": "1", "data.10.index": "10", @@ -581,9 +581,9 @@ func TestResourceDataGet(t *testing.T) { }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "data.10.value": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "data.10.value": &opentf.ResourceAttrDiff{ Old: "50", New: "80", }, @@ -652,7 +652,7 @@ func TestResourceDataGet(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "ratio": "0.5", }, @@ -675,15 +675,15 @@ func TestResourceDataGet(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "ratio": "-0.5", }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ratio": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ratio": &opentf.ResourceAttrDiff{ Old: "-0.5", New: "33.0", }, @@ -709,24 +709,24 @@ func TestResourceDataGet(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "1", "ports.80": "80", }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "2", New: "1", }, - "ports.80": &terraform.ResourceAttrDiff{ + "ports.80": &opentf.ResourceAttrDiff{ Old: "80", New: "80", }, - "ports.8080": &terraform.ResourceAttrDiff{ + "ports.8080": &opentf.ResourceAttrDiff{ Old: "8080", New: "0", NewRemoved: true, @@ -760,8 +760,8 @@ func TestResourceDataGet(t *testing.T) { func TestResourceDataGetChange(t *testing.T) { cases := []struct { Schema map[string]*Schema - State *terraform.InstanceState - Diff *terraform.InstanceDiff + State *opentf.InstanceState + Diff *opentf.InstanceDiff Key string OldValue interface{} NewValue interface{} @@ -778,9 +778,9 @@ func TestResourceDataGetChange(t *testing.T) { State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "foo", RequiresNew: true, @@ -804,15 +804,15 @@ func TestResourceDataGetChange(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "availability_zone": "foo", }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "foo", RequiresNew: true, @@ -846,8 +846,8 @@ func TestResourceDataGetChange(t *testing.T) { func TestResourceDataGetOk(t *testing.T) { cases := []struct { Schema map[string]*Schema - State *terraform.InstanceState - Diff *terraform.InstanceDiff + State *opentf.InstanceState + Diff *opentf.InstanceDiff Key string Value interface{} Ok bool @@ -867,9 +867,9 @@ func TestResourceDataGetOk(t *testing.T) { State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "", }, @@ -893,9 +893,9 @@ func TestResourceDataGetOk(t *testing.T) { State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "", NewComputed: true, @@ -1024,9 +1024,9 @@ func TestResourceDataGetOk(t *testing.T) { State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "0", New: "0", }, @@ -1051,9 +1051,9 @@ func TestResourceDataGetOk(t *testing.T) { State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "from_port": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "from_port": &opentf.ResourceAttrDiff{ Old: "", New: "0", }, @@ -1090,8 +1090,8 @@ func TestResourceDataGetOkExists(t *testing.T) { cases := []struct { Name string Schema map[string]*Schema - State *terraform.InstanceState - Diff *terraform.InstanceDiff + State *opentf.InstanceState + Diff *opentf.InstanceDiff Key string Value interface{} Ok bool @@ -1112,8 +1112,8 @@ func TestResourceDataGetOkExists(t *testing.T) { State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ "availability_zone": { Old: "", New: "", @@ -1139,8 +1139,8 @@ func TestResourceDataGetOkExists(t *testing.T) { State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ "availability_zone": { Old: "", New: "", @@ -1275,8 +1275,8 @@ func TestResourceDataGetOkExists(t *testing.T) { }, State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ "availability_zone": { Old: "", New: "", @@ -1302,8 +1302,8 @@ func TestResourceDataGetOkExists(t *testing.T) { State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ "availability_zone": { New: "true", }, @@ -1418,8 +1418,8 @@ func TestResourceDataTimeout(t *testing.T) { func TestResourceDataHasChange(t *testing.T) { cases := []struct { Schema map[string]*Schema - State *terraform.InstanceState - Diff *terraform.InstanceDiff + State *opentf.InstanceState + Diff *opentf.InstanceDiff Key string Change bool }{ @@ -1435,9 +1435,9 @@ func TestResourceDataHasChange(t *testing.T) { State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "foo", RequiresNew: true, @@ -1460,15 +1460,15 @@ func TestResourceDataHasChange(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "availability_zone": "foo", }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "foo", RequiresNew: true, @@ -1492,9 +1492,9 @@ func TestResourceDataHasChange(t *testing.T) { State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "tags.Name": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "tags.Name": &opentf.ResourceAttrDiff{ Old: "foo", New: "foo", }, @@ -1516,16 +1516,16 @@ func TestResourceDataHasChange(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "1", "ports.80": "80", }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "1", New: "0", }, @@ -1548,16 +1548,16 @@ func TestResourceDataHasChange(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "1", "ports.80": "80", }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "tags.foo": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "tags.foo": &opentf.ResourceAttrDiff{ Old: "", New: "bar", }, @@ -1588,8 +1588,8 @@ func TestResourceDataSet(t *testing.T) { cases := []struct { Schema map[string]*Schema - State *terraform.InstanceState - Diff *terraform.InstanceDiff + State *opentf.InstanceState + Diff *opentf.InstanceDiff Key string Value interface{} Err bool @@ -1803,7 +1803,7 @@ func TestResourceDataSet(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "3", "ports.0": "100", @@ -1833,7 +1833,7 @@ func TestResourceDataSet(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "3", "ports.100": "100", @@ -1868,7 +1868,7 @@ func TestResourceDataSet(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "2", "ports.100": "100", @@ -2160,11 +2160,11 @@ func TestResourceDataSet(t *testing.T) { func TestResourceDataState_dynamicAttributes(t *testing.T) { cases := []struct { Schema map[string]*Schema - State *terraform.InstanceState - Diff *terraform.InstanceDiff + State *opentf.InstanceState + Diff *opentf.InstanceDiff Set map[string]interface{} UnsafeSet map[string]string - Result *terraform.InstanceState + Result *opentf.InstanceState }{ { Schema: map[string]*Schema{ @@ -2192,7 +2192,7 @@ func TestResourceDataState_dynamicAttributes(t *testing.T) { "test2": "value", }, - Result: &terraform.InstanceState{ + Result: &opentf.InstanceState{ Attributes: map[string]string{ "schema_field": "present", "test1": "value", @@ -2240,10 +2240,10 @@ func TestResourceDataState_dynamicAttributes(t *testing.T) { func TestResourceDataState_schema(t *testing.T) { cases := []struct { Schema map[string]*Schema - State *terraform.InstanceState - Diff *terraform.InstanceDiff + State *opentf.InstanceState + Diff *opentf.InstanceDiff Set map[string]interface{} - Result *terraform.InstanceState + Result *opentf.InstanceState Partial []string }{ // #0 Basic primitive in diff @@ -2259,9 +2259,9 @@ func TestResourceDataState_schema(t *testing.T) { State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "foo", RequiresNew: true, @@ -2269,7 +2269,7 @@ func TestResourceDataState_schema(t *testing.T) { }, }, - Result: &terraform.InstanceState{ + Result: &opentf.InstanceState{ Attributes: map[string]string{ "availability_zone": "foo", }, @@ -2289,9 +2289,9 @@ func TestResourceDataState_schema(t *testing.T) { State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "foo", RequiresNew: true, @@ -2303,7 +2303,7 @@ func TestResourceDataState_schema(t *testing.T) { "availability_zone": "bar", }, - Result: &terraform.InstanceState{ + Result: &opentf.InstanceState{ Attributes: map[string]string{ "availability_zone": "bar", }, @@ -2327,7 +2327,7 @@ func TestResourceDataState_schema(t *testing.T) { "vpc": true, }, - Result: &terraform.InstanceState{ + Result: &opentf.InstanceState{ Attributes: map[string]string{ "vpc": "true", }, @@ -2347,9 +2347,9 @@ func TestResourceDataState_schema(t *testing.T) { State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "foo", NewExtra: "foo!", @@ -2357,7 +2357,7 @@ func TestResourceDataState_schema(t *testing.T) { }, }, - Result: &terraform.InstanceState{ + Result: &opentf.InstanceState{ Attributes: map[string]string{ "availability_zone": "foo", }, @@ -2374,27 +2374,27 @@ func TestResourceDataState_schema(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "1", "ports.0": "80", }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "1", New: "2", }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": &opentf.ResourceAttrDiff{ Old: "", New: "100", }, }, }, - Result: &terraform.InstanceState{ + Result: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "2", "ports.0": "80", @@ -2420,31 +2420,31 @@ func TestResourceDataState_schema(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "ingress.#": "1", "ingress.0.from": "80", }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ingress.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ingress.#": &opentf.ResourceAttrDiff{ Old: "1", New: "2", }, - "ingress.0.from": &terraform.ResourceAttrDiff{ + "ingress.0.from": &opentf.ResourceAttrDiff{ Old: "80", New: "150", }, - "ingress.1.from": &terraform.ResourceAttrDiff{ + "ingress.1.from": &opentf.ResourceAttrDiff{ Old: "", New: "100", }, }, }, - Result: &terraform.InstanceState{ + Result: &opentf.InstanceState{ Attributes: map[string]string{ "ingress.#": "2", "ingress.0.from": "150", @@ -2466,7 +2466,7 @@ func TestResourceDataState_schema(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "config_vars.#": "2", "config_vars.0.%": "2", @@ -2477,9 +2477,9 @@ func TestResourceDataState_schema(t *testing.T) { }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "config_vars.0.bar": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "config_vars.0.bar": &opentf.ResourceAttrDiff{ NewRemoved: true, }, }, @@ -2496,7 +2496,7 @@ func TestResourceDataState_schema(t *testing.T) { }, }, - Result: &terraform.InstanceState{ + Result: &opentf.InstanceState{ Attributes: map[string]string{ "config_vars.#": "2", "config_vars.0.%": "1", @@ -2520,27 +2520,27 @@ func TestResourceDataState_schema(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "config_vars.#": "1", "config_vars.0.FOO": "bar", }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "config_vars.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "config_vars.#": &opentf.ResourceAttrDiff{ Old: "1", New: "0", }, - "config_vars.0.FOO": &terraform.ResourceAttrDiff{ + "config_vars.0.FOO": &opentf.ResourceAttrDiff{ Old: "bar", NewRemoved: true, }, }, }, - Result: &terraform.InstanceState{ + Result: &opentf.InstanceState{ Attributes: map[string]string{ "config_vars.#": "0", }, @@ -2558,16 +2558,16 @@ func TestResourceDataState_schema(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "bar", Attributes: map[string]string{ "id": "bar", }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "foo", RequiresNew: true, @@ -2575,7 +2575,7 @@ func TestResourceDataState_schema(t *testing.T) { }, }, - Result: &terraform.InstanceState{ + Result: &opentf.InstanceState{ ID: "bar", Attributes: map[string]string{ "id": "bar", @@ -2598,7 +2598,7 @@ func TestResourceDataState_schema(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "3", "ports.100": "100", @@ -2609,7 +2609,7 @@ func TestResourceDataState_schema(t *testing.T) { Diff: nil, - Result: &terraform.InstanceState{ + Result: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "3", "ports.80": "80", @@ -2641,7 +2641,7 @@ func TestResourceDataState_schema(t *testing.T) { "ports": []interface{}{100, 80}, }, - Result: &terraform.InstanceState{ + Result: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "2", "ports.80": "80", @@ -2681,7 +2681,7 @@ func TestResourceDataState_schema(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "2", "ports.10.order": "10", @@ -2706,7 +2706,7 @@ func TestResourceDataState_schema(t *testing.T) { }, }, - Result: &terraform.InstanceState{ + Result: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "2", "ports.10.order": "10", @@ -2738,9 +2738,9 @@ func TestResourceDataState_schema(t *testing.T) { State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "foo", RequiresNew: true, @@ -2750,7 +2750,7 @@ func TestResourceDataState_schema(t *testing.T) { Partial: []string{}, - Result: &terraform.InstanceState{ + Result: &opentf.InstanceState{ Attributes: map[string]string{}, }, }, @@ -2765,20 +2765,20 @@ func TestResourceDataState_schema(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "1", "ports.0": "80", }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "1", New: "2", }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": &opentf.ResourceAttrDiff{ Old: "", New: "100", }, @@ -2787,7 +2787,7 @@ func TestResourceDataState_schema(t *testing.T) { Partial: []string{}, - Result: &terraform.InstanceState{ + Result: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "1", "ports.0": "80", @@ -2808,9 +2808,9 @@ func TestResourceDataState_schema(t *testing.T) { State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "", NewComputed: true, }, @@ -2823,7 +2823,7 @@ func TestResourceDataState_schema(t *testing.T) { "ports": []interface{}{}, }, - Result: &terraform.InstanceState{ + Result: &opentf.InstanceState{ Attributes: map[string]string{}, }, }, @@ -2845,24 +2845,24 @@ func TestResourceDataState_schema(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "ingress.#": "1", "ingress.0.from": "80", }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ingress.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ingress.#": &opentf.ResourceAttrDiff{ Old: "1", New: "2", }, - "ingress.0.from": &terraform.ResourceAttrDiff{ + "ingress.0.from": &opentf.ResourceAttrDiff{ Old: "80", New: "150", }, - "ingress.1.from": &terraform.ResourceAttrDiff{ + "ingress.1.from": &opentf.ResourceAttrDiff{ Old: "", New: "100", }, @@ -2871,7 +2871,7 @@ func TestResourceDataState_schema(t *testing.T) { Partial: []string{}, - Result: &terraform.InstanceState{ + Result: &opentf.InstanceState{ Attributes: map[string]string{ "ingress.#": "1", "ingress.0.from": "80", @@ -2892,7 +2892,7 @@ func TestResourceDataState_schema(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "config_vars.#": "2", "config_vars.0.foo": "bar", @@ -2901,9 +2901,9 @@ func TestResourceDataState_schema(t *testing.T) { }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "config_vars.0.bar": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "config_vars.0.bar": &opentf.ResourceAttrDiff{ NewRemoved: true, }, }, @@ -2922,7 +2922,7 @@ func TestResourceDataState_schema(t *testing.T) { Partial: []string{}, - Result: &terraform.InstanceState{ + Result: &opentf.InstanceState{ Attributes: map[string]string{ // TODO: broken, shouldn't bar be removed? "config_vars.#": "2", @@ -2949,7 +2949,7 @@ func TestResourceDataState_schema(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "3", "ports.100": "100", @@ -2958,9 +2958,9 @@ func TestResourceDataState_schema(t *testing.T) { }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.120": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.120": &opentf.ResourceAttrDiff{ New: "120", }, }, @@ -2968,7 +2968,7 @@ func TestResourceDataState_schema(t *testing.T) { Partial: []string{}, - Result: &terraform.InstanceState{ + Result: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "3", "ports.80": "80", @@ -2994,9 +2994,9 @@ func TestResourceDataState_schema(t *testing.T) { State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "", NewComputed: true, }, @@ -3005,7 +3005,7 @@ func TestResourceDataState_schema(t *testing.T) { Partial: []string{}, - Result: &terraform.InstanceState{ + Result: &opentf.InstanceState{ Attributes: map[string]string{}, }, }, @@ -3022,16 +3022,16 @@ func TestResourceDataState_schema(t *testing.T) { State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "tags.Name": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "tags.Name": &opentf.ResourceAttrDiff{ Old: "", New: "foo", }, }, }, - Result: &terraform.InstanceState{ + Result: &opentf.InstanceState{ Attributes: map[string]string{ "tags.%": "1", "tags.Name": "foo", @@ -3051,9 +3051,9 @@ func TestResourceDataState_schema(t *testing.T) { State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "tags.Name": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "tags.Name": &opentf.ResourceAttrDiff{ Old: "", New: "foo", }, @@ -3064,7 +3064,7 @@ func TestResourceDataState_schema(t *testing.T) { "tags": map[string]string{}, }, - Result: &terraform.InstanceState{ + Result: &opentf.InstanceState{ Attributes: map[string]string{ "tags.%": "0", }, @@ -3083,15 +3083,15 @@ func TestResourceDataState_schema(t *testing.T) { State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ NewComputed: true, }, }, }, - Result: &terraform.InstanceState{ + Result: &opentf.InstanceState{ Attributes: map[string]string{}, }, }, @@ -3108,9 +3108,9 @@ func TestResourceDataState_schema(t *testing.T) { State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ NewComputed: true, }, }, @@ -3120,7 +3120,7 @@ func TestResourceDataState_schema(t *testing.T) { "foo": "bar", }, - Result: &terraform.InstanceState{ + Result: &opentf.InstanceState{ Attributes: map[string]string{ "foo": "bar", }, @@ -3149,9 +3149,9 @@ func TestResourceDataState_schema(t *testing.T) { State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.10.uuids.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.10.uuids.#": &opentf.ResourceAttrDiff{ NewComputed: true, }, }, @@ -3168,7 +3168,7 @@ func TestResourceDataState_schema(t *testing.T) { }, }, - Result: &terraform.InstanceState{ + Result: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "1", "ports.10.index": "10", @@ -3192,7 +3192,7 @@ func TestResourceDataState_schema(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "3", "ports.100": "100", @@ -3201,16 +3201,16 @@ func TestResourceDataState_schema(t *testing.T) { }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "3", New: "0", }, }, }, - Result: &terraform.InstanceState{ + Result: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "0", }, @@ -3239,7 +3239,7 @@ func TestResourceDataState_schema(t *testing.T) { "ports": []interface{}{}, }, - Result: &terraform.InstanceState{ + Result: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "0", }, @@ -3265,7 +3265,7 @@ func TestResourceDataState_schema(t *testing.T) { "ports": []interface{}{}, }, - Result: &terraform.InstanceState{ + Result: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "0", }, @@ -3290,9 +3290,9 @@ func TestResourceDataState_schema(t *testing.T) { State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ NewComputed: true, }, }, @@ -3309,7 +3309,7 @@ func TestResourceDataState_schema(t *testing.T) { }, }, - Result: &terraform.InstanceState{ + Result: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "1", "ports.0.index": "10", @@ -3364,7 +3364,7 @@ func TestResourceDataState_schema(t *testing.T) { func TestResourceData_nonStringValuesInMap(t *testing.T) { cases := []struct { Schema map[string]*Schema - Diff *terraform.InstanceDiff + Diff *opentf.InstanceDiff MapFieldName string ItemName string ExpectedType string @@ -3377,13 +3377,13 @@ func TestResourceData_nonStringValuesInMap(t *testing.T) { Optional: true, }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "boolMap.%": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "boolMap.%": &opentf.ResourceAttrDiff{ Old: "", New: "1", }, - "boolMap.boolField": &terraform.ResourceAttrDiff{ + "boolMap.boolField": &opentf.ResourceAttrDiff{ Old: "", New: "true", }, @@ -3401,13 +3401,13 @@ func TestResourceData_nonStringValuesInMap(t *testing.T) { Optional: true, }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "intMap.%": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "intMap.%": &opentf.ResourceAttrDiff{ Old: "", New: "1", }, - "intMap.intField": &terraform.ResourceAttrDiff{ + "intMap.intField": &opentf.ResourceAttrDiff{ Old: "", New: "8", }, @@ -3425,13 +3425,13 @@ func TestResourceData_nonStringValuesInMap(t *testing.T) { Optional: true, }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "floatMap.%": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "floatMap.%": &opentf.ResourceAttrDiff{ Old: "", New: "1", }, - "floatMap.floatField": &terraform.ResourceAttrDiff{ + "floatMap.floatField": &opentf.ResourceAttrDiff{ Old: "", New: "8.22", }, @@ -3503,7 +3503,7 @@ func TestResourceDataSetMeta_Timeouts(t *testing.T) { func TestResourceDataSetId(t *testing.T) { d := &ResourceData{ - state: &terraform.InstanceState{ + state: &opentf.InstanceState{ ID: "test", Attributes: map[string]string{ "id": "test", @@ -3529,7 +3529,7 @@ func TestResourceDataSetId(t *testing.T) { func TestResourceDataSetId_clear(t *testing.T) { d := &ResourceData{ - state: &terraform.InstanceState{ID: "bar"}, + state: &opentf.InstanceState{ID: "bar"}, } d.SetId("") @@ -3541,7 +3541,7 @@ func TestResourceDataSetId_clear(t *testing.T) { func TestResourceDataSetId_override(t *testing.T) { d := &ResourceData{ - state: &terraform.InstanceState{ID: "bar"}, + state: &opentf.InstanceState{ID: "bar"}, } d.SetId("foo") diff --git a/internal/legacy/helper/schema/resource_diff.go b/internal/legacy/helper/schema/resource_diff.go index 5ca93e8c3b..1a4c36b007 100644 --- a/internal/legacy/helper/schema/resource_diff.go +++ b/internal/legacy/helper/schema/resource_diff.go @@ -10,7 +10,7 @@ import ( "strings" "sync" - "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" ) // 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 *terraform.ResourceConfig + config *opentf.ResourceConfig // The state for this resource as it exists post-refresh, after the initial // diff. - state *terraform.InstanceState + state *opentf.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 *terraform.InstanceDiff + diff *opentf.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 *terraform.ResourceConfig, state *terraform.InstanceState, diff *terraform.InstanceDiff) *ResourceDiff { +func newResourceDiff(schema map[string]*Schema, config *opentf.ResourceConfig, state *opentf.InstanceState, diff *opentf.InstanceDiff) *ResourceDiff { d := &ResourceDiff{ config: config, state: state, diff --git a/internal/legacy/helper/schema/resource_diff_test.go b/internal/legacy/helper/schema/resource_diff_test.go index e934e108f4..9c3e63c055 100644 --- a/internal/legacy/helper/schema/resource_diff_test.go +++ b/internal/legacy/helper/schema/resource_diff_test.go @@ -11,7 +11,7 @@ import ( "github.com/davecgh/go-spew/spew" "github.com/placeholderplaceholderplaceholder/opentf/internal/configs/hcl2shim" - "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" ) // testSetFunc is a very simple function we use to test a foo/bar complex set. @@ -28,13 +28,13 @@ func testSetFunc(v interface{}) int { type resourceDiffTestCase struct { Name string Schema map[string]*Schema - State *terraform.InstanceState - Config *terraform.ResourceConfig - Diff *terraform.InstanceDiff + State *opentf.InstanceState + Config *opentf.ResourceConfig + Diff *opentf.InstanceDiff Key string OldValue interface{} NewValue interface{} - Expected *terraform.InstanceDiff + Expected *opentf.InstanceDiff ExpectedKeys []string ExpectedError bool } @@ -51,7 +51,7 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) Computed: true, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "foo": "bar", }, @@ -59,9 +59,9 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) Config: testConfig(t, map[string]interface{}{ "foo": "baz", }), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ Old: "bar", New: "baz", }, @@ -69,9 +69,9 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) }, Key: "foo", NewValue: "qux", - Expected: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + Expected: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ Old: "bar", New: func() string { if computed { @@ -95,7 +95,7 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) Set: HashString, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "foo.#": "1", "foo.1996459178": "bar", @@ -104,14 +104,14 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) Config: testConfig(t, map[string]interface{}{ "foo": []interface{}{"baz"}, }), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo.1996459178": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo.1996459178": &opentf.ResourceAttrDiff{ Old: "bar", New: "", NewRemoved: true, }, - "foo.2015626392": &terraform.ResourceAttrDiff{ + "foo.2015626392": &opentf.ResourceAttrDiff{ Old: "", New: "baz", }, @@ -119,21 +119,21 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) }, Key: "foo", NewValue: []interface{}{"qux"}, - Expected: &terraform.InstanceDiff{ - Attributes: func() map[string]*terraform.ResourceAttrDiff { - result := map[string]*terraform.ResourceAttrDiff{} + Expected: &opentf.InstanceDiff{ + Attributes: func() map[string]*opentf.ResourceAttrDiff { + result := map[string]*opentf.ResourceAttrDiff{} if computed { - result["foo.#"] = &terraform.ResourceAttrDiff{ + result["foo.#"] = &opentf.ResourceAttrDiff{ Old: "1", New: "", NewComputed: true, } } else { - result["foo.2800005064"] = &terraform.ResourceAttrDiff{ + result["foo.2800005064"] = &opentf.ResourceAttrDiff{ Old: "", New: "qux", } - result["foo.1996459178"] = &terraform.ResourceAttrDiff{ + result["foo.1996459178"] = &opentf.ResourceAttrDiff{ Old: "bar", New: "", NewRemoved: true, @@ -153,7 +153,7 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) Elem: &Schema{Type: TypeString}, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "foo.#": "1", "foo.0": "bar", @@ -162,9 +162,9 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) Config: testConfig(t, map[string]interface{}{ "foo": []interface{}{"baz"}, }), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo.0": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo.0": &opentf.ResourceAttrDiff{ Old: "bar", New: "baz", }, @@ -172,17 +172,17 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) }, Key: "foo", NewValue: []interface{}{"qux"}, - Expected: &terraform.InstanceDiff{ - Attributes: func() map[string]*terraform.ResourceAttrDiff { - result := make(map[string]*terraform.ResourceAttrDiff) + Expected: &opentf.InstanceDiff{ + Attributes: func() map[string]*opentf.ResourceAttrDiff { + result := make(map[string]*opentf.ResourceAttrDiff) if computed { - result["foo.#"] = &terraform.ResourceAttrDiff{ + result["foo.#"] = &opentf.ResourceAttrDiff{ Old: "1", New: "", NewComputed: true, } } else { - result["foo.0"] = &terraform.ResourceAttrDiff{ + result["foo.0"] = &opentf.ResourceAttrDiff{ Old: "bar", New: "qux", } @@ -200,7 +200,7 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) Computed: true, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "foo.%": "1", "foo.bar": "baz", @@ -209,9 +209,9 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) Config: testConfig(t, map[string]interface{}{ "foo": map[string]interface{}{"bar": "qux"}, }), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo.bar": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo.bar": &opentf.ResourceAttrDiff{ Old: "baz", New: "qux", }, @@ -219,22 +219,22 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) }, Key: "foo", NewValue: map[string]interface{}{"bar": "quux"}, - Expected: &terraform.InstanceDiff{ - Attributes: func() map[string]*terraform.ResourceAttrDiff { - result := make(map[string]*terraform.ResourceAttrDiff) + Expected: &opentf.InstanceDiff{ + Attributes: func() map[string]*opentf.ResourceAttrDiff { + result := make(map[string]*opentf.ResourceAttrDiff) if computed { - result["foo.%"] = &terraform.ResourceAttrDiff{ + result["foo.%"] = &opentf.ResourceAttrDiff{ Old: "", New: "", NewComputed: true, } - result["foo.bar"] = &terraform.ResourceAttrDiff{ + result["foo.bar"] = &opentf.ResourceAttrDiff{ Old: "baz", New: "", NewRemoved: true, } } else { - result["foo.bar"] = &terraform.ResourceAttrDiff{ + result["foo.bar"] = &opentf.ResourceAttrDiff{ Old: "baz", New: "quux", } @@ -256,7 +256,7 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) Computed: true, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "foo": "bar", "one": "two", @@ -265,9 +265,9 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) Config: testConfig(t, map[string]interface{}{ "foo": "baz", }), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ Old: "bar", New: "baz", }, @@ -275,13 +275,13 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) }, Key: "one", NewValue: "four", - Expected: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + Expected: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ Old: "bar", New: "baz", }, - "one": &terraform.ResourceAttrDiff{ + "one": &opentf.ResourceAttrDiff{ Old: "two", New: func() string { if computed { @@ -306,7 +306,7 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) Computed: true, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "foo": "bar", "one": "two", @@ -315,9 +315,9 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) Config: testConfig(t, map[string]interface{}{ "foo": "baz", }), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ Old: "bar", New: "baz", }, @@ -325,13 +325,13 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) }, Key: "one", NewValue: "three", - Expected: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + Expected: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ Old: "bar", New: "baz", }, - "one": &terraform.ResourceAttrDiff{ + "one": &opentf.ResourceAttrDiff{ Old: "two", New: func() string { if computed { @@ -368,7 +368,7 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) Set: testSetFunc, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "top.#": "2", "top.3.foo": "1", @@ -389,21 +389,21 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) }, }, }), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "top.4.foo": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "top.4.foo": &opentf.ResourceAttrDiff{ Old: "", New: "1", }, - "top.4.bar": &terraform.ResourceAttrDiff{ + "top.4.bar": &opentf.ResourceAttrDiff{ Old: "", New: "3", }, - "top.24.foo": &terraform.ResourceAttrDiff{ + "top.24.foo": &opentf.ResourceAttrDiff{ Old: "", New: "12", }, - "top.24.bar": &terraform.ResourceAttrDiff{ + "top.24.bar": &opentf.ResourceAttrDiff{ Old: "", New: "12", }, @@ -424,41 +424,41 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) "bar": 22, }, }), - Expected: &terraform.InstanceDiff{ - Attributes: func() map[string]*terraform.ResourceAttrDiff { - result := make(map[string]*terraform.ResourceAttrDiff) + Expected: &opentf.InstanceDiff{ + Attributes: func() map[string]*opentf.ResourceAttrDiff { + result := make(map[string]*opentf.ResourceAttrDiff) if computed { - result["top.#"] = &terraform.ResourceAttrDiff{ + result["top.#"] = &opentf.ResourceAttrDiff{ Old: "2", New: "", NewComputed: true, } } else { - result["top.#"] = &terraform.ResourceAttrDiff{ + result["top.#"] = &opentf.ResourceAttrDiff{ Old: "2", New: "3", } - result["top.5.foo"] = &terraform.ResourceAttrDiff{ + result["top.5.foo"] = &opentf.ResourceAttrDiff{ Old: "", New: "1", } - result["top.5.bar"] = &terraform.ResourceAttrDiff{ + result["top.5.bar"] = &opentf.ResourceAttrDiff{ Old: "", New: "4", } - result["top.25.foo"] = &terraform.ResourceAttrDiff{ + result["top.25.foo"] = &opentf.ResourceAttrDiff{ Old: "", New: "13", } - result["top.25.bar"] = &terraform.ResourceAttrDiff{ + result["top.25.bar"] = &opentf.ResourceAttrDiff{ Old: "", New: "12", } - result["top.43.foo"] = &terraform.ResourceAttrDiff{ + result["top.43.foo"] = &opentf.ResourceAttrDiff{ Old: "", New: "21", } - result["top.43.bar"] = &terraform.ResourceAttrDiff{ + result["top.43.bar"] = &opentf.ResourceAttrDiff{ Old: "", New: "22", } @@ -475,18 +475,18 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) Computed: true, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "foo": "bar", }, }, Config: testConfig(t, map[string]interface{}{}), - Diff: &terraform.InstanceDiff{Attributes: map[string]*terraform.ResourceAttrDiff{}}, + Diff: &opentf.InstanceDiff{Attributes: map[string]*opentf.ResourceAttrDiff{}}, Key: "foo", NewValue: "baz", - Expected: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + Expected: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ Old: "bar", New: func() string { if computed { @@ -507,7 +507,7 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) Required: true, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "foo": "bar", }, @@ -515,9 +515,9 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) Config: testConfig(t, map[string]interface{}{ "foo": "baz", }), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ Old: "bar", New: "baz", }, @@ -535,7 +535,7 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) Required: true, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "foo": "bar", }, @@ -543,9 +543,9 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) Config: testConfig(t, map[string]interface{}{ "foo": "baz", }), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ Old: "bar", New: "baz", }, @@ -569,15 +569,15 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) Computed: true, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "foo": "bar", }, }, Config: testConfig(t, map[string]interface{}{}), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ Old: "bar", New: "", NewRemoved: true, @@ -586,9 +586,9 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) }, Key: "foo", NewValue: "qux", - Expected: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + Expected: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ Old: "bar", New: func() string { if computed { @@ -609,26 +609,26 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) Computed: true, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "foo": "", }, ID: "pre-existing", }, Config: testConfig(t, map[string]interface{}{}), - Diff: &terraform.InstanceDiff{Attributes: map[string]*terraform.ResourceAttrDiff{}}, + Diff: &opentf.InstanceDiff{Attributes: map[string]*opentf.ResourceAttrDiff{}}, Key: "foo", NewValue: "", - Expected: &terraform.InstanceDiff{ - Attributes: func() map[string]*terraform.ResourceAttrDiff { + Expected: &opentf.InstanceDiff{ + Attributes: func() map[string]*opentf.ResourceAttrDiff { if computed { - return map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + return map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ NewComputed: computed, }, } } - return map[string]*terraform.ResourceAttrDiff{} + return map[string]*opentf.ResourceAttrDiff{} }(), }, }, @@ -700,7 +700,7 @@ func TestForceNew(t *testing.T) { Computed: true, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "foo": "bar", }, @@ -708,18 +708,18 @@ func TestForceNew(t *testing.T) { Config: testConfig(t, map[string]interface{}{ "foo": "baz", }), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ Old: "bar", New: "baz", }, }, }, Key: "foo", - Expected: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + Expected: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ Old: "bar", New: "baz", RequiresNew: true, @@ -736,7 +736,7 @@ func TestForceNew(t *testing.T) { Computed: true, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "foo": "bar", }, @@ -754,7 +754,7 @@ func TestForceNew(t *testing.T) { Required: true, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "foo": "bar", }, @@ -762,18 +762,18 @@ func TestForceNew(t *testing.T) { Config: testConfig(t, map[string]interface{}{ "foo": "baz", }), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ Old: "bar", New: "baz", }, }, }, Key: "foo", - Expected: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + Expected: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ Old: "bar", New: "baz", RequiresNew: true, @@ -802,7 +802,7 @@ func TestForceNew(t *testing.T) { }, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "foo.#": "1", "foo.0.bar": "abc", @@ -817,26 +817,26 @@ func TestForceNew(t *testing.T) { }, }, }), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo.0.bar": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo.0.bar": &opentf.ResourceAttrDiff{ Old: "abc", New: "abcdefg", }, - "foo.0.baz": &terraform.ResourceAttrDiff{ + "foo.0.baz": &opentf.ResourceAttrDiff{ Old: "xyz", New: "changed", }, }, }, Key: "foo.0.baz", - Expected: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo.0.bar": &terraform.ResourceAttrDiff{ + Expected: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo.0.bar": &opentf.ResourceAttrDiff{ Old: "abc", New: "abcdefg", }, - "foo.0.baz": &terraform.ResourceAttrDiff{ + "foo.0.baz": &opentf.ResourceAttrDiff{ Old: "xyz", New: "changed", RequiresNew: true, @@ -852,15 +852,15 @@ func TestForceNew(t *testing.T) { Optional: true, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "foo": "bar", }, }, Config: testConfig(t, map[string]interface{}{}), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ Old: "bar", New: "", NewRemoved: true, @@ -868,9 +868,9 @@ func TestForceNew(t *testing.T) { }, }, Key: "foo", - Expected: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + Expected: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ Old: "bar", New: "", RequiresNew: true, @@ -900,7 +900,7 @@ func TestForceNew(t *testing.T) { }, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "foo.#": "1", "foo.0.bar": "abc", @@ -913,18 +913,18 @@ func TestForceNew(t *testing.T) { }, }, }), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo.0.bar": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo.0.bar": &opentf.ResourceAttrDiff{ Old: "abc", New: "abcdefg", }, }, }, Key: "foo.0.bar", - Expected: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo.0.bar": &terraform.ResourceAttrDiff{ + Expected: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo.0.bar": &opentf.ResourceAttrDiff{ Old: "abc", New: "abcdefg", RequiresNew: true, @@ -969,7 +969,7 @@ func TestClear(t *testing.T) { Computed: true, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "foo": "bar", }, @@ -977,16 +977,16 @@ func TestClear(t *testing.T) { Config: testConfig(t, map[string]interface{}{ "foo": "baz", }), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ Old: "bar", New: "baz", }, }, }, Key: "foo", - Expected: &terraform.InstanceDiff{Attributes: map[string]*terraform.ResourceAttrDiff{}}, + Expected: &opentf.InstanceDiff{Attributes: map[string]*opentf.ResourceAttrDiff{}}, }, resourceDiffTestCase{ Name: "non-computed key, should error", @@ -996,7 +996,7 @@ func TestClear(t *testing.T) { Required: true, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "foo": "bar", }, @@ -1004,9 +1004,9 @@ func TestClear(t *testing.T) { Config: testConfig(t, map[string]interface{}{ "foo": "baz", }), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ Old: "bar", New: "baz", }, @@ -1029,7 +1029,7 @@ func TestClear(t *testing.T) { Computed: true, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "foo": "bar", "one": "two", @@ -1039,22 +1039,22 @@ func TestClear(t *testing.T) { "foo": "baz", "one": "three", }), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ Old: "bar", New: "baz", }, - "one": &terraform.ResourceAttrDiff{ + "one": &opentf.ResourceAttrDiff{ Old: "two", New: "three", }, }, }, Key: "one", - Expected: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + Expected: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ Old: "bar", New: "baz", }, @@ -1084,7 +1084,7 @@ func TestClear(t *testing.T) { }, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "foo.0.bar": "bar1", "foo.0.baz": "baz1", @@ -1098,16 +1098,16 @@ func TestClear(t *testing.T) { }, }, }), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo.0.bar": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo.0.bar": &opentf.ResourceAttrDiff{ Old: "bar1", New: "bar2", }, }, }, Key: "foo.0.bar", - Expected: &terraform.InstanceDiff{Attributes: map[string]*terraform.ResourceAttrDiff{}}, + Expected: &opentf.InstanceDiff{Attributes: map[string]*opentf.ResourceAttrDiff{}}, }, resourceDiffTestCase{ Name: "sub-block diff only partial clear", @@ -1132,7 +1132,7 @@ func TestClear(t *testing.T) { }, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "foo.0.bar": "bar1", "foo.0.baz": "baz1", @@ -1146,21 +1146,21 @@ func TestClear(t *testing.T) { }, }, }), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo.0.bar": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo.0.bar": &opentf.ResourceAttrDiff{ Old: "bar1", New: "bar2", }, - "foo.0.baz": &terraform.ResourceAttrDiff{ + "foo.0.baz": &opentf.ResourceAttrDiff{ Old: "baz1", New: "baz2", }, }, }, Key: "foo.0.bar", - Expected: &terraform.InstanceDiff{Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo.0.baz": &terraform.ResourceAttrDiff{ + Expected: &opentf.InstanceDiff{Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo.0.baz": &opentf.ResourceAttrDiff{ Old: "baz1", New: "baz2", }, @@ -1203,7 +1203,7 @@ func TestGetChangedKeysPrefix(t *testing.T) { Computed: true, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "foo": "bar", }, @@ -1211,9 +1211,9 @@ func TestGetChangedKeysPrefix(t *testing.T) { Config: testConfig(t, map[string]interface{}{ "foo": "baz", }), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ Old: "bar", New: "baz", }, @@ -1249,7 +1249,7 @@ func TestGetChangedKeysPrefix(t *testing.T) { }, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "testfield": "blablah", "foo.#": "1", @@ -1266,17 +1266,17 @@ func TestGetChangedKeysPrefix(t *testing.T) { }, }, }), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "testfield": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "testfield": &opentf.ResourceAttrDiff{ Old: "blablah", New: "modified", }, - "foo.0.bar": &terraform.ResourceAttrDiff{ + "foo.0.bar": &opentf.ResourceAttrDiff{ Old: "abc", New: "abcdefg", }, - "foo.0.baz": &terraform.ResourceAttrDiff{ + "foo.0.baz": &opentf.ResourceAttrDiff{ Old: "xyz", New: "changed", }, @@ -1314,9 +1314,9 @@ func TestResourceDiffGetOkExists(t *testing.T) { cases := []struct { Name string Schema map[string]*Schema - State *terraform.InstanceState - Config *terraform.ResourceConfig - Diff *terraform.InstanceDiff + State *opentf.InstanceState + Config *opentf.ResourceConfig + Diff *opentf.InstanceDiff Key string Value interface{} Ok bool @@ -1338,8 +1338,8 @@ func TestResourceDiffGetOkExists(t *testing.T) { State: nil, Config: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ "availability_zone": { Old: "", New: "", @@ -1366,8 +1366,8 @@ func TestResourceDiffGetOkExists(t *testing.T) { State: nil, Config: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ "availability_zone": { Old: "", New: "", @@ -1508,8 +1508,8 @@ func TestResourceDiffGetOkExists(t *testing.T) { State: nil, Config: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ "availability_zone": { Old: "", New: "", @@ -1536,8 +1536,8 @@ func TestResourceDiffGetOkExists(t *testing.T) { State: nil, Config: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ "availability_zone": { New: "true", }, @@ -1557,7 +1557,7 @@ func TestResourceDiffGetOkExists(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "availability_zone": "foo", }, @@ -1566,8 +1566,8 @@ func TestResourceDiffGetOkExists(t *testing.T) { "availability_zone": "foo", }), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{}, + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{}, }, Key: "availability_zone", @@ -1588,8 +1588,8 @@ func TestResourceDiffGetOkExists(t *testing.T) { "availability_zone": "foo", }), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ "availability_zone": { Old: "", New: "foo", @@ -1611,7 +1611,7 @@ func TestResourceDiffGetOkExists(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "availability_zone": "foo", }, @@ -1620,8 +1620,8 @@ func TestResourceDiffGetOkExists(t *testing.T) { "availability_zone": "bar", }), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ "availability_zone": { Old: "foo", New: "bar", @@ -1642,15 +1642,15 @@ func TestResourceDiffGetOkExists(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "availability_zone": "foo", }, }, Config: testConfig(t, map[string]interface{}{}), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ "availability_zone": { Old: "foo", New: "", @@ -1687,8 +1687,8 @@ func TestResourceDiffGetOkExists(t *testing.T) { func TestResourceDiffGetOkExistsSetNew(t *testing.T) { tc := struct { Schema map[string]*Schema - State *terraform.InstanceState - Diff *terraform.InstanceDiff + State *opentf.InstanceState + Diff *opentf.InstanceDiff Key string Value interface{} Ok bool @@ -1703,8 +1703,8 @@ func TestResourceDiffGetOkExistsSetNew(t *testing.T) { State: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{}, + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{}, }, Key: "availability_zone", @@ -1731,8 +1731,8 @@ func TestResourceDiffGetOkExistsSetNew(t *testing.T) { func TestResourceDiffGetOkExistsSetNewComputed(t *testing.T) { tc := struct { Schema map[string]*Schema - State *terraform.InstanceState - Diff *terraform.InstanceDiff + State *opentf.InstanceState + Diff *opentf.InstanceDiff Key string Value interface{} Ok bool @@ -1745,14 +1745,14 @@ func TestResourceDiffGetOkExistsSetNewComputed(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "availability_zone": "foo", }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{}, + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{}, }, Key: "availability_zone", @@ -1774,9 +1774,9 @@ func TestResourceDiffNewValueKnown(t *testing.T) { cases := []struct { Name string Schema map[string]*Schema - State *terraform.InstanceState - Config *terraform.ResourceConfig - Diff *terraform.InstanceDiff + State *opentf.InstanceState + Config *opentf.ResourceConfig + Diff *opentf.InstanceDiff Key string Expected bool }{ @@ -1792,8 +1792,8 @@ func TestResourceDiffNewValueKnown(t *testing.T) { Config: testConfig(t, map[string]interface{}{ "availability_zone": "foo", }), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ "availability_zone": { Old: "", New: "foo", @@ -1811,7 +1811,7 @@ func TestResourceDiffNewValueKnown(t *testing.T) { Optional: true, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "availability_zone": "foo", }, @@ -1819,8 +1819,8 @@ func TestResourceDiffNewValueKnown(t *testing.T) { Config: testConfig(t, map[string]interface{}{ "availability_zone": "foo", }), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{}, + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{}, }, Key: "availability_zone", Expected: true, @@ -1833,14 +1833,14 @@ func TestResourceDiffNewValueKnown(t *testing.T) { Computed: true, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "availability_zone": "foo", }, }, Config: testConfig(t, map[string]interface{}{}), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{}, + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{}, }, Key: "availability_zone", Expected: true, @@ -1854,14 +1854,14 @@ func TestResourceDiffNewValueKnown(t *testing.T) { Computed: true, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "availability_zone": "foo", }, }, Config: testConfig(t, map[string]interface{}{}), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{}, + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{}, }, Key: "availability_zone", Expected: true, @@ -1875,7 +1875,7 @@ func TestResourceDiffNewValueKnown(t *testing.T) { Computed: true, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "availability_zone": "foo", }, @@ -1883,8 +1883,8 @@ func TestResourceDiffNewValueKnown(t *testing.T) { Config: testConfig(t, map[string]interface{}{ "availability_zone": "foo", }), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{}, + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{}, }, Key: "availability_zone", Expected: true, @@ -1897,7 +1897,7 @@ func TestResourceDiffNewValueKnown(t *testing.T) { Optional: true, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "availability_zone": "foo", }, @@ -1908,8 +1908,8 @@ func TestResourceDiffNewValueKnown(t *testing.T) { "availability_zone": hcl2shim.UnknownVariableValue, }, ), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{}, + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{}, }, Key: "availability_zone", Expected: false, @@ -1922,7 +1922,7 @@ func TestResourceDiffNewValueKnown(t *testing.T) { Optional: true, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "availability_zone": "foo", }, @@ -1933,8 +1933,8 @@ func TestResourceDiffNewValueKnown(t *testing.T) { "availability_zone": hcl2shim.UnknownVariableValue, }, ), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ "availability_zone": { Old: "foo", New: "", @@ -1962,9 +1962,9 @@ func TestResourceDiffNewValueKnown(t *testing.T) { func TestResourceDiffNewValueKnownSetNew(t *testing.T) { tc := struct { Schema map[string]*Schema - State *terraform.InstanceState - Config *terraform.ResourceConfig - Diff *terraform.InstanceDiff + State *opentf.InstanceState + Config *opentf.ResourceConfig + Diff *opentf.InstanceDiff Key string Value interface{} Expected bool @@ -1976,7 +1976,7 @@ func TestResourceDiffNewValueKnownSetNew(t *testing.T) { Computed: true, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "availability_zone": "foo", }, @@ -1987,8 +1987,8 @@ func TestResourceDiffNewValueKnownSetNew(t *testing.T) { "availability_zone": hcl2shim.UnknownVariableValue, }, ), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ "availability_zone": { Old: "foo", New: "", @@ -2013,9 +2013,9 @@ func TestResourceDiffNewValueKnownSetNew(t *testing.T) { func TestResourceDiffNewValueKnownSetNewComputed(t *testing.T) { tc := struct { Schema map[string]*Schema - State *terraform.InstanceState - Config *terraform.ResourceConfig - Diff *terraform.InstanceDiff + State *opentf.InstanceState + Config *opentf.ResourceConfig + Diff *opentf.InstanceDiff Key string Expected bool }{ @@ -2025,14 +2025,14 @@ func TestResourceDiffNewValueKnownSetNewComputed(t *testing.T) { Computed: true, }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "availability_zone": "foo", }, }, Config: testConfig(t, map[string]interface{}{}), - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{}, + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{}, }, Key: "availability_zone", Expected: false, diff --git a/internal/legacy/helper/schema/resource_test.go b/internal/legacy/helper/schema/resource_test.go index 81076c4770..5ed1e5bd8f 100644 --- a/internal/legacy/helper/schema/resource_test.go +++ b/internal/legacy/helper/schema/resource_test.go @@ -13,7 +13,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/placeholderplaceholderplaceholder/opentf/internal/configs/hcl2shim" - "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" "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 *terraform.InstanceState = nil + var s *opentf.InstanceState = nil - d := &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + d := &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ New: "42", }, }, @@ -56,7 +56,7 @@ func TestResourceApply_create(t *testing.T) { t.Fatal("not called") } - expected := &terraform.InstanceState{ + expected := &opentf.InstanceState{ ID: "foo", Attributes: map[string]string{ "id": "foo", @@ -95,11 +95,11 @@ func TestResourceApply_Timeout_state(t *testing.T) { return nil } - var s *terraform.InstanceState = nil + var s *opentf.InstanceState = nil - d := &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + d := &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ New: "42", }, }, @@ -124,7 +124,7 @@ func TestResourceApply_Timeout_state(t *testing.T) { t.Fatal("not called") } - expected := &terraform.InstanceState{ + expected := &opentf.InstanceState{ ID: "foo", Attributes: map[string]string{ "id": "foo", @@ -169,7 +169,7 @@ func TestResourceApply_Timeout_destroy(t *testing.T) { return nil } - s := &terraform.InstanceState{ + s := &opentf.InstanceState{ ID: "bar", } @@ -177,7 +177,7 @@ func TestResourceApply_Timeout_destroy(t *testing.T) { t.Fatalf("Error encoding to state: %s", err) } - d := &terraform.InstanceDiff{ + d := &opentf.InstanceDiff{ Destroy: true, } @@ -219,7 +219,7 @@ func TestResourceDiff_Timeout_diff(t *testing.T) { return nil } - conf := terraform.NewResourceConfigRaw( + conf := opentf.NewResourceConfigRaw( map[string]interface{}{ "foo": 42, TimeoutsConfigKey: map[string]interface{}{ @@ -227,16 +227,16 @@ func TestResourceDiff_Timeout_diff(t *testing.T) { }, }, ) - var s *terraform.InstanceState + var s *opentf.InstanceState actual, err := r.Diff(s, conf, nil) if err != nil { t.Fatalf("err: %s", err) } - expected := &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + expected := &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ New: "42", }, }, @@ -274,13 +274,13 @@ func TestResourceDiff_CustomizeFunc(t *testing.T) { return nil } - conf := terraform.NewResourceConfigRaw( + conf := opentf.NewResourceConfigRaw( map[string]interface{}{ "foo": 42, }, ) - var s *terraform.InstanceState + var s *opentf.InstanceState _, err := r.Diff(s, conf, nil) if err != nil { @@ -308,11 +308,11 @@ func TestResourceApply_destroy(t *testing.T) { return nil } - s := &terraform.InstanceState{ + s := &opentf.InstanceState{ ID: "bar", } - d := &terraform.InstanceDiff{ + d := &opentf.InstanceDiff{ Destroy: true, } @@ -356,7 +356,7 @@ func TestResourceApply_destroyCreate(t *testing.T) { return nil } - var s *terraform.InstanceState = &terraform.InstanceState{ + var s *opentf.InstanceState = &opentf.InstanceState{ ID: "bar", Attributes: map[string]string{ "foo": "bar", @@ -364,13 +364,13 @@ func TestResourceApply_destroyCreate(t *testing.T) { }, } - d := &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + d := &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ New: "42", RequiresNew: true, }, - "tags.Name": &terraform.ResourceAttrDiff{ + "tags.Name": &opentf.ResourceAttrDiff{ Old: "foo", New: "foo", RequiresNew: true, @@ -387,7 +387,7 @@ func TestResourceApply_destroyCreate(t *testing.T) { t.Fatal("should have change") } - expected := &terraform.InstanceState{ + expected := &opentf.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 := &terraform.InstanceState{ + s := &opentf.InstanceState{ ID: "bar", Attributes: map[string]string{ "foo": "12", }, } - d := &terraform.InstanceDiff{ + d := &opentf.InstanceDiff{ Destroy: true, } @@ -434,7 +434,7 @@ func TestResourceApply_destroyPartial(t *testing.T) { t.Fatal("should error") } - expected := &terraform.InstanceState{ + expected := &opentf.InstanceState{ ID: "bar", Attributes: map[string]string{ "id": "bar", @@ -465,16 +465,16 @@ func TestResourceApply_update(t *testing.T) { return nil } - s := &terraform.InstanceState{ + s := &opentf.InstanceState{ ID: "foo", Attributes: map[string]string{ "foo": "12", }, } - d := &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + d := &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ New: "13", }, }, @@ -485,7 +485,7 @@ func TestResourceApply_update(t *testing.T) { t.Fatalf("err: %s", err) } - expected := &terraform.InstanceState{ + expected := &opentf.InstanceState{ ID: "foo", Attributes: map[string]string{ "id": "foo", @@ -510,16 +510,16 @@ func TestResourceApply_updateNoCallback(t *testing.T) { r.Update = nil - s := &terraform.InstanceState{ + s := &opentf.InstanceState{ ID: "foo", Attributes: map[string]string{ "foo": "12", }, } - d := &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + d := &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ New: "13", }, }, @@ -530,7 +530,7 @@ func TestResourceApply_updateNoCallback(t *testing.T) { t.Fatal("should error") } - expected := &terraform.InstanceState{ + expected := &opentf.InstanceState{ ID: "foo", Attributes: map[string]string{ "foo": "12", @@ -566,23 +566,23 @@ func TestResourceApply_isNewResource(t *testing.T) { } r.Update = updateFunc - d := &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + d := &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ New: "bla-blah", }, }, } // positive test - var s *terraform.InstanceState = nil + var s *opentf.InstanceState = nil actual, err := r.Apply(s, d, nil) if err != nil { t.Fatalf("err: %s", err) } - expected := &terraform.InstanceState{ + expected := &opentf.InstanceState{ ID: "foo", Attributes: map[string]string{ "id": "foo", @@ -596,7 +596,7 @@ func TestResourceApply_isNewResource(t *testing.T) { } // negative test - s = &terraform.InstanceState{ + s = &opentf.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 = &terraform.InstanceState{ + expected = &opentf.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 := &terraform.InstanceState{ + s := &opentf.InstanceState{ ID: "bar", Attributes: map[string]string{ "foo": "12", }, } - expected := &terraform.InstanceState{ + expected := &opentf.InstanceState{ ID: "bar", Attributes: map[string]string{ "id": "bar", @@ -946,7 +946,7 @@ func TestResourceRefresh_blankId(t *testing.T) { return nil } - s := &terraform.InstanceState{ + s := &opentf.InstanceState{ ID: "", Attributes: map[string]string{}, } @@ -975,7 +975,7 @@ func TestResourceRefresh_delete(t *testing.T) { return nil } - s := &terraform.InstanceState{ + s := &opentf.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 := &terraform.InstanceState{ + s := &opentf.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 := &terraform.InstanceState{ + s := &opentf.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 *terraform.InstanceState, - meta interface{}) (*terraform.InstanceState, error) { + s *opentf.InstanceState, + meta interface{}) (*opentf.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 := &terraform.InstanceState{ + s := &opentf.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 := &terraform.InstanceState{ + expected := &opentf.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 *terraform.InstanceState, - meta interface{}) (*terraform.InstanceState, error) { + s *opentf.InstanceState, + meta interface{}) (*opentf.InstanceState, error) { t.Fatal("Migrate function shouldn't be called!") return nil, nil } - s := &terraform.InstanceState{ + s := &opentf.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 := &terraform.InstanceState{ + expected := &opentf.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 *terraform.InstanceState, - meta interface{}) (*terraform.InstanceState, error) { + s *opentf.InstanceState, + meta interface{}) (*opentf.InstanceState, error) { s.Attributes["newfoo"] = s.Attributes["oldfoo"] return s, nil } - s := &terraform.InstanceState{ + s := &opentf.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 := &terraform.InstanceState{ + expected := &opentf.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 *terraform.InstanceState, - meta interface{}) (*terraform.InstanceState, error) { + s *opentf.InstanceState, + meta interface{}) (*opentf.InstanceState, error) { return s, fmt.Errorf("triggering an error") } - s := &terraform.InstanceState{ + s := &opentf.InstanceState{ ID: "bar", Attributes: map[string]string{ "oldfoo": "12", @@ -1286,7 +1286,7 @@ func TestResourceData(t *testing.T) { }, } - state := &terraform.InstanceState{ + state := &opentf.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 *terraform.InstanceState, _ interface{}) (*terraform.InstanceState, error) { + MigrateState: func(v int, is *opentf.InstanceState, _ interface{}) (*opentf.InstanceState, error) { switch v { case 0: _, ok := is.Attributes["zero"] @@ -1611,7 +1611,7 @@ func TestResource_migrateAndUpgrade(t *testing.T) { }, } - testStates := []*terraform.InstanceState{ + testStates := []*opentf.InstanceState{ { ID: "bar", Attributes: map[string]string{ @@ -1671,7 +1671,7 @@ func TestResource_migrateAndUpgrade(t *testing.T) { t.Fatal(err) } - expected := &terraform.InstanceState{ + expected := &opentf.InstanceState{ ID: "bar", Attributes: map[string]string{ "id": "bar", diff --git a/internal/legacy/helper/schema/resource_timeout.go b/internal/legacy/helper/schema/resource_timeout.go index 9986448f9e..439a890693 100644 --- a/internal/legacy/helper/schema/resource_timeout.go +++ b/internal/legacy/helper/schema/resource_timeout.go @@ -10,7 +10,7 @@ import ( "github.com/mitchellh/copystructure" "github.com/placeholderplaceholderplaceholder/opentf/internal/configs/hcl2shim" - "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" ) 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 *terraform.ResourceConfig) error { +func (t *ResourceTimeout) ConfigDecode(s *Resource, c *opentf.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 *terraform.InstanceDiff) error { +func (t *ResourceTimeout) DiffEncode(id *opentf.InstanceDiff) error { return t.metaEncode(id) } -func (t *ResourceTimeout) StateEncode(is *terraform.InstanceState) error { +func (t *ResourceTimeout) StateEncode(is *opentf.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 *terraform.InstanceState or -// *terraform.InstanceDiff, returns an error otherwise +// Assumes the interface is either *opentf.InstanceState or +// *opentf.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 *terraform.InstanceDiff: + case *opentf.InstanceDiff: if instance.Meta == nil { instance.Meta = make(map[string]interface{}) } instance.Meta[TimeoutKey] = m - case *terraform.InstanceState: + case *opentf.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 *terraform.InstanceState) error { +func (t *ResourceTimeout) StateDecode(id *opentf.InstanceState) error { return t.metaDecode(id) } -func (t *ResourceTimeout) DiffDecode(is *terraform.InstanceDiff) error { +func (t *ResourceTimeout) DiffDecode(is *opentf.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 *terraform.InstanceDiff: + case *opentf.InstanceDiff: rawMeta, ok = rawInstance.Meta[TimeoutKey] if !ok { return nil } - case *terraform.InstanceState: + case *opentf.InstanceState: rawMeta, ok = rawInstance.Meta[TimeoutKey] if !ok { return nil diff --git a/internal/legacy/helper/schema/resource_timeout_test.go b/internal/legacy/helper/schema/resource_timeout_test.go index 654c65e20d..62ef2dc770 100644 --- a/internal/legacy/helper/schema/resource_timeout_test.go +++ b/internal/legacy/helper/schema/resource_timeout_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" ) func TestResourceTimeout_ConfigDecode_badkey(t *testing.T) { @@ -62,7 +62,7 @@ func TestResourceTimeout_ConfigDecode_badkey(t *testing.T) { Timeouts: c.ResourceDefaultTimeout, } - conf := terraform.NewResourceConfigRaw( + conf := opentf.NewResourceConfigRaw( map[string]interface{}{ "foo": "bar", TimeoutsConfigKey: c.Config, @@ -99,7 +99,7 @@ func TestResourceTimeout_ConfigDecode(t *testing.T) { }, } - c := terraform.NewResourceConfigRaw( + c := opentf.NewResourceConfigRaw( map[string]interface{}{ "foo": "bar", TimeoutsConfigKey: map[string]interface{}{ @@ -133,7 +133,7 @@ func TestResourceTimeout_legacyConfigDecode(t *testing.T) { }, } - c := terraform.NewResourceConfigRaw( + c := opentf.NewResourceConfigRaw( map[string]interface{}{ "foo": "bar", TimeoutsConfigKey: []interface{}{ @@ -195,7 +195,7 @@ func TestResourceTimeout_DiffEncode_basic(t *testing.T) { } for _, c := range cases { - state := &terraform.InstanceDiff{} + state := &opentf.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 := &terraform.InstanceState{} + state := &opentf.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 *terraform.InstanceDiff + State *opentf.InstanceDiff Expected *ResourceTimeout // Not immediately clear when an error would hit ShouldErr bool }{ // Two fields { - State: &terraform.InstanceDiff{Meta: map[string]interface{}{TimeoutKey: expectedForValues(10, 0, 5, 0, 0)}}, + State: &opentf.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: &terraform.InstanceDiff{Meta: map[string]interface{}{TimeoutKey: expectedForValues(10, 0, 0, 0, 7)}}, + State: &opentf.InstanceDiff{Meta: map[string]interface{}{TimeoutKey: expectedForValues(10, 0, 0, 0, 7)}}, Expected: timeoutForValues(10, 7, 7, 7, 7), ShouldErr: false, }, // All fields { - State: &terraform.InstanceDiff{Meta: map[string]interface{}{TimeoutKey: expectedForValues(10, 3, 4, 1, 7)}}, + State: &opentf.InstanceDiff{Meta: map[string]interface{}{TimeoutKey: expectedForValues(10, 3, 4, 1, 7)}}, Expected: timeoutForValues(10, 3, 4, 1, 7), ShouldErr: false, }, // No fields { - State: &terraform.InstanceDiff{}, + State: &opentf.InstanceDiff{}, Expected: &ResourceTimeout{}, ShouldErr: false, }, diff --git a/internal/legacy/helper/schema/schema.go b/internal/legacy/helper/schema/schema.go index 6ffe2ea212..7c400c84e6 100644 --- a/internal/legacy/helper/schema/schema.go +++ b/internal/legacy/helper/schema/schema.go @@ -28,7 +28,7 @@ import ( "github.com/mitchellh/copystructure" "github.com/mitchellh/mapstructure" "github.com/placeholderplaceholderplaceholder/opentf/internal/configs/hcl2shim" - "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" ) // 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 *terraform.ResourceAttrDiff, customized bool) *terraform.ResourceAttrDiff { +func (s *Schema) finalizeDiff(d *opentf.ResourceAttrDiff, customized bool) *opentf.ResourceAttrDiff { if d == nil { return d } @@ -447,8 +447,8 @@ func (m schemaMap) panicOnError() bool { // // The diff is optional. func (m schemaMap) Data( - s *terraform.InstanceState, - d *terraform.InstanceDiff) (*ResourceData, error) { + s *opentf.InstanceState, + d *opentf.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 *terraform.InstanceState, - c *terraform.ResourceConfig, + s *opentf.InstanceState, + c *opentf.ResourceConfig, customizeDiff CustomizeDiffFunc, meta interface{}, - handleRequiresNew bool) (*terraform.InstanceDiff, error) { - result := new(terraform.InstanceDiff) - result.Attributes = make(map[string]*terraform.ResourceAttrDiff) + handleRequiresNew bool) (*opentf.InstanceDiff, error) { + result := new(opentf.InstanceDiff) + result.Attributes = make(map[string]*opentf.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(terraform.InstanceDiff) - result2.Attributes = make(map[string]*terraform.ResourceAttrDiff) + result2 := new(opentf.InstanceDiff) + result2.Attributes = make(map[string]*opentf.ResourceAttrDiff) // Preserve the DestroyTainted flag result2.DestroyTainted = result.DestroyTainted @@ -613,11 +613,11 @@ func (m schemaMap) Diff( return result, nil } -// Input implements the terraform.ResourceProvider method by asking +// Input implements the opentf.ResourceProvider method by asking // for input for required configuration keys that don't have a value. func (m schemaMap) Input( - input terraform.UIInput, - c *terraform.ResourceConfig) (*terraform.ResourceConfig, error) { + input opentf.UIInput, + c *opentf.ResourceConfig) (*opentf.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 *terraform.ResourceConfig) ([]string, []error) { +func (m schemaMap) Validate(c *opentf.ResourceConfig) ([]string, []error) { return m.validateObject("", m, c) } @@ -868,12 +868,12 @@ type resourceDiffer interface { func (m schemaMap) diff( k string, schema *Schema, - diff *terraform.InstanceDiff, + diff *opentf.InstanceDiff, d resourceDiffer, all bool) error { - unsupressedDiff := new(terraform.InstanceDiff) - unsupressedDiff.Attributes = make(map[string]*terraform.ResourceAttrDiff) + unsupressedDiff := new(opentf.InstanceDiff) + unsupressedDiff.Attributes = make(map[string]*opentf.ResourceAttrDiff) var err error switch schema.Type { @@ -901,7 +901,7 @@ func (m schemaMap) diff( continue } - attrV = &terraform.ResourceAttrDiff{ + attrV = &opentf.ResourceAttrDiff{ Old: attrV.Old, New: attrV.Old, } @@ -916,7 +916,7 @@ func (m schemaMap) diff( func (m schemaMap) diffList( k string, schema *Schema, - diff *terraform.InstanceDiff, + diff *opentf.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+".#"] = &terraform.ResourceAttrDiff{ + diff.Attributes[k+".#"] = &opentf.ResourceAttrDiff{ Old: oldStr, NewComputed: true, RequiresNew: schema.ForceNew, @@ -987,7 +987,7 @@ func (m schemaMap) diffList( } diff.Attributes[k+".#"] = countSchema.finalizeDiff( - &terraform.ResourceAttrDiff{ + &opentf.ResourceAttrDiff{ Old: oldStr, New: newStr, }, @@ -1038,7 +1038,7 @@ func (m schemaMap) diffList( func (m schemaMap) diffMap( k string, schema *Schema, - diff *terraform.InstanceDiff, + diff *opentf.InstanceDiff, d resourceDiffer, all bool) error { prefix := k + "." @@ -1093,7 +1093,7 @@ func (m schemaMap) diffMap( } diff.Attributes[k+".%"] = countSchema.finalizeDiff( - &terraform.ResourceAttrDiff{ + &opentf.ResourceAttrDiff{ Old: oldStr, New: newStr, }, @@ -1116,7 +1116,7 @@ func (m schemaMap) diffMap( } diff.Attributes[prefix+k] = schema.finalizeDiff( - &terraform.ResourceAttrDiff{ + &opentf.ResourceAttrDiff{ Old: old, New: v, }, @@ -1125,7 +1125,7 @@ func (m schemaMap) diffMap( } for k, v := range stateMap { diff.Attributes[prefix+k] = schema.finalizeDiff( - &terraform.ResourceAttrDiff{ + &opentf.ResourceAttrDiff{ Old: v, NewRemoved: true, }, @@ -1139,7 +1139,7 @@ func (m schemaMap) diffMap( func (m schemaMap) diffSet( k string, schema *Schema, - diff *terraform.InstanceDiff, + diff *opentf.InstanceDiff, d resourceDiffer, all bool) error { @@ -1203,7 +1203,7 @@ func (m schemaMap) diffSet( } diff.Attributes[k+".#"] = countSchema.finalizeDiff( - &terraform.ResourceAttrDiff{ + &opentf.ResourceAttrDiff{ Old: countStr, NewComputed: true, }, @@ -1216,7 +1216,7 @@ func (m schemaMap) diffSet( changed := oldLen != newLen if changed || all { diff.Attributes[k+".#"] = countSchema.finalizeDiff( - &terraform.ResourceAttrDiff{ + &opentf.ResourceAttrDiff{ Old: oldStr, New: newStr, }, @@ -1266,7 +1266,7 @@ func (m schemaMap) diffSet( func (m schemaMap) diffString( k string, schema *Schema, - diff *terraform.InstanceDiff, + diff *opentf.InstanceDiff, d resourceDiffer, all bool) error { var originalN interface{} @@ -1309,7 +1309,7 @@ func (m schemaMap) diffString( } diff.Attributes[k] = schema.finalizeDiff( - &terraform.ResourceAttrDiff{ + &opentf.ResourceAttrDiff{ Old: os, New: ns, NewExtra: originalN, @@ -1323,10 +1323,10 @@ func (m schemaMap) diffString( } func (m schemaMap) inputString( - input terraform.UIInput, + input opentf.UIInput, k string, schema *Schema) (interface{}, error) { - result, err := input.Input(context.Background(), &terraform.InputOpts{ + result, err := input.Input(context.Background(), &opentf.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 *terraform.ResourceConfig) ([]string, []error) { + c *opentf.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 *terraform.ResourceConfig) error { + c *opentf.ResourceConfig) error { if len(schema.ConflictsWith) == 0 { return nil @@ -1438,7 +1438,7 @@ func (m schemaMap) validateList( k string, raw interface{}, schema *Schema, - c *terraform.ResourceConfig) ([]string, []error) { + c *opentf.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 *terraform.ResourceConfig) ([]string, []error) { + c *opentf.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 *terraform.ResourceConfig) ([]string, []error) { + c *opentf.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 *terraform.ResourceConfig) ([]string, []error) { + c *opentf.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 *terraform.ResourceConfig) ([]string, []error) { + c *opentf.ResourceConfig) ([]string, []error) { var ws []string var es []error switch schema.Type { diff --git a/internal/legacy/helper/schema/schema_test.go b/internal/legacy/helper/schema/schema_test.go index 693dc5f0f8..5b23ee23db 100644 --- a/internal/legacy/helper/schema/schema_test.go +++ b/internal/legacy/helper/schema/schema_test.go @@ -16,7 +16,7 @@ import ( "github.com/placeholderplaceholderplaceholder/opentf/internal/configs/hcl2shim" "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/helper/hashcode" - "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" ) func TestEnvDefaultFunc(t *testing.T) { @@ -132,10 +132,10 @@ func TestSchemaMap_Diff(t *testing.T) { cases := []struct { Name string Schema map[string]*Schema - State *terraform.InstanceState + State *opentf.InstanceState Config map[string]interface{} CustomizeDiff CustomizeDiffFunc - Diff *terraform.InstanceDiff + Diff *opentf.InstanceDiff Err bool }{ { @@ -154,9 +154,9 @@ func TestSchemaMap_Diff(t *testing.T) { "availability_zone": "foo", }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "foo", RequiresNew: true, @@ -181,9 +181,9 @@ func TestSchemaMap_Diff(t *testing.T) { Config: map[string]interface{}{}, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", NewComputed: true, RequiresNew: true, @@ -204,7 +204,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "foo", }, @@ -225,7 +225,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "availability_zone": "foo", }, @@ -235,9 +235,9 @@ func TestSchemaMap_Diff(t *testing.T) { "availability_zone": "bar", }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "foo", New: "bar", }, @@ -261,9 +261,9 @@ func TestSchemaMap_Diff(t *testing.T) { Config: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "foo", }, @@ -289,9 +289,9 @@ func TestSchemaMap_Diff(t *testing.T) { Config: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "foo", }, @@ -319,9 +319,9 @@ func TestSchemaMap_Diff(t *testing.T) { "availability_zone": "bar", }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "bar", }, @@ -350,9 +350,9 @@ func TestSchemaMap_Diff(t *testing.T) { "availability_zone": "foo", }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "foo!", NewExtra: "foo", @@ -381,9 +381,9 @@ func TestSchemaMap_Diff(t *testing.T) { Config: map[string]interface{}{}, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "", NewComputed: true, @@ -409,9 +409,9 @@ func TestSchemaMap_Diff(t *testing.T) { "availability_zone": hcl2shim.UnknownVariableValue, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: hcl2shim.UnknownVariableValue, NewComputed: true, @@ -439,9 +439,9 @@ func TestSchemaMap_Diff(t *testing.T) { "port": 27, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "port": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "port": &opentf.ResourceAttrDiff{ Old: "", New: "27", RequiresNew: true, @@ -469,9 +469,9 @@ func TestSchemaMap_Diff(t *testing.T) { "port": false, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "port": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "port": &opentf.ResourceAttrDiff{ Old: "", New: "false", RequiresNew: true, @@ -492,7 +492,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "delete": "false", }, @@ -521,21 +521,21 @@ func TestSchemaMap_Diff(t *testing.T) { "ports": []interface{}{1, 2, 5}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "0", New: "3", }, - "ports.0": &terraform.ResourceAttrDiff{ + "ports.0": &opentf.ResourceAttrDiff{ Old: "", New: "1", }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": &opentf.ResourceAttrDiff{ Old: "", New: "2", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": &opentf.ResourceAttrDiff{ Old: "", New: "5", }, @@ -562,13 +562,13 @@ func TestSchemaMap_Diff(t *testing.T) { "ports": "5", }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "0", New: "1", }, - "ports.0": &terraform.ResourceAttrDiff{ + "ports.0": &opentf.ResourceAttrDiff{ Old: "", New: "5", }, @@ -595,13 +595,13 @@ func TestSchemaMap_Diff(t *testing.T) { "ports": []interface{}{"5"}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "0", New: "1", }, - "ports.0": &terraform.ResourceAttrDiff{ + "ports.0": &opentf.ResourceAttrDiff{ Old: "", New: "5", }, @@ -626,21 +626,21 @@ func TestSchemaMap_Diff(t *testing.T) { "ports": []interface{}{1, 2, 5}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "0", New: "3", }, - "ports.0": &terraform.ResourceAttrDiff{ + "ports.0": &opentf.ResourceAttrDiff{ Old: "", New: "1", }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": &opentf.ResourceAttrDiff{ Old: "", New: "2", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": &opentf.ResourceAttrDiff{ Old: "", New: "5", }, @@ -665,9 +665,9 @@ func TestSchemaMap_Diff(t *testing.T) { "ports": []interface{}{1, hcl2shim.UnknownVariableValue, 5}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "0", New: "", NewComputed: true, @@ -687,7 +687,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "3", "ports.0": "1", @@ -715,7 +715,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "2", "ports.0": "1", @@ -727,13 +727,13 @@ func TestSchemaMap_Diff(t *testing.T) { "ports": []interface{}{1, 2, 5}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "2", New: "3", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": &opentf.ResourceAttrDiff{ Old: "", New: "5", }, @@ -760,24 +760,24 @@ func TestSchemaMap_Diff(t *testing.T) { "ports": []interface{}{1, 2, 5}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "0", New: "3", RequiresNew: true, }, - "ports.0": &terraform.ResourceAttrDiff{ + "ports.0": &opentf.ResourceAttrDiff{ Old: "", New: "1", RequiresNew: true, }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": &opentf.ResourceAttrDiff{ Old: "", New: "2", RequiresNew: true, }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": &opentf.ResourceAttrDiff{ Old: "", New: "5", RequiresNew: true, @@ -803,9 +803,9 @@ func TestSchemaMap_Diff(t *testing.T) { Config: map[string]interface{}{}, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "", NewComputed: true, }, @@ -851,20 +851,20 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "config.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "config.#": &opentf.ResourceAttrDiff{ Old: "0", New: "1", RequiresNew: true, }, - "config.0.name": &terraform.ResourceAttrDiff{ + "config.0.name": &opentf.ResourceAttrDiff{ Old: "", New: "hello", }, - "config.0.rules.#": &terraform.ResourceAttrDiff{ + "config.0.rules.#": &opentf.ResourceAttrDiff{ Old: "", NewComputed: true, }, @@ -893,21 +893,21 @@ func TestSchemaMap_Diff(t *testing.T) { "ports": []interface{}{5, 2, 1}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "0", New: "3", }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": &opentf.ResourceAttrDiff{ Old: "", New: "1", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": &opentf.ResourceAttrDiff{ Old: "", New: "2", }, - "ports.5": &terraform.ResourceAttrDiff{ + "ports.5": &opentf.ResourceAttrDiff{ Old: "", New: "5", }, @@ -931,7 +931,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "0", }, @@ -962,9 +962,9 @@ func TestSchemaMap_Diff(t *testing.T) { Config: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "", NewComputed: true, }, @@ -993,21 +993,21 @@ func TestSchemaMap_Diff(t *testing.T) { "ports": []interface{}{"2", "5", 1}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "0", New: "3", }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": &opentf.ResourceAttrDiff{ Old: "", New: "1", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": &opentf.ResourceAttrDiff{ Old: "", New: "2", }, - "ports.5": &terraform.ResourceAttrDiff{ + "ports.5": &opentf.ResourceAttrDiff{ Old: "", New: "5", }, @@ -1036,9 +1036,9 @@ func TestSchemaMap_Diff(t *testing.T) { "ports": []interface{}{1, hcl2shim.UnknownVariableValue, "5"}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "", New: "", NewComputed: true, @@ -1062,7 +1062,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "2", "ports.1": "1", @@ -1074,21 +1074,21 @@ func TestSchemaMap_Diff(t *testing.T) { "ports": []interface{}{5, 2, 1}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "2", New: "3", }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": &opentf.ResourceAttrDiff{ Old: "1", New: "1", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": &opentf.ResourceAttrDiff{ Old: "2", New: "2", }, - "ports.5": &terraform.ResourceAttrDiff{ + "ports.5": &opentf.ResourceAttrDiff{ Old: "", New: "5", }, @@ -1111,7 +1111,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "2", "ports.1": "1", @@ -1121,18 +1121,18 @@ func TestSchemaMap_Diff(t *testing.T) { Config: map[string]interface{}{}, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "2", New: "0", }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": &opentf.ResourceAttrDiff{ Old: "1", New: "0", NewRemoved: true, }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": &opentf.ResourceAttrDiff{ Old: "2", New: "0", NewRemoved: true, @@ -1157,7 +1157,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "availability_zone": "bar", "ports.#": "1", @@ -1199,7 +1199,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "ingress.#": "2", "ingress.80.ports.#": "1", @@ -1252,13 +1252,13 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ingress.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ingress.#": &opentf.ResourceAttrDiff{ Old: "0", New: "1", }, - "ingress.0.from": &terraform.ResourceAttrDiff{ + "ingress.0.from": &opentf.ResourceAttrDiff{ Old: "", New: "8080", }, @@ -1283,7 +1283,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "availability_zone": "foo", "port": "80", @@ -1314,7 +1314,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "port": "80", }, @@ -1324,9 +1324,9 @@ func TestSchemaMap_Diff(t *testing.T) { "port": 80, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ NewComputed: true, }, }, @@ -1396,14 +1396,14 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "config_vars.%": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "config_vars.%": &opentf.ResourceAttrDiff{ Old: "0", New: "1", }, - "config_vars.bar": &terraform.ResourceAttrDiff{ + "config_vars.bar": &opentf.ResourceAttrDiff{ Old: "", New: "baz", }, @@ -1421,7 +1421,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "config_vars.foo": "bar", }, @@ -1435,13 +1435,13 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "config_vars.foo": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "config_vars.foo": &opentf.ResourceAttrDiff{ Old: "bar", NewRemoved: true, }, - "config_vars.bar": &terraform.ResourceAttrDiff{ + "config_vars.bar": &opentf.ResourceAttrDiff{ Old: "", New: "baz", }, @@ -1461,7 +1461,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "vars.foo": "bar", }, @@ -1475,14 +1475,14 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "vars.foo": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "vars.foo": &opentf.ResourceAttrDiff{ Old: "bar", New: "", NewRemoved: true, }, - "vars.bar": &terraform.ResourceAttrDiff{ + "vars.bar": &opentf.ResourceAttrDiff{ Old: "", New: "baz", }, @@ -1501,7 +1501,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "vars.foo": "bar", }, @@ -1523,7 +1523,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "config_vars.#": "1", "config_vars.0.foo": "bar", @@ -1538,13 +1538,13 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "config_vars.0.foo": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "config_vars.0.foo": &opentf.ResourceAttrDiff{ Old: "bar", NewRemoved: true, }, - "config_vars.0.bar": &terraform.ResourceAttrDiff{ + "config_vars.0.bar": &opentf.ResourceAttrDiff{ Old: "", New: "baz", }, @@ -1563,7 +1563,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "config_vars.#": "1", "config_vars.0.foo": "bar", @@ -1573,21 +1573,21 @@ func TestSchemaMap_Diff(t *testing.T) { Config: map[string]interface{}{}, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "config_vars.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "config_vars.#": &opentf.ResourceAttrDiff{ Old: "1", New: "0", }, - "config_vars.0.%": &terraform.ResourceAttrDiff{ + "config_vars.0.%": &opentf.ResourceAttrDiff{ Old: "2", New: "0", }, - "config_vars.0.foo": &terraform.ResourceAttrDiff{ + "config_vars.0.foo": &opentf.ResourceAttrDiff{ Old: "bar", NewRemoved: true, }, - "config_vars.0.bar": &terraform.ResourceAttrDiff{ + "config_vars.0.bar": &opentf.ResourceAttrDiff{ Old: "baz", NewRemoved: true, }, @@ -1613,7 +1613,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "availability_zone": "bar", "address": "foo", @@ -1624,15 +1624,15 @@ func TestSchemaMap_Diff(t *testing.T) { "availability_zone": "foo", }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "bar", New: "foo", RequiresNew: true, }, - "address": &terraform.ResourceAttrDiff{ + "address": &opentf.ResourceAttrDiff{ Old: "foo", New: "", NewComputed: true, @@ -1663,7 +1663,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "availability_zone": "bar", "ports.#": "1", @@ -1675,15 +1675,15 @@ func TestSchemaMap_Diff(t *testing.T) { "availability_zone": "foo", }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "bar", New: "foo", RequiresNew: true, }, - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "1", New: "", NewComputed: true, @@ -1708,7 +1708,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "instances.#": "0", }, @@ -1718,9 +1718,9 @@ func TestSchemaMap_Diff(t *testing.T) { "instances": []interface{}{hcl2shim.UnknownVariableValue}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "instances.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "instances.#": &opentf.ResourceAttrDiff{ NewComputed: true, }, }, @@ -1766,17 +1766,17 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "route.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "route.#": &opentf.ResourceAttrDiff{ Old: "0", New: "1", }, - "route.~1.index": &terraform.ResourceAttrDiff{ + "route.~1.index": &opentf.ResourceAttrDiff{ Old: "", New: "1", }, - "route.~1.gateway": &terraform.ResourceAttrDiff{ + "route.~1.gateway": &opentf.ResourceAttrDiff{ Old: "", New: hcl2shim.UnknownVariableValue, NewComputed: true, @@ -1830,17 +1830,17 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "route.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "route.#": &opentf.ResourceAttrDiff{ Old: "0", New: "1", }, - "route.~1.index": &terraform.ResourceAttrDiff{ + "route.~1.index": &opentf.ResourceAttrDiff{ Old: "", New: "1", }, - "route.~1.gateway.#": &terraform.ResourceAttrDiff{ + "route.~1.gateway.#": &opentf.ResourceAttrDiff{ NewComputed: true, }, }, @@ -1862,9 +1862,9 @@ func TestSchemaMap_Diff(t *testing.T) { Config: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "vars.%": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "vars.%": &opentf.ResourceAttrDiff{ Old: "", NewComputed: true, }, @@ -1883,7 +1883,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "vars.%": "0", }, @@ -1895,9 +1895,9 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "vars.%": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "vars.%": &opentf.ResourceAttrDiff{ Old: "", NewComputed: true, }, @@ -1911,7 +1911,7 @@ func TestSchemaMap_Diff(t *testing.T) { Name: " - Empty", Schema: map[string]*Schema{}, - State: &terraform.InstanceState{}, + State: &opentf.InstanceState{}, Config: map[string]interface{}{}, @@ -1928,7 +1928,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "some_threshold": "567.8", }, @@ -1938,9 +1938,9 @@ func TestSchemaMap_Diff(t *testing.T) { "some_threshold": 12.34, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "some_threshold": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "some_threshold": &opentf.ResourceAttrDiff{ Old: "567.8", New: "12.34", }, @@ -1980,7 +1980,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "block_device.#": "2", "block_device.616397234.delete_on_termination": "true", @@ -2014,7 +2014,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "port": "false", }, @@ -2057,7 +2057,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "route.#": "0", }, @@ -2080,7 +2080,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "active": "true", }, @@ -2107,7 +2107,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "instances.#": "1", "instances.3": "foo", @@ -2116,14 +2116,14 @@ func TestSchemaMap_Diff(t *testing.T) { Config: map[string]interface{}{}, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "instances.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "instances.#": &opentf.ResourceAttrDiff{ Old: "1", New: "0", RequiresNew: true, }, - "instances.3": &terraform.ResourceAttrDiff{ + "instances.3": &opentf.ResourceAttrDiff{ Old: "foo", New: "", NewRemoved: true, @@ -2151,13 +2151,13 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "vars.%": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "vars.%": &opentf.ResourceAttrDiff{ Old: "0", New: "1", }, - "vars.foo": &terraform.ResourceAttrDiff{ + "vars.foo": &opentf.ResourceAttrDiff{ Old: "", New: "", }, @@ -2219,7 +2219,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "metadata_keys.#": "0", }, @@ -2251,9 +2251,9 @@ func TestSchemaMap_Diff(t *testing.T) { "ports": []interface{}{1, hcl2shim.UnknownVariableValue}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "", New: "", NewComputed: true, @@ -2275,7 +2275,7 @@ func TestSchemaMap_Diff(t *testing.T) { Config: nil, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "tags.%": "0", }, @@ -2323,17 +2323,17 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "route.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "route.#": &opentf.ResourceAttrDiff{ Old: "0", New: "1", }, - "route.1.index": &terraform.ResourceAttrDiff{ + "route.1.index": &opentf.ResourceAttrDiff{ Old: "", New: "1", }, - "route.1.gateway-name": &terraform.ResourceAttrDiff{ + "route.1.gateway-name": &opentf.ResourceAttrDiff{ Old: "", New: "hello", }, @@ -2385,19 +2385,19 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "service_account.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "service_account.#": &opentf.ResourceAttrDiff{ Old: "0", New: "1", RequiresNew: true, }, - "service_account.0.scopes.#": &terraform.ResourceAttrDiff{ + "service_account.0.scopes.#": &opentf.ResourceAttrDiff{ Old: "0", New: "1", RequiresNew: true, }, - "service_account.0.scopes.123": &terraform.ResourceAttrDiff{ + "service_account.0.scopes.123": &opentf.ResourceAttrDiff{ Old: "", New: "123!", NewExtra: "123", @@ -2423,7 +2423,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "instances.#": "2", "instances.3": "333", @@ -2435,23 +2435,23 @@ func TestSchemaMap_Diff(t *testing.T) { "instances": []interface{}{"333", "4444"}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "instances.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "instances.#": &opentf.ResourceAttrDiff{ Old: "2", New: "2", }, - "instances.2": &terraform.ResourceAttrDiff{ + "instances.2": &opentf.ResourceAttrDiff{ Old: "22", New: "", NewRemoved: true, RequiresNew: true, }, - "instances.3": &terraform.ResourceAttrDiff{ + "instances.3": &opentf.ResourceAttrDiff{ Old: "333", New: "333", }, - "instances.4": &terraform.ResourceAttrDiff{ + "instances.4": &opentf.ResourceAttrDiff{ Old: "", New: "4444", RequiresNew: true, @@ -2479,7 +2479,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "one": "false", "two": "true", @@ -2492,17 +2492,17 @@ func TestSchemaMap_Diff(t *testing.T) { "two": "0", }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "one": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "one": &opentf.ResourceAttrDiff{ Old: "false", New: "true", }, - "two": &terraform.ResourceAttrDiff{ + "two": &opentf.ResourceAttrDiff{ Old: "true", New: "false", }, - "three": &terraform.ResourceAttrDiff{ + "three": &opentf.ResourceAttrDiff{ Old: "true", New: "false", NewRemoved: true, @@ -2517,7 +2517,7 @@ func TestSchemaMap_Diff(t *testing.T) { Name: "tainted in state w/ no attr changes is still a replacement", Schema: map[string]*Schema{}, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "id": "someid", }, @@ -2526,8 +2526,8 @@ func TestSchemaMap_Diff(t *testing.T) { Config: map[string]interface{}{}, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{}, + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{}, DestroyTainted: true, }, @@ -2548,7 +2548,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "3", "ports.1": "1", @@ -2561,26 +2561,26 @@ func TestSchemaMap_Diff(t *testing.T) { "ports": []interface{}{5, 2, 1}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "3", New: "3", }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": &opentf.ResourceAttrDiff{ Old: "1", New: "1", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": &opentf.ResourceAttrDiff{ Old: "2", New: "2", }, - "ports.5": &terraform.ResourceAttrDiff{ + "ports.5": &opentf.ResourceAttrDiff{ Old: "", New: "5", RequiresNew: true, }, - "ports.4": &terraform.ResourceAttrDiff{ + "ports.4": &opentf.ResourceAttrDiff{ Old: "4", New: "0", NewRemoved: true, @@ -2600,7 +2600,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "description": "foo", }, @@ -2608,9 +2608,9 @@ func TestSchemaMap_Diff(t *testing.T) { Config: map[string]interface{}{}, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "description": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "description": &opentf.ResourceAttrDiff{ Old: "foo", New: "", RequiresNew: true, @@ -2634,15 +2634,15 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{}, + State: &opentf.InstanceState{}, Config: map[string]interface{}{ "foo": hcl2shim.UnknownVariableValue, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ Old: "", New: "false", NewComputed: true, @@ -2668,7 +2668,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "3", "ports.1": "1", @@ -2681,9 +2681,9 @@ func TestSchemaMap_Diff(t *testing.T) { "ports": []interface{}{hcl2shim.UnknownVariableValue, 2, 1}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "3", New: "", NewComputed: true, @@ -2706,7 +2706,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "config.#": "2", "config.0": "a", @@ -2718,9 +2718,9 @@ func TestSchemaMap_Diff(t *testing.T) { "config": []interface{}{hcl2shim.UnknownVariableValue, hcl2shim.UnknownVariableValue}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "config.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "config.#": &opentf.ResourceAttrDiff{ Old: "2", New: "", RequiresNew: true, @@ -2758,9 +2758,9 @@ func TestSchemaMap_Diff(t *testing.T) { return nil }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "bar", RequiresNew: true, @@ -2799,9 +2799,9 @@ func TestSchemaMap_Diff(t *testing.T) { return nil }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "bar", RequiresNew: true, @@ -2837,9 +2837,9 @@ func TestSchemaMap_Diff(t *testing.T) { return nil }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "bar", RequiresNew: true, @@ -2876,13 +2876,13 @@ func TestSchemaMap_Diff(t *testing.T) { return nil }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ami_id": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ami_id": &opentf.ResourceAttrDiff{ Old: "", New: "foo", }, - "instance_id": &terraform.ResourceAttrDiff{ + "instance_id": &opentf.ResourceAttrDiff{ Old: "", New: "bar", }, @@ -2906,7 +2906,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "ports.#": "3", "ports.1": "1", @@ -2929,26 +2929,26 @@ func TestSchemaMap_Diff(t *testing.T) { return nil }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "3", New: "3", }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": &opentf.ResourceAttrDiff{ Old: "1", New: "1", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": &opentf.ResourceAttrDiff{ Old: "2", New: "2", }, - "ports.5": &terraform.ResourceAttrDiff{ + "ports.5": &opentf.ResourceAttrDiff{ Old: "", New: "5", RequiresNew: true, }, - "ports.4": &terraform.ResourceAttrDiff{ + "ports.4": &opentf.ResourceAttrDiff{ Old: "4", New: "0", NewRemoved: true, @@ -2962,7 +2962,7 @@ func TestSchemaMap_Diff(t *testing.T) { Name: "tainted resource does not run CustomizeDiffFunc", Schema: map[string]*Schema{}, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "id": "someid", }, @@ -2975,8 +2975,8 @@ func TestSchemaMap_Diff(t *testing.T) { return errors.New("diff customization should not have run") }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{}, + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{}, DestroyTainted: true, }, @@ -2997,7 +2997,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "etag": "foo", "version_id": "1", @@ -3015,13 +3015,13 @@ func TestSchemaMap_Diff(t *testing.T) { return nil }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "etag": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "etag": &opentf.ResourceAttrDiff{ Old: "foo", New: "bar", }, - "version_id": &terraform.ResourceAttrDiff{ + "version_id": &opentf.ResourceAttrDiff{ Old: "1", New: "", NewComputed: true, @@ -3041,7 +3041,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "foo": "", }, @@ -3055,9 +3055,9 @@ func TestSchemaMap_Diff(t *testing.T) { return nil }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ NewComputed: true, }, }, @@ -3076,7 +3076,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "foo": "bar", }, @@ -3107,7 +3107,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "attr": "bar", }, @@ -3137,7 +3137,7 @@ func TestSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ Attributes: map[string]string{ "unrelated_set.#": "0", "stream_enabled": "true", @@ -3155,8 +3155,8 @@ func TestSchemaMap_Diff(t *testing.T) { } return nil }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ "stream_enabled": { Old: "true", New: "false", @@ -3168,7 +3168,7 @@ func TestSchemaMap_Diff(t *testing.T) { for i, tc := range cases { t.Run(fmt.Sprintf("%d-%s", i, tc.Name), func(t *testing.T) { - c := terraform.NewResourceConfigRaw(tc.Config) + c := opentf.NewResourceConfigRaw(tc.Config) d, err := schemaMap(tc.Schema).Diff(tc.State, c, tc.CustomizeDiff, nil, true) if err != nil != tc.Err { @@ -3328,10 +3328,10 @@ func TestSchemaMap_Input(t *testing.T) { tc.Config = make(map[string]interface{}) } - input := new(terraform.MockUIInput) + input := new(opentf.MockUIInput) input.InputReturnMap = tc.Input - rc := terraform.NewResourceConfigRaw(tc.Config) + rc := opentf.NewResourceConfigRaw(tc.Config) rc.Config = make(map[string]interface{}) actual, err := schemaMap(tc.Schema).Input(input, rc) @@ -3347,11 +3347,11 @@ func TestSchemaMap_Input(t *testing.T) { func TestSchemaMap_InputDefault(t *testing.T) { emptyConfig := make(map[string]interface{}) - rc := terraform.NewResourceConfigRaw(emptyConfig) + rc := opentf.NewResourceConfigRaw(emptyConfig) rc.Config = make(map[string]interface{}) - input := new(terraform.MockUIInput) - input.InputFn = func(opts *terraform.InputOpts) (string, error) { + input := new(opentf.MockUIInput) + input.InputFn = func(opts *opentf.InputOpts) (string, error) { t.Fatalf("InputFn should not be called on: %#v", opts) return "", nil } @@ -3377,11 +3377,11 @@ func TestSchemaMap_InputDefault(t *testing.T) { func TestSchemaMap_InputDeprecated(t *testing.T) { emptyConfig := make(map[string]interface{}) - rc := terraform.NewResourceConfigRaw(emptyConfig) + rc := opentf.NewResourceConfigRaw(emptyConfig) rc.Config = make(map[string]interface{}) - input := new(terraform.MockUIInput) - input.InputFn = func(opts *terraform.InputOpts) (string, error) { + input := new(opentf.MockUIInput) + input.InputFn = func(opts *opentf.InputOpts) (string, error) { t.Fatalf("InputFn should not be called on: %#v", opts) return "", nil } @@ -3820,9 +3820,9 @@ func TestSchemaMap_InternalValidate(t *testing.T) { func TestSchemaMap_DiffSuppress(t *testing.T) { cases := map[string]struct { Schema map[string]*Schema - State *terraform.InstanceState + State *opentf.InstanceState Config map[string]interface{} - ExpectedDiff *terraform.InstanceDiff + ExpectedDiff *opentf.InstanceDiff Err bool }{ "#0 - Suppress otherwise valid diff by returning true": { @@ -3866,8 +3866,8 @@ func TestSchemaMap_DiffSuppress(t *testing.T) { "availability_zone": "foo", }, - ExpectedDiff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ + ExpectedDiff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ "availability_zone": { Old: "", New: "foo", @@ -3915,8 +3915,8 @@ func TestSchemaMap_DiffSuppress(t *testing.T) { Config: map[string]interface{}{}, - ExpectedDiff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ + ExpectedDiff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ "availability_zone": { Old: "", New: "foo", @@ -3976,21 +3976,21 @@ func TestSchemaMap_DiffSuppress(t *testing.T) { }, }, - ExpectedDiff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "outer.#": &terraform.ResourceAttrDiff{ + ExpectedDiff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "outer.#": &opentf.ResourceAttrDiff{ Old: "0", New: "1", }, - "outer.~1.outer_str": &terraform.ResourceAttrDiff{ + "outer.~1.outer_str": &opentf.ResourceAttrDiff{ Old: "", New: "foo", }, - "outer.~1.inner.#": &terraform.ResourceAttrDiff{ + "outer.~1.inner.#": &opentf.ResourceAttrDiff{ Old: "0", New: "1", }, - "outer.~1.inner.~2.inner_str": &terraform.ResourceAttrDiff{ + "outer.~1.inner.~2.inner_str": &opentf.ResourceAttrDiff{ Old: "", New: hcl2shim.UnknownVariableValue, NewComputed: true, @@ -4047,21 +4047,21 @@ func TestSchemaMap_DiffSuppress(t *testing.T) { }, }, - ExpectedDiff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "outer.#": &terraform.ResourceAttrDiff{ + ExpectedDiff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "outer.#": &opentf.ResourceAttrDiff{ Old: "0", New: "1", }, - "outer.~1.outer_str": &terraform.ResourceAttrDiff{ + "outer.~1.outer_str": &opentf.ResourceAttrDiff{ Old: "", New: "foo", }, - "outer.~1.inner.#": &terraform.ResourceAttrDiff{ + "outer.~1.inner.#": &opentf.ResourceAttrDiff{ Old: "0", New: "1", }, - "outer.~1.inner.0.inner_str": &terraform.ResourceAttrDiff{ + "outer.~1.inner.0.inner_str": &opentf.ResourceAttrDiff{ Old: "", New: hcl2shim.UnknownVariableValue, NewComputed: true, @@ -4075,7 +4075,7 @@ func TestSchemaMap_DiffSuppress(t *testing.T) { for tn, tc := range cases { t.Run(tn, func(t *testing.T) { - c := terraform.NewResourceConfigRaw(tc.Config) + c := opentf.NewResourceConfigRaw(tc.Config) d, err := schemaMap(tc.Schema).Diff(tc.State, c, nil, nil, true) if err != nil != tc.Err { @@ -5329,7 +5329,7 @@ func TestSchemaMap_Validate(t *testing.T) { for tn, tc := range cases { t.Run(tn, func(t *testing.T) { - c := terraform.NewResourceConfigRaw(tc.Config) + c := opentf.NewResourceConfigRaw(tc.Config) ws, es := schemaMap(tc.Schema).Validate(c) if len(es) > 0 != tc.Err { @@ -5364,10 +5364,10 @@ func TestSchemaMap_Validate(t *testing.T) { func TestSchemaSet_ValidateMaxItems(t *testing.T) { cases := map[string]struct { Schema map[string]*Schema - State *terraform.InstanceState + State *opentf.InstanceState Config map[string]interface{} ConfigVariables map[string]string - Diff *terraform.InstanceDiff + Diff *opentf.InstanceDiff Err bool Errors []error }{ @@ -5426,7 +5426,7 @@ func TestSchemaSet_ValidateMaxItems(t *testing.T) { } for tn, tc := range cases { - c := terraform.NewResourceConfigRaw(tc.Config) + c := opentf.NewResourceConfigRaw(tc.Config) _, es := schemaMap(tc.Schema).Validate(c) if len(es) > 0 != tc.Err { @@ -5452,10 +5452,10 @@ func TestSchemaSet_ValidateMaxItems(t *testing.T) { func TestSchemaSet_ValidateMinItems(t *testing.T) { cases := map[string]struct { Schema map[string]*Schema - State *terraform.InstanceState + State *opentf.InstanceState Config map[string]interface{} ConfigVariables map[string]string - Diff *terraform.InstanceDiff + Diff *opentf.InstanceDiff Err bool Errors []error }{ @@ -5514,7 +5514,7 @@ func TestSchemaSet_ValidateMinItems(t *testing.T) { } for tn, tc := range cases { - c := terraform.NewResourceConfigRaw(tc.Config) + c := opentf.NewResourceConfigRaw(tc.Config) _, es := schemaMap(tc.Schema).Validate(c) if len(es) > 0 != tc.Err { diff --git a/internal/legacy/helper/schema/shims.go b/internal/legacy/helper/schema/shims.go index 82ad466a08..9318dd0c68 100644 --- a/internal/legacy/helper/schema/shims.go +++ b/internal/legacy/helper/schema/shims.go @@ -11,14 +11,14 @@ import ( "github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema" "github.com/placeholderplaceholderplaceholder/opentf/internal/configs/hcl2shim" - "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" ) // DiffFromValues takes the current state and desired state as cty.Values and -// derives a terraform.InstanceDiff to give to the legacy providers. This is +// derives a opentf.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) (*terraform.InstanceDiff, error) { +func DiffFromValues(prior, planned cty.Value, res *Resource) (*opentf.InstanceDiff, error) { return diffFromValues(prior, planned, res, nil) } @@ -26,7 +26,7 @@ func DiffFromValues(prior, planned cty.Value, res *Resource) (*terraform.Instanc // 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) (*terraform.InstanceDiff, error) { +func diffFromValues(prior, planned cty.Value, res *Resource, cust CustomizeDiffFunc) (*opentf.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 := terraform.NewResourceConfigShimmed(planned, configSchema) + cfg := opentf.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 terraform.InstanceDiff to +// ApplyDiff takes a cty.Value state and applies a opentf.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 *terraform.InstanceDiff, schema *configschema.Block) (cty.Value, error) { +func ApplyDiff(base cty.Value, d *opentf.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 terraform.InstanceState to a +// StateValueFromInstanceState converts a opentf.InstanceState to a // cty.Value as described by the provided cty.Type, and maintains the resource // ID as the "id" attribute. -func StateValueFromInstanceState(is *terraform.InstanceState, ty cty.Type) (cty.Value, error) { +func StateValueFromInstanceState(is *opentf.InstanceState, ty cty.Type) (cty.Value, error) { return is.AttrsAsObjectValue(ty) } diff --git a/internal/legacy/helper/schema/shims_test.go b/internal/legacy/helper/schema/shims_test.go index 59321775bf..c20bb9378e 100644 --- a/internal/legacy/helper/schema/shims_test.go +++ b/internal/legacy/helper/schema/shims_test.go @@ -17,7 +17,7 @@ import ( "github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema" "github.com/placeholderplaceholderplaceholder/opentf/internal/configs/hcl2shim" "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/helper/hashcode" - "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" "github.com/placeholderplaceholderplaceholder/opentf/internal/providers" "github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags" "github.com/zclconf/go-cty/cty" @@ -31,8 +31,8 @@ var ( func testApplyDiff(t *testing.T, resource *Resource, - state, expected *terraform.InstanceState, - diff *terraform.InstanceDiff) { + state, expected *opentf.InstanceState, + diff *opentf.InstanceDiff) { testSchema := providers.Schema{ Version: int64(resource.SchemaVersion), @@ -94,9 +94,9 @@ func TestShimResourcePlan_destroyCreate(t *testing.T) { }, } - d := &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + d := &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ RequiresNew: true, Old: "3", New: "42", @@ -104,11 +104,11 @@ func TestShimResourcePlan_destroyCreate(t *testing.T) { }, } - state := &terraform.InstanceState{ + state := &opentf.InstanceState{ Attributes: map[string]string{"foo": "3"}, } - expected := &terraform.InstanceState{ + expected := &opentf.InstanceState{ ID: hcl2shim.UnknownVariableValue, Attributes: map[string]string{ "id": hcl2shim.UnknownVariableValue, @@ -140,11 +140,11 @@ func TestShimResourceApply_create(t *testing.T) { return nil } - var s *terraform.InstanceState = nil + var s *opentf.InstanceState = nil - d := &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + d := &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ New: "42", }, }, @@ -159,7 +159,7 @@ func TestShimResourceApply_create(t *testing.T) { t.Fatal("not called") } - expected := &terraform.InstanceState{ + expected := &opentf.InstanceState{ ID: "foo", Attributes: map[string]string{ "id": "foo", @@ -178,7 +178,7 @@ func TestShimResourceApply_create(t *testing.T) { // now that we have our diff and desired state, see if we can reproduce // that with the shim // we're not testing Resource.Create, so we need to start with the "created" state - createdState := &terraform.InstanceState{ + createdState := &opentf.InstanceState{ ID: "foo", Attributes: map[string]string{"id": "foo"}, } @@ -209,11 +209,11 @@ func TestShimResourceApply_Timeout_state(t *testing.T) { return nil } - var s *terraform.InstanceState = nil + var s *opentf.InstanceState = nil - d := &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + d := &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ New: "42", }, }, @@ -238,7 +238,7 @@ func TestShimResourceApply_Timeout_state(t *testing.T) { t.Fatal("not called") } - expected := &terraform.InstanceState{ + expected := &opentf.InstanceState{ ID: "foo", Attributes: map[string]string{ "id": "foo", @@ -256,7 +256,7 @@ func TestShimResourceApply_Timeout_state(t *testing.T) { // Shim // we're not testing Resource.Create, so we need to start with the "created" state - createdState := &terraform.InstanceState{ + createdState := &opentf.InstanceState{ ID: "foo", Attributes: map[string]string{"id": "foo"}, } @@ -284,22 +284,22 @@ func TestShimResourceDiff_Timeout_diff(t *testing.T) { return nil } - conf := terraform.NewResourceConfigRaw(map[string]interface{}{ + conf := opentf.NewResourceConfigRaw(map[string]interface{}{ "foo": 42, TimeoutsConfigKey: map[string]interface{}{ "create": "2h", }, }) - var s *terraform.InstanceState + var s *opentf.InstanceState actual, err := r.Diff(s, conf, nil) if err != nil { t.Fatalf("err: %s", err) } - expected := &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + expected := &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ New: "42", }, }, @@ -327,7 +327,7 @@ func TestShimResourceDiff_Timeout_diff(t *testing.T) { } // we're not testing Resource.Create, so we need to start with the "created" state - createdState := &terraform.InstanceState{ + createdState := &opentf.InstanceState{ ID: "foo", Attributes: map[string]string{"id": "foo"}, } @@ -372,11 +372,11 @@ func TestShimResourceApply_destroy(t *testing.T) { return nil } - s := &terraform.InstanceState{ + s := &opentf.InstanceState{ ID: "bar", } - d := &terraform.InstanceDiff{ + d := &opentf.InstanceDiff{ Destroy: true, } @@ -426,7 +426,7 @@ func TestShimResourceApply_destroyCreate(t *testing.T) { return nil } - var s *terraform.InstanceState = &terraform.InstanceState{ + var s *opentf.InstanceState = &opentf.InstanceState{ ID: "bar", Attributes: map[string]string{ "foo": "7", @@ -434,17 +434,17 @@ func TestShimResourceApply_destroyCreate(t *testing.T) { }, } - d := &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "id": &terraform.ResourceAttrDiff{ + d := &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "id": &opentf.ResourceAttrDiff{ New: "foo", }, - "foo": &terraform.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ Old: "7", New: "42", RequiresNew: true, }, - "tags.Name": &terraform.ResourceAttrDiff{ + "tags.Name": &opentf.ResourceAttrDiff{ Old: "foo", New: "foo", RequiresNew: true, @@ -461,7 +461,7 @@ func TestShimResourceApply_destroyCreate(t *testing.T) { t.Fatal("should have change") } - expected := &terraform.InstanceState{ + expected := &opentf.InstanceState{ ID: "foo", Attributes: map[string]string{ "id": "foo", @@ -479,7 +479,7 @@ func TestShimResourceApply_destroyCreate(t *testing.T) { // now that we have our diff and desired state, see if we can reproduce // that with the shim // we're not testing Resource.Create, so we need to start with the "created" state - createdState := &terraform.InstanceState{ + createdState := &opentf.InstanceState{ ID: "foo", Attributes: map[string]string{ "id": "foo", @@ -496,10 +496,10 @@ func TestShimSchemaMap_Diff(t *testing.T) { cases := []struct { Name string Schema map[string]*Schema - State *terraform.InstanceState + State *opentf.InstanceState Config map[string]interface{} CustomizeDiff CustomizeDiffFunc - Diff *terraform.InstanceDiff + Diff *opentf.InstanceDiff Err bool }{ { @@ -519,9 +519,9 @@ func TestShimSchemaMap_Diff(t *testing.T) { "availability_zone": "foo", }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "foo", RequiresNew: true, @@ -547,9 +547,9 @@ func TestShimSchemaMap_Diff(t *testing.T) { Config: map[string]interface{}{}, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", NewComputed: true, RequiresNew: true, @@ -571,7 +571,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "foo", }, @@ -592,7 +592,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "availability_zone": "foo", @@ -603,9 +603,9 @@ func TestShimSchemaMap_Diff(t *testing.T) { "availability_zone": "bar", }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "foo", New: "bar", }, @@ -629,9 +629,9 @@ func TestShimSchemaMap_Diff(t *testing.T) { Config: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "foo", }, @@ -657,9 +657,9 @@ func TestShimSchemaMap_Diff(t *testing.T) { Config: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "foo", }, @@ -687,9 +687,9 @@ func TestShimSchemaMap_Diff(t *testing.T) { "availability_zone": "bar", }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "bar", }, @@ -718,9 +718,9 @@ func TestShimSchemaMap_Diff(t *testing.T) { "availability_zone": "foo", }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "foo!", NewExtra: "foo", @@ -749,9 +749,9 @@ func TestShimSchemaMap_Diff(t *testing.T) { Config: map[string]interface{}{}, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "", NewComputed: true, @@ -777,9 +777,9 @@ func TestShimSchemaMap_Diff(t *testing.T) { "availability_zone": hcl2shim.UnknownVariableValue, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: hcl2shim.UnknownVariableValue, NewComputed: true, @@ -807,9 +807,9 @@ func TestShimSchemaMap_Diff(t *testing.T) { "port": 27, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "port": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "port": &opentf.ResourceAttrDiff{ Old: "", New: "27", RequiresNew: true, @@ -837,9 +837,9 @@ func TestShimSchemaMap_Diff(t *testing.T) { "port": false, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "port": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "port": &opentf.ResourceAttrDiff{ Old: "", New: "false", RequiresNew: true, @@ -860,7 +860,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "delete": "false", @@ -890,21 +890,21 @@ func TestShimSchemaMap_Diff(t *testing.T) { "ports": []interface{}{1, 2, 5}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "0", New: "3", }, - "ports.0": &terraform.ResourceAttrDiff{ + "ports.0": &opentf.ResourceAttrDiff{ Old: "", New: "1", }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": &opentf.ResourceAttrDiff{ Old: "", New: "2", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": &opentf.ResourceAttrDiff{ Old: "", New: "5", }, @@ -931,13 +931,13 @@ func TestShimSchemaMap_Diff(t *testing.T) { "ports": []interface{}{"5"}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "0", New: "1", }, - "ports.0": &terraform.ResourceAttrDiff{ + "ports.0": &opentf.ResourceAttrDiff{ Old: "", New: "5", }, @@ -962,21 +962,21 @@ func TestShimSchemaMap_Diff(t *testing.T) { "ports": []interface{}{1, 2, 5}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "0", New: "3", }, - "ports.0": &terraform.ResourceAttrDiff{ + "ports.0": &opentf.ResourceAttrDiff{ Old: "", New: "1", }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": &opentf.ResourceAttrDiff{ Old: "", New: "2", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": &opentf.ResourceAttrDiff{ Old: "", New: "5", }, @@ -1001,9 +1001,9 @@ func TestShimSchemaMap_Diff(t *testing.T) { "ports": []interface{}{1, hcl2shim.UnknownVariableValue, "5"}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "0", New: "", NewComputed: true, @@ -1023,7 +1023,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "ports.#": "3", @@ -1052,7 +1052,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "ports.#": "2", @@ -1065,13 +1065,13 @@ func TestShimSchemaMap_Diff(t *testing.T) { "ports": []interface{}{1, 2, 5}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "2", New: "3", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": &opentf.ResourceAttrDiff{ Old: "", New: "5", }, @@ -1098,24 +1098,24 @@ func TestShimSchemaMap_Diff(t *testing.T) { "ports": []interface{}{1, 2, 5}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "0", New: "3", RequiresNew: true, }, - "ports.0": &terraform.ResourceAttrDiff{ + "ports.0": &opentf.ResourceAttrDiff{ Old: "", New: "1", RequiresNew: true, }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": &opentf.ResourceAttrDiff{ Old: "", New: "2", RequiresNew: true, }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": &opentf.ResourceAttrDiff{ Old: "", New: "5", RequiresNew: true, @@ -1141,9 +1141,9 @@ func TestShimSchemaMap_Diff(t *testing.T) { Config: map[string]interface{}{}, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "", NewComputed: true, }, @@ -1189,20 +1189,20 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "config.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "config.#": &opentf.ResourceAttrDiff{ Old: "0", New: "1", RequiresNew: true, }, - "config.0.name": &terraform.ResourceAttrDiff{ + "config.0.name": &opentf.ResourceAttrDiff{ Old: "", New: "hello", }, - "config.0.rules.#": &terraform.ResourceAttrDiff{ + "config.0.rules.#": &opentf.ResourceAttrDiff{ Old: "", NewComputed: true, }, @@ -1231,21 +1231,21 @@ func TestShimSchemaMap_Diff(t *testing.T) { "ports": []interface{}{5, 2, 1}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "0", New: "3", }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": &opentf.ResourceAttrDiff{ Old: "", New: "1", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": &opentf.ResourceAttrDiff{ Old: "", New: "2", }, - "ports.5": &terraform.ResourceAttrDiff{ + "ports.5": &opentf.ResourceAttrDiff{ Old: "", New: "5", }, @@ -1269,7 +1269,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "ports.#": "0", @@ -1301,9 +1301,9 @@ func TestShimSchemaMap_Diff(t *testing.T) { Config: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "", NewComputed: true, }, @@ -1332,21 +1332,21 @@ func TestShimSchemaMap_Diff(t *testing.T) { "ports": []interface{}{"2", "5", 1}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "0", New: "3", }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": &opentf.ResourceAttrDiff{ Old: "", New: "1", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": &opentf.ResourceAttrDiff{ Old: "", New: "2", }, - "ports.5": &terraform.ResourceAttrDiff{ + "ports.5": &opentf.ResourceAttrDiff{ Old: "", New: "5", }, @@ -1375,9 +1375,9 @@ func TestShimSchemaMap_Diff(t *testing.T) { "ports": []interface{}{1, hcl2shim.UnknownVariableValue, 5}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "", New: "", NewComputed: true, @@ -1401,7 +1401,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "ports.#": "2", @@ -1414,21 +1414,21 @@ func TestShimSchemaMap_Diff(t *testing.T) { "ports": []interface{}{5, 2, 1}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ Old: "2", New: "3", }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": &opentf.ResourceAttrDiff{ Old: "1", New: "1", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": &opentf.ResourceAttrDiff{ Old: "2", New: "2", }, - "ports.5": &terraform.ResourceAttrDiff{ + "ports.5": &opentf.ResourceAttrDiff{ Old: "", New: "5", }, @@ -1452,7 +1452,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "availability_zone": "bar", @@ -1495,7 +1495,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "ingress.#": "2", @@ -1549,13 +1549,13 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ingress.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ingress.#": &opentf.ResourceAttrDiff{ Old: "0", New: "1", }, - "ingress.0.from": &terraform.ResourceAttrDiff{ + "ingress.0.from": &opentf.ResourceAttrDiff{ Old: "", New: "8080", }, @@ -1580,7 +1580,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "availability_zone": "foo", @@ -1618,12 +1618,12 @@ func TestShimSchemaMap_Diff(t *testing.T) { "port": 80, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ NewComputed: true, }, - "port": &terraform.ResourceAttrDiff{ + "port": &opentf.ResourceAttrDiff{ New: "80", }, }, @@ -1647,7 +1647,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "port": "80", @@ -1680,14 +1680,14 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "config_vars.%": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "config_vars.%": &opentf.ResourceAttrDiff{ Old: "0", New: "1", }, - "config_vars.bar": &terraform.ResourceAttrDiff{ + "config_vars.bar": &opentf.ResourceAttrDiff{ Old: "", New: "baz", }, @@ -1705,7 +1705,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "config_vars.%": "1", @@ -1719,13 +1719,13 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "config_vars.foo": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "config_vars.foo": &opentf.ResourceAttrDiff{ Old: "bar", NewRemoved: true, }, - "config_vars.bar": &terraform.ResourceAttrDiff{ + "config_vars.bar": &opentf.ResourceAttrDiff{ Old: "", New: "baz", }, @@ -1745,7 +1745,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "vars.%": "1", @@ -1759,14 +1759,14 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "vars.foo": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "vars.foo": &opentf.ResourceAttrDiff{ Old: "bar", New: "", NewRemoved: true, }, - "vars.bar": &terraform.ResourceAttrDiff{ + "vars.bar": &opentf.ResourceAttrDiff{ Old: "", New: "baz", }, @@ -1785,7 +1785,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "vars.%": "1", @@ -1809,7 +1809,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "config_vars.#": "1", @@ -1826,13 +1826,13 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "config_vars.0.foo": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "config_vars.0.foo": &opentf.ResourceAttrDiff{ Old: "bar", NewRemoved: true, }, - "config_vars.0.bar": &terraform.ResourceAttrDiff{ + "config_vars.0.bar": &opentf.ResourceAttrDiff{ Old: "", New: "baz", }, @@ -1852,7 +1852,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "config_vars.#": "1", @@ -1864,21 +1864,21 @@ func TestShimSchemaMap_Diff(t *testing.T) { Config: map[string]interface{}{}, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "config_vars.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "config_vars.#": &opentf.ResourceAttrDiff{ Old: "1", New: "0", }, - "config_vars.0.%": &terraform.ResourceAttrDiff{ + "config_vars.0.%": &opentf.ResourceAttrDiff{ Old: "2", New: "0", }, - "config_vars.0.foo": &terraform.ResourceAttrDiff{ + "config_vars.0.foo": &opentf.ResourceAttrDiff{ Old: "bar", NewRemoved: true, }, - "config_vars.0.bar": &terraform.ResourceAttrDiff{ + "config_vars.0.bar": &opentf.ResourceAttrDiff{ Old: "baz", NewRemoved: true, }, @@ -1904,7 +1904,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "availability_zone": "bar", @@ -1916,9 +1916,9 @@ func TestShimSchemaMap_Diff(t *testing.T) { "availability_zone": "foo", }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "bar", New: "foo", RequiresNew: true, @@ -1949,7 +1949,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "availability_zone": "bar", @@ -1962,9 +1962,9 @@ func TestShimSchemaMap_Diff(t *testing.T) { "availability_zone": "foo", }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "bar", New: "foo", RequiresNew: true, @@ -1989,7 +1989,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "instances.#": "0", @@ -2000,9 +2000,9 @@ func TestShimSchemaMap_Diff(t *testing.T) { "instances": []interface{}{hcl2shim.UnknownVariableValue}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "instances.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "instances.#": &opentf.ResourceAttrDiff{ NewComputed: true, }, }, @@ -2048,17 +2048,17 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "route.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "route.#": &opentf.ResourceAttrDiff{ Old: "0", New: "1", }, - "route.~1.index": &terraform.ResourceAttrDiff{ + "route.~1.index": &opentf.ResourceAttrDiff{ Old: "", New: "1", }, - "route.~1.gateway": &terraform.ResourceAttrDiff{ + "route.~1.gateway": &opentf.ResourceAttrDiff{ Old: "", New: hcl2shim.UnknownVariableValue, NewComputed: true, @@ -2112,17 +2112,17 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "route.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "route.#": &opentf.ResourceAttrDiff{ Old: "0", New: "1", }, - "route.~1.index": &terraform.ResourceAttrDiff{ + "route.~1.index": &opentf.ResourceAttrDiff{ Old: "", New: "1", }, - "route.~1.gateway.#": &terraform.ResourceAttrDiff{ + "route.~1.gateway.#": &opentf.ResourceAttrDiff{ NewComputed: true, }, }, @@ -2144,9 +2144,9 @@ func TestShimSchemaMap_Diff(t *testing.T) { Config: nil, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "vars.%": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "vars.%": &opentf.ResourceAttrDiff{ Old: "", NewComputed: true, }, @@ -2165,7 +2165,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "vars.%": "0", @@ -2178,9 +2178,9 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "vars.%": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "vars.%": &opentf.ResourceAttrDiff{ Old: "", NewComputed: true, }, @@ -2194,7 +2194,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Name: "Empty", Schema: map[string]*Schema{}, - State: &terraform.InstanceState{}, + State: &opentf.InstanceState{}, Config: map[string]interface{}{}, @@ -2211,7 +2211,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "some_threshold": "567.8", @@ -2222,9 +2222,9 @@ func TestShimSchemaMap_Diff(t *testing.T) { "some_threshold": 12.34, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "some_threshold": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "some_threshold": &opentf.ResourceAttrDiff{ Old: "567.8", New: "12.34", }, @@ -2264,7 +2264,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "block_device.#": "2", @@ -2299,7 +2299,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "port": "false", @@ -2343,7 +2343,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "route.#": "0", @@ -2367,7 +2367,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "active": "true", @@ -2395,7 +2395,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "instances.#": "1", @@ -2405,14 +2405,14 @@ func TestShimSchemaMap_Diff(t *testing.T) { Config: map[string]interface{}{}, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "instances.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "instances.#": &opentf.ResourceAttrDiff{ Old: "1", New: "0", RequiresNew: true, }, - "instances.3": &terraform.ResourceAttrDiff{ + "instances.3": &opentf.ResourceAttrDiff{ Old: "foo", New: "", NewRemoved: true, @@ -2440,13 +2440,13 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "vars.%": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "vars.%": &opentf.ResourceAttrDiff{ Old: "0", New: "1", }, - "vars.foo": &terraform.ResourceAttrDiff{ + "vars.foo": &opentf.ResourceAttrDiff{ Old: "", New: "", }, @@ -2508,7 +2508,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "metadata_keys.#": "0", @@ -2533,7 +2533,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Config: nil, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "tags.%": "0", @@ -2582,17 +2582,17 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "route.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "route.#": &opentf.ResourceAttrDiff{ Old: "0", New: "1", }, - "route.1.index": &terraform.ResourceAttrDiff{ + "route.1.index": &opentf.ResourceAttrDiff{ Old: "", New: "1", }, - "route.1.gateway-name": &terraform.ResourceAttrDiff{ + "route.1.gateway-name": &opentf.ResourceAttrDiff{ Old: "", New: "hello", }, @@ -2644,19 +2644,19 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "service_account.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "service_account.#": &opentf.ResourceAttrDiff{ Old: "0", New: "1", RequiresNew: true, }, - "service_account.0.scopes.#": &terraform.ResourceAttrDiff{ + "service_account.0.scopes.#": &opentf.ResourceAttrDiff{ Old: "0", New: "1", RequiresNew: true, }, - "service_account.0.scopes.123": &terraform.ResourceAttrDiff{ + "service_account.0.scopes.123": &opentf.ResourceAttrDiff{ Old: "", New: "123!", NewExtra: "123", @@ -2682,7 +2682,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "instances.#": "2", @@ -2695,19 +2695,19 @@ func TestShimSchemaMap_Diff(t *testing.T) { "instances": []interface{}{"333", "4444"}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "instances.2": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "instances.2": &opentf.ResourceAttrDiff{ Old: "22", New: "", NewRemoved: true, RequiresNew: true, }, - "instances.3": &terraform.ResourceAttrDiff{ + "instances.3": &opentf.ResourceAttrDiff{ Old: "333", New: "333", }, - "instances.4": &terraform.ResourceAttrDiff{ + "instances.4": &opentf.ResourceAttrDiff{ Old: "", New: "4444", RequiresNew: true, @@ -2735,7 +2735,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "one": "false", @@ -2749,17 +2749,17 @@ func TestShimSchemaMap_Diff(t *testing.T) { "two": "0", }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "one": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "one": &opentf.ResourceAttrDiff{ Old: "false", New: "true", }, - "two": &terraform.ResourceAttrDiff{ + "two": &opentf.ResourceAttrDiff{ Old: "true", New: "false", }, - "three": &terraform.ResourceAttrDiff{ + "three": &opentf.ResourceAttrDiff{ Old: "true", New: "false", NewRemoved: true, @@ -2774,7 +2774,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Name: "tainted in state w/ no attr changes is still a replacement", Schema: map[string]*Schema{}, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "id": "someid", @@ -2784,8 +2784,8 @@ func TestShimSchemaMap_Diff(t *testing.T) { Config: map[string]interface{}{}, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{}, + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{}, DestroyTainted: true, }, }, @@ -2804,7 +2804,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "ports.#": "3", @@ -2818,22 +2818,22 @@ func TestShimSchemaMap_Diff(t *testing.T) { "ports": []interface{}{5, 2, 1}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.1": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.1": &opentf.ResourceAttrDiff{ Old: "1", New: "1", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": &opentf.ResourceAttrDiff{ Old: "2", New: "2", }, - "ports.5": &terraform.ResourceAttrDiff{ + "ports.5": &opentf.ResourceAttrDiff{ Old: "", New: "5", RequiresNew: true, }, - "ports.4": &terraform.ResourceAttrDiff{ + "ports.4": &opentf.ResourceAttrDiff{ Old: "4", New: "0", NewRemoved: true, @@ -2853,7 +2853,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "description": "foo", @@ -2862,9 +2862,9 @@ func TestShimSchemaMap_Diff(t *testing.T) { Config: map[string]interface{}{}, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "description": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "description": &opentf.ResourceAttrDiff{ Old: "foo", New: "", RequiresNew: true, @@ -2888,7 +2888,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", }, @@ -2896,9 +2896,9 @@ func TestShimSchemaMap_Diff(t *testing.T) { "foo": hcl2shim.UnknownVariableValue, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "foo": &opentf.ResourceAttrDiff{ Old: "", New: "false", NewComputed: true, @@ -2924,7 +2924,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "ports.#": "3", @@ -2938,9 +2938,9 @@ func TestShimSchemaMap_Diff(t *testing.T) { "ports": []interface{}{hcl2shim.UnknownVariableValue, 2, 1}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.#": &opentf.ResourceAttrDiff{ NewComputed: true, RequiresNew: true, }, @@ -2961,7 +2961,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "config.#": "2", @@ -2974,9 +2974,9 @@ func TestShimSchemaMap_Diff(t *testing.T) { "config": []interface{}{hcl2shim.UnknownVariableValue, hcl2shim.UnknownVariableValue}, }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "config.#": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "config.#": &opentf.ResourceAttrDiff{ Old: "2", New: "", RequiresNew: true, @@ -3014,9 +3014,9 @@ func TestShimSchemaMap_Diff(t *testing.T) { return nil }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "bar", RequiresNew: true, @@ -3055,9 +3055,9 @@ func TestShimSchemaMap_Diff(t *testing.T) { return nil }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "bar", RequiresNew: true, @@ -3093,9 +3093,9 @@ func TestShimSchemaMap_Diff(t *testing.T) { return nil }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "availability_zone": &opentf.ResourceAttrDiff{ Old: "", New: "bar", RequiresNew: true, @@ -3132,13 +3132,13 @@ func TestShimSchemaMap_Diff(t *testing.T) { return nil }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ami_id": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ami_id": &opentf.ResourceAttrDiff{ Old: "", New: "foo", }, - "instance_id": &terraform.ResourceAttrDiff{ + "instance_id": &opentf.ResourceAttrDiff{ Old: "", New: "bar", }, @@ -3162,7 +3162,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "ports.#": "3", @@ -3186,22 +3186,22 @@ func TestShimSchemaMap_Diff(t *testing.T) { return nil }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.1": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "ports.1": &opentf.ResourceAttrDiff{ Old: "1", New: "1", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": &opentf.ResourceAttrDiff{ Old: "2", New: "2", }, - "ports.5": &terraform.ResourceAttrDiff{ + "ports.5": &opentf.ResourceAttrDiff{ Old: "", New: "5", RequiresNew: true, }, - "ports.4": &terraform.ResourceAttrDiff{ + "ports.4": &opentf.ResourceAttrDiff{ Old: "4", New: "0", NewRemoved: true, @@ -3215,7 +3215,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Name: "tainted resource does not run CustomizeDiffFunc", Schema: map[string]*Schema{}, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "someid", Attributes: map[string]string{ "id": "someid", @@ -3229,8 +3229,8 @@ func TestShimSchemaMap_Diff(t *testing.T) { return errors.New("diff customization should not have run") }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{}, + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{}, DestroyTainted: true, }, @@ -3251,7 +3251,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "etag": "foo", @@ -3270,13 +3270,13 @@ func TestShimSchemaMap_Diff(t *testing.T) { return nil }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ - "etag": &terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ + "etag": &opentf.ResourceAttrDiff{ Old: "foo", New: "bar", }, - "version_id": &terraform.ResourceAttrDiff{ + "version_id": &opentf.ResourceAttrDiff{ Old: "1", New: "", NewComputed: true, @@ -3297,7 +3297,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "foo": "bar", @@ -3327,7 +3327,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "attr": "bar", @@ -3358,7 +3358,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { }, }, - State: &terraform.InstanceState{ + State: &opentf.InstanceState{ ID: "id", Attributes: map[string]string{ "unrelated_set.#": "0", @@ -3377,8 +3377,8 @@ func TestShimSchemaMap_Diff(t *testing.T) { } return nil }, - Diff: &terraform.InstanceDiff{ - Attributes: map[string]*terraform.ResourceAttrDiff{ + Diff: &opentf.InstanceDiff{ + Attributes: map[string]*opentf.ResourceAttrDiff{ "stream_enabled": { Old: "true", New: "false", @@ -3390,7 +3390,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { for i, tc := range cases { t.Run(fmt.Sprintf("%d-%s", i, tc.Name), func(t *testing.T) { - c := terraform.NewResourceConfigRaw(tc.Config) + c := opentf.NewResourceConfigRaw(tc.Config) { d, err := schemaMap(tc.Schema).Diff(tc.State, c, tc.CustomizeDiff, nil, false) @@ -3459,7 +3459,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { // expected value here for the test fixtures if tainted { if d == nil { - d = &terraform.InstanceDiff{} + d = &opentf.InstanceDiff{} } d.DestroyTainted = true } diff --git a/internal/legacy/helper/schema/testing.go b/internal/legacy/helper/schema/testing.go index fcea683706..bbcb315d6c 100644 --- a/internal/legacy/helper/schema/testing.go +++ b/internal/legacy/helper/schema/testing.go @@ -6,7 +6,7 @@ package schema import ( "testing" - "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/terraform" + "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf" ) // 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 := terraform.NewResourceConfigRaw(raw) + c := opentf.NewResourceConfigRaw(raw) sm := schemaMap(schema) diff, err := sm.Diff(nil, c, nil, nil, true) diff --git a/internal/legacy/terraform/context_components.go b/internal/legacy/opentf/context_components.go similarity index 99% rename from internal/legacy/terraform/context_components.go rename to internal/legacy/opentf/context_components.go index 680cf80892..750b2ff769 100644 --- a/internal/legacy/terraform/context_components.go +++ b/internal/legacy/opentf/context_components.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import ( "fmt" diff --git a/internal/legacy/terraform/diff.go b/internal/legacy/opentf/diff.go similarity index 99% rename from internal/legacy/terraform/diff.go rename to internal/legacy/opentf/diff.go index 1ea99e7dc5..45bf817dbe 100644 --- a/internal/legacy/terraform/diff.go +++ b/internal/legacy/opentf/diff.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import ( "bufio" diff --git a/internal/legacy/terraform/diff_test.go b/internal/legacy/opentf/diff_test.go similarity index 99% rename from internal/legacy/terraform/diff_test.go rename to internal/legacy/opentf/diff_test.go index da0939c113..81c0541636 100644 --- a/internal/legacy/terraform/diff_test.go +++ b/internal/legacy/opentf/diff_test.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import ( "fmt" diff --git a/internal/legacy/terraform/features.go b/internal/legacy/opentf/features.go similarity index 92% rename from internal/legacy/terraform/features.go rename to internal/legacy/opentf/features.go index 62c43afca0..be09590698 100644 --- a/internal/legacy/terraform/features.go +++ b/internal/legacy/opentf/features.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import "os" diff --git a/internal/legacy/terraform/instancetype.go b/internal/legacy/opentf/instancetype.go similarity index 95% rename from internal/legacy/terraform/instancetype.go rename to internal/legacy/opentf/instancetype.go index 8bb3e73bb8..9e338492ac 100644 --- a/internal/legacy/terraform/instancetype.go +++ b/internal/legacy/opentf/instancetype.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf //go:generate go run golang.org/x/tools/cmd/stringer -type=InstanceType instancetype.go diff --git a/internal/legacy/terraform/instancetype_string.go b/internal/legacy/opentf/instancetype_string.go similarity index 97% rename from internal/legacy/terraform/instancetype_string.go rename to internal/legacy/opentf/instancetype_string.go index 95b7a9802e..bce90a5186 100644 --- a/internal/legacy/terraform/instancetype_string.go +++ b/internal/legacy/opentf/instancetype_string.go @@ -1,6 +1,6 @@ // Code generated by "stringer -type=InstanceType instancetype.go"; DO NOT EDIT. -package terraform +package opentf import "strconv" diff --git a/internal/legacy/terraform/provider_mock.go b/internal/legacy/opentf/provider_mock.go similarity index 99% rename from internal/legacy/terraform/provider_mock.go rename to internal/legacy/opentf/provider_mock.go index c5e294dec7..6add4aeb39 100644 --- a/internal/legacy/terraform/provider_mock.go +++ b/internal/legacy/opentf/provider_mock.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import ( "encoding/json" diff --git a/internal/legacy/terraform/provisioner_mock.go b/internal/legacy/opentf/provisioner_mock.go similarity index 99% rename from internal/legacy/terraform/provisioner_mock.go rename to internal/legacy/opentf/provisioner_mock.go index f3130e46fc..c27a900ef1 100644 --- a/internal/legacy/terraform/provisioner_mock.go +++ b/internal/legacy/opentf/provisioner_mock.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import ( "sync" diff --git a/internal/legacy/terraform/resource.go b/internal/legacy/opentf/resource.go similarity index 99% rename from internal/legacy/terraform/resource.go rename to internal/legacy/opentf/resource.go index 08866a40d3..e2007b52cd 100644 --- a/internal/legacy/terraform/resource.go +++ b/internal/legacy/opentf/resource.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import ( "fmt" diff --git a/internal/legacy/terraform/resource_address.go b/internal/legacy/opentf/resource_address.go similarity index 99% rename from internal/legacy/terraform/resource_address.go rename to internal/legacy/opentf/resource_address.go index 2e2c7866e7..76a8e8cd95 100644 --- a/internal/legacy/terraform/resource_address.go +++ b/internal/legacy/opentf/resource_address.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import ( "fmt" diff --git a/internal/legacy/terraform/resource_address_test.go b/internal/legacy/opentf/resource_address_test.go similarity index 99% rename from internal/legacy/terraform/resource_address_test.go rename to internal/legacy/opentf/resource_address_test.go index 3de1614ce2..820ba7a296 100644 --- a/internal/legacy/terraform/resource_address_test.go +++ b/internal/legacy/opentf/resource_address_test.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import ( "fmt" diff --git a/internal/legacy/terraform/resource_mode.go b/internal/legacy/opentf/resource_mode.go similarity index 95% rename from internal/legacy/terraform/resource_mode.go rename to internal/legacy/opentf/resource_mode.go index 7153a9da12..4e35da730f 100644 --- a/internal/legacy/terraform/resource_mode.go +++ b/internal/legacy/opentf/resource_mode.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf //go:generate go run golang.org/x/tools/cmd/stringer -type=ResourceMode -output=resource_mode_string.go resource_mode.go diff --git a/internal/legacy/terraform/resource_mode_string.go b/internal/legacy/opentf/resource_mode_string.go similarity index 97% rename from internal/legacy/terraform/resource_mode_string.go rename to internal/legacy/opentf/resource_mode_string.go index ba84346a21..3a6fd95e1f 100644 --- a/internal/legacy/terraform/resource_mode_string.go +++ b/internal/legacy/opentf/resource_mode_string.go @@ -1,6 +1,6 @@ // Code generated by "stringer -type=ResourceMode -output=resource_mode_string.go resource_mode.go"; DO NOT EDIT. -package terraform +package opentf import "strconv" diff --git a/internal/legacy/terraform/resource_provider.go b/internal/legacy/opentf/resource_provider.go similarity index 99% rename from internal/legacy/terraform/resource_provider.go rename to internal/legacy/opentf/resource_provider.go index 9f4e6f44a4..9408034bca 100644 --- a/internal/legacy/terraform/resource_provider.go +++ b/internal/legacy/opentf/resource_provider.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf // ResourceProvider is a legacy interface for providers. // diff --git a/internal/legacy/terraform/resource_provider_mock.go b/internal/legacy/opentf/resource_provider_mock.go similarity index 99% rename from internal/legacy/terraform/resource_provider_mock.go rename to internal/legacy/opentf/resource_provider_mock.go index c026be4e7d..3a5db11f3b 100644 --- a/internal/legacy/terraform/resource_provider_mock.go +++ b/internal/legacy/opentf/resource_provider_mock.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import ( "sync" diff --git a/internal/legacy/terraform/resource_provisioner.go b/internal/legacy/opentf/resource_provisioner.go similarity index 99% rename from internal/legacy/terraform/resource_provisioner.go rename to internal/legacy/opentf/resource_provisioner.go index 0f58de9f61..6b466ff41b 100644 --- a/internal/legacy/terraform/resource_provisioner.go +++ b/internal/legacy/opentf/resource_provisioner.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import ( "github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema" diff --git a/internal/legacy/terraform/resource_provisioner_mock.go b/internal/legacy/opentf/resource_provisioner_mock.go similarity index 99% rename from internal/legacy/terraform/resource_provisioner_mock.go rename to internal/legacy/opentf/resource_provisioner_mock.go index 495618815a..41d989294a 100644 --- a/internal/legacy/terraform/resource_provisioner_mock.go +++ b/internal/legacy/opentf/resource_provisioner_mock.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import ( "sync" diff --git a/internal/legacy/terraform/resource_test.go b/internal/legacy/opentf/resource_test.go similarity index 99% rename from internal/legacy/terraform/resource_test.go rename to internal/legacy/opentf/resource_test.go index d62850dfec..fb5f44fda3 100644 --- a/internal/legacy/terraform/resource_test.go +++ b/internal/legacy/opentf/resource_test.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import ( "fmt" diff --git a/internal/legacy/terraform/schemas.go b/internal/legacy/opentf/schemas.go similarity index 99% rename from internal/legacy/terraform/schemas.go rename to internal/legacy/opentf/schemas.go index d77b7b95bb..97df93793b 100644 --- a/internal/legacy/terraform/schemas.go +++ b/internal/legacy/opentf/schemas.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import ( "fmt" diff --git a/internal/legacy/terraform/state.go b/internal/legacy/opentf/state.go similarity index 99% rename from internal/legacy/terraform/state.go rename to internal/legacy/opentf/state.go index fe931d66ea..68530242da 100644 --- a/internal/legacy/terraform/state.go +++ b/internal/legacy/opentf/state.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import ( "bufio" diff --git a/internal/legacy/terraform/state_filter.go b/internal/legacy/opentf/state_filter.go similarity index 99% rename from internal/legacy/terraform/state_filter.go rename to internal/legacy/opentf/state_filter.go index b605bf075f..152e1b4740 100644 --- a/internal/legacy/terraform/state_filter.go +++ b/internal/legacy/opentf/state_filter.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import ( "fmt" diff --git a/internal/legacy/terraform/state_test.go b/internal/legacy/opentf/state_test.go similarity index 99% rename from internal/legacy/terraform/state_test.go rename to internal/legacy/opentf/state_test.go index 30e0b84332..682e52896b 100644 --- a/internal/legacy/terraform/state_test.go +++ b/internal/legacy/opentf/state_test.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import ( "bytes" diff --git a/internal/legacy/terraform/state_upgrade_v1_to_v2.go b/internal/legacy/opentf/state_upgrade_v1_to_v2.go similarity index 99% rename from internal/legacy/terraform/state_upgrade_v1_to_v2.go rename to internal/legacy/opentf/state_upgrade_v1_to_v2.go index 757a3d0f29..75ce7cc9c0 100644 --- a/internal/legacy/terraform/state_upgrade_v1_to_v2.go +++ b/internal/legacy/opentf/state_upgrade_v1_to_v2.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import ( "fmt" diff --git a/internal/legacy/terraform/state_upgrade_v2_to_v3.go b/internal/legacy/opentf/state_upgrade_v2_to_v3.go similarity index 99% rename from internal/legacy/terraform/state_upgrade_v2_to_v3.go rename to internal/legacy/opentf/state_upgrade_v2_to_v3.go index ead9b61c84..868fb0e28c 100644 --- a/internal/legacy/terraform/state_upgrade_v2_to_v3.go +++ b/internal/legacy/opentf/state_upgrade_v2_to_v3.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import ( "fmt" diff --git a/internal/legacy/terraform/state_v1.go b/internal/legacy/opentf/state_v1.go similarity index 99% rename from internal/legacy/terraform/state_v1.go rename to internal/legacy/opentf/state_v1.go index d2257660d3..fc21c208d3 100644 --- a/internal/legacy/terraform/state_v1.go +++ b/internal/legacy/opentf/state_v1.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf // 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 diff --git a/internal/legacy/terraform/testing.go b/internal/legacy/opentf/testing.go similarity index 95% rename from internal/legacy/terraform/testing.go rename to internal/legacy/opentf/testing.go index a1337a82ec..6ed8e5bdf7 100644 --- a/internal/legacy/terraform/testing.go +++ b/internal/legacy/opentf/testing.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import ( "os" diff --git a/internal/legacy/terraform/ui_input.go b/internal/legacy/opentf/ui_input.go similarity index 98% rename from internal/legacy/terraform/ui_input.go rename to internal/legacy/opentf/ui_input.go index 4c59177f30..a1a033248b 100644 --- a/internal/legacy/terraform/ui_input.go +++ b/internal/legacy/opentf/ui_input.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import "context" diff --git a/internal/legacy/terraform/ui_input_mock.go b/internal/legacy/opentf/ui_input_mock.go similarity index 97% rename from internal/legacy/terraform/ui_input_mock.go rename to internal/legacy/opentf/ui_input_mock.go index 4d8e028fbb..3c25109246 100644 --- a/internal/legacy/terraform/ui_input_mock.go +++ b/internal/legacy/opentf/ui_input_mock.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import "context" diff --git a/internal/legacy/terraform/ui_input_prefix.go b/internal/legacy/opentf/ui_input_prefix.go similarity index 96% rename from internal/legacy/terraform/ui_input_prefix.go rename to internal/legacy/opentf/ui_input_prefix.go index 69a7032dd9..368a98d2bc 100644 --- a/internal/legacy/terraform/ui_input_prefix.go +++ b/internal/legacy/opentf/ui_input_prefix.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import ( "context" diff --git a/internal/legacy/terraform/ui_input_prefix_test.go b/internal/legacy/opentf/ui_input_prefix_test.go similarity index 96% rename from internal/legacy/terraform/ui_input_prefix_test.go rename to internal/legacy/opentf/ui_input_prefix_test.go index d6a83ac329..200522fffc 100644 --- a/internal/legacy/terraform/ui_input_prefix_test.go +++ b/internal/legacy/opentf/ui_input_prefix_test.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import ( "context" diff --git a/internal/legacy/terraform/ui_output.go b/internal/legacy/opentf/ui_output.go similarity index 91% rename from internal/legacy/terraform/ui_output.go rename to internal/legacy/opentf/ui_output.go index a816b0d89e..796de2fa0d 100644 --- a/internal/legacy/terraform/ui_output.go +++ b/internal/legacy/opentf/ui_output.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf // UIOutput is the interface that must be implemented to output // data to the end user. diff --git a/internal/legacy/terraform/ui_output_callback.go b/internal/legacy/opentf/ui_output_callback.go similarity index 91% rename from internal/legacy/terraform/ui_output_callback.go rename to internal/legacy/opentf/ui_output_callback.go index e79f082b0d..ed55a539c3 100644 --- a/internal/legacy/terraform/ui_output_callback.go +++ b/internal/legacy/opentf/ui_output_callback.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf type CallbackUIOutput struct { OutputFn func(string) diff --git a/internal/legacy/terraform/ui_output_callback_test.go b/internal/legacy/opentf/ui_output_callback_test.go similarity index 91% rename from internal/legacy/terraform/ui_output_callback_test.go rename to internal/legacy/opentf/ui_output_callback_test.go index 8748c0b7d6..de46218a72 100644 --- a/internal/legacy/terraform/ui_output_callback_test.go +++ b/internal/legacy/opentf/ui_output_callback_test.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import ( "testing" diff --git a/internal/legacy/terraform/ui_output_mock.go b/internal/legacy/opentf/ui_output_mock.go similarity index 96% rename from internal/legacy/terraform/ui_output_mock.go rename to internal/legacy/opentf/ui_output_mock.go index 641d076df8..ea43300a87 100644 --- a/internal/legacy/terraform/ui_output_mock.go +++ b/internal/legacy/opentf/ui_output_mock.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import "sync" diff --git a/internal/legacy/terraform/ui_output_mock_test.go b/internal/legacy/opentf/ui_output_mock_test.go similarity index 90% rename from internal/legacy/terraform/ui_output_mock_test.go rename to internal/legacy/opentf/ui_output_mock_test.go index 89d564a082..76eec4bb3c 100644 --- a/internal/legacy/terraform/ui_output_mock_test.go +++ b/internal/legacy/opentf/ui_output_mock_test.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import ( "testing" diff --git a/internal/legacy/terraform/upgrade_state_v1_test.go b/internal/legacy/opentf/upgrade_state_v1_test.go similarity index 99% rename from internal/legacy/terraform/upgrade_state_v1_test.go rename to internal/legacy/opentf/upgrade_state_v1_test.go index fd46aa9204..6f0c81c43a 100644 --- a/internal/legacy/terraform/upgrade_state_v1_test.go +++ b/internal/legacy/opentf/upgrade_state_v1_test.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import ( "bytes" diff --git a/internal/legacy/terraform/upgrade_state_v2_test.go b/internal/legacy/opentf/upgrade_state_v2_test.go similarity index 99% rename from internal/legacy/terraform/upgrade_state_v2_test.go rename to internal/legacy/opentf/upgrade_state_v2_test.go index 68658ca940..ef43dc79bf 100644 --- a/internal/legacy/terraform/upgrade_state_v2_test.go +++ b/internal/legacy/opentf/upgrade_state_v2_test.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import ( "bytes" diff --git a/internal/legacy/terraform/util.go b/internal/legacy/opentf/util.go similarity index 98% rename from internal/legacy/terraform/util.go rename to internal/legacy/opentf/util.go index d25e105406..019ccc9019 100644 --- a/internal/legacy/terraform/util.go +++ b/internal/legacy/opentf/util.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import ( "sort" diff --git a/internal/legacy/terraform/util_test.go b/internal/legacy/opentf/util_test.go similarity index 98% rename from internal/legacy/terraform/util_test.go rename to internal/legacy/opentf/util_test.go index 0676c6f7a4..75fab9c43f 100644 --- a/internal/legacy/terraform/util_test.go +++ b/internal/legacy/opentf/util_test.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import ( "fmt" diff --git a/internal/legacy/terraform/version.go b/internal/legacy/opentf/version.go similarity index 93% rename from internal/legacy/terraform/version.go rename to internal/legacy/opentf/version.go index da99aa2a04..1edd8aba86 100644 --- a/internal/legacy/terraform/version.go +++ b/internal/legacy/opentf/version.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package terraform +package opentf import ( "github.com/placeholderplaceholderplaceholder/opentf/version"