mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Rename internal/legacy/terraform to internal/legacy/opentf
This commit is contained in:
parent
816c801fb2
commit
19239936a4
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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{} {
|
||||
|
@ -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,
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
|
@ -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",
|
||||
},
|
||||
|
@ -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,
|
||||
},
|
||||
},
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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"+
|
||||
|
@ -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,
|
||||
},
|
||||
}
|
||||
|
@ -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{})
|
||||
|
@ -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()
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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,
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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",
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
},
|
||||
|
@ -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 {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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)
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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)
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import (
|
||||
"bufio"
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import "os"
|
||||
|
@ -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
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Code generated by "stringer -type=InstanceType instancetype.go"; DO NOT EDIT.
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import "strconv"
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import (
|
||||
"encoding/json"
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import (
|
||||
"sync"
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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.
|
||||
//
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import (
|
||||
"sync"
|
@ -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"
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import (
|
||||
"sync"
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import (
|
||||
"bufio"
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import (
|
||||
"bytes"
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -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
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import (
|
||||
"os"
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import "context"
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import "context"
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import (
|
||||
"context"
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import (
|
||||
"context"
|
@ -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.
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
type CallbackUIOutput struct {
|
||||
OutputFn func(string)
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import (
|
||||
"testing"
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import "sync"
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import (
|
||||
"testing"
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import (
|
||||
"bytes"
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import (
|
||||
"bytes"
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import (
|
||||
"sort"
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package terraform
|
||||
package opentf
|
||||
|
||||
import (
|
||||
"github.com/placeholderplaceholderplaceholder/opentf/version"
|
Loading…
Reference in New Issue
Block a user