Replace internal/terraform -> internal/opentf

This commit is contained in:
RLRabinowitz
2023-08-27 17:51:49 +03:00
parent 12e8eeaa09
commit 42e7c5b25c
828 changed files with 753 additions and 753 deletions

View File

@@ -27,7 +27,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans/planfile"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
"github.com/zclconf/go-cty/cty"
)
@@ -174,7 +174,7 @@ type Local interface {
// calculate from an Operation object, which we can then use for local
// operations.
//
// The operation methods on terraform.Context (Plan, Apply, Import, etc) each
// The operation methods on opentf.Context (Plan, Apply, Import, etc) each
// generate new artifacts which supersede parts of the LocalRun object that
// started the operation, so callers should be careful to use those subsequent
// artifacts instead of the fields of LocalRun where appropriate. The LocalRun
@@ -190,7 +190,7 @@ type Local interface {
type LocalRun struct {
// Core is an already-initialized OpenTF Core context, ready to be
// used to run operations such as Plan and Apply.
Core *terraform.Context
Core *opentf.Context
// Config is the configuration we're working with, which typically comes
// from either config files directly on local disk (when we're creating
@@ -208,7 +208,7 @@ type LocalRun struct {
//
// This is nil when we're applying a saved plan, because the plan itself
// contains enough information about its options to apply it.
PlanOpts *terraform.PlanOpts
PlanOpts *opentf.PlanOpts
// Plan is a plan loaded from a saved plan file, if our operation is to
// apply that saved plan.
@@ -266,7 +266,7 @@ type Operation struct {
// Hooks can be used to perform actions triggered by various events during
// the operation's lifecycle.
Hooks []terraform.Hook
Hooks []opentf.Hook
// Plan is a plan that was passed as an argument. This is valid for
// plan and apply arguments but may not work for all backends.
@@ -294,8 +294,8 @@ type Operation struct {
View views.Operation
// Input/output/control options.
UIIn terraform.UIInput
UIOut terraform.UIOutput
UIIn opentf.UIInput
UIOut opentf.UIOutput
// StateLocker is used to lock the state while providing UI feedback to the
// user. This will be replaced by the Backend to update the context.

View File

@@ -8,7 +8,7 @@ import (
"github.com/mitchellh/colorstring"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
)
// CLI is an optional interface that can be implemented to be initialized
@@ -73,7 +73,7 @@ type CLIOpts struct {
// ContextOpts are the base context options to set when initializing a
// OpenTF context. Many of these will be overridden or merged by
// Operation. See Operation for more details.
ContextOpts *terraform.ContextOpts
ContextOpts *opentf.ContextOpts
// Input will ask for necessary input prior to performing any operations.
//

View File

@@ -19,7 +19,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema"
"github.com/placeholderplaceholderplaceholder/opentf/internal/logging"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
"github.com/zclconf/go-cty/cty"
)
@@ -68,7 +68,7 @@ type Local struct {
// OpenTF context. Many of these will be overridden or merged by
// Operation. See Operation for more details.
ContextOpts *terraform.ContextOpts
ContextOpts *opentf.ContextOpts
// OpInput will ask for necessary input prior to performing any operations.
//
@@ -270,7 +270,7 @@ func (b *Local) StateMgr(name string) (statemgr.Full, error) {
// Operation implements backend.Enhanced
//
// This will initialize an in-memory terraform.Context to perform the
// This will initialize an in-memory opentf.Context to perform the
// operation within this process.
//
// The given operation parameter will be merged with the ContextOpts on
@@ -340,7 +340,7 @@ func (b *Local) opWait(
doneCh <-chan struct{},
stopCtx context.Context,
cancelCtx context.Context,
tfCtx *terraform.Context,
tfCtx *opentf.Context,
opStateMgr statemgr.Persister,
view views.Operation) (canceled bool) {
// Wait for the operation to finish or for us to be interrupted so

View File

@@ -18,7 +18,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
@@ -163,7 +163,7 @@ func (b *Local) opApply(
diags = nil // reset so we won't show the same diagnostics again later
}
v, err := op.UIIn.Input(stopCtx, &terraform.InputOpts{
v, err := op.UIIn.Input(stopCtx, &opentf.InputOpts{
Id: "approve",
Query: "\n" + query,
Description: desc,

View File

@@ -15,7 +15,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configload"
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans/planfile"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
"github.com/zclconf/go-cty/cty"
)
@@ -68,7 +68,7 @@ func (b *Local) localRun(op *backend.Operation) (*backend.LocalRun, *configload.
ret := &backend.LocalRun{}
// Initialize our context options
var coreOpts terraform.ContextOpts
var coreOpts opentf.ContextOpts
if v := b.ContextOpts; v != nil {
coreOpts = *v
}
@@ -115,7 +115,7 @@ func (b *Local) localRun(op *backend.Operation) (*backend.LocalRun, *configload.
if op.Type != backend.OperationTypeInvalid {
// If input asking is enabled, then do that
if op.PlanFile == nil && b.OpInput {
mode := terraform.InputModeProvider
mode := opentf.InputModeProvider
log.Printf("[TRACE] backend/local: requesting interactive input, if necessary")
inputDiags := ret.Core.Input(ret.Config, mode)
@@ -136,7 +136,7 @@ func (b *Local) localRun(op *backend.Operation) (*backend.LocalRun, *configload.
return ret, configSnap, s, diags
}
func (b *Local) localRunDirect(op *backend.Operation, run *backend.LocalRun, coreOpts *terraform.ContextOpts, s statemgr.Full) (*backend.LocalRun, *configload.Snapshot, tfdiags.Diagnostics) {
func (b *Local) localRunDirect(op *backend.Operation, run *backend.LocalRun, coreOpts *opentf.ContextOpts, s statemgr.Full) (*backend.LocalRun, *configload.Snapshot, tfdiags.Diagnostics) {
var diags tfdiags.Diagnostics
// Load the configuration using the caller-provided configuration loader.
@@ -194,7 +194,7 @@ func (b *Local) localRunDirect(op *backend.Operation, run *backend.LocalRun, cor
return nil, nil, diags
}
planOpts := &terraform.PlanOpts{
planOpts := &opentf.PlanOpts{
Mode: op.PlanMode,
Targets: op.Targets,
ForceReplace: op.ForceReplace,
@@ -208,7 +208,7 @@ func (b *Local) localRunDirect(op *backend.Operation, run *backend.LocalRun, cor
// snapshot, from the previous run.
run.InputState = s.State()
tfCtx, moreDiags := terraform.NewContext(coreOpts)
tfCtx, moreDiags := opentf.NewContext(coreOpts)
diags = diags.Append(moreDiags)
if moreDiags.HasErrors() {
return nil, nil, diags
@@ -217,7 +217,7 @@ func (b *Local) localRunDirect(op *backend.Operation, run *backend.LocalRun, cor
return run, configSnap, diags
}
func (b *Local) localRunForPlanFile(op *backend.Operation, pf *planfile.Reader, run *backend.LocalRun, coreOpts *terraform.ContextOpts, currentStateMeta *statemgr.SnapshotMeta) (*backend.LocalRun, *configload.Snapshot, tfdiags.Diagnostics) {
func (b *Local) localRunForPlanFile(op *backend.Operation, pf *planfile.Reader, run *backend.LocalRun, coreOpts *opentf.ContextOpts, currentStateMeta *statemgr.SnapshotMeta) (*backend.LocalRun, *configload.Snapshot, tfdiags.Diagnostics) {
var diags tfdiags.Diagnostics
const errSummary = "Invalid plan file"
@@ -342,7 +342,7 @@ func (b *Local) localRunForPlanFile(op *backend.Operation, pf *planfile.Reader,
// we need to apply the plan.
run.Plan = plan
tfCtx, moreDiags := terraform.NewContext(coreOpts)
tfCtx, moreDiags := opentf.NewContext(coreOpts)
diags = diags.Append(moreDiags)
if moreDiags.HasErrors() {
return nil, nil, diags
@@ -371,7 +371,7 @@ func (b *Local) localRunForPlanFile(op *backend.Operation, pf *planfile.Reader,
// messages that variables are not set rather than reporting that input failed:
// the primary resolution to missing variables is to provide them by some other
// means.
func (b *Local) interactiveCollectVariables(ctx context.Context, existing map[string]backend.UnparsedVariableValue, vcs map[string]*configs.Variable, uiInput terraform.UIInput) map[string]backend.UnparsedVariableValue {
func (b *Local) interactiveCollectVariables(ctx context.Context, existing map[string]backend.UnparsedVariableValue, vcs map[string]*configs.Variable, uiInput opentf.UIInput) map[string]backend.UnparsedVariableValue {
var needed []string
if b.OpInput && uiInput != nil {
for name, vc := range vcs {
@@ -400,7 +400,7 @@ func (b *Local) interactiveCollectVariables(ctx context.Context, existing map[st
}
for _, name := range needed {
vc := vcs[name]
rawValue, err := uiInput.Input(ctx, &terraform.InputOpts{
rawValue, err := uiInput.Input(ctx, &opentf.InputOpts{
Id: fmt.Sprintf("var.%s", name),
Query: fmt.Sprintf("var.%s", name),
Description: vc.Description,
@@ -478,16 +478,16 @@ type unparsedInteractiveVariableValue struct {
var _ backend.UnparsedVariableValue = unparsedInteractiveVariableValue{}
func (v unparsedInteractiveVariableValue) ParseVariableValue(mode configs.VariableParsingMode) (*terraform.InputValue, tfdiags.Diagnostics) {
func (v unparsedInteractiveVariableValue) ParseVariableValue(mode configs.VariableParsingMode) (*opentf.InputValue, tfdiags.Diagnostics) {
var diags tfdiags.Diagnostics
val, valDiags := mode.Parse(v.Name, v.RawValue)
diags = diags.Append(valDiags)
if diags.HasErrors() {
return nil, diags
}
return &terraform.InputValue{
return &opentf.InputValue{
Value: val,
SourceType: terraform.ValueFromInput,
SourceType: opentf.ValueFromInput,
}, diags
}
@@ -498,9 +498,9 @@ type unparsedUnknownVariableValue struct {
var _ backend.UnparsedVariableValue = unparsedUnknownVariableValue{}
func (v unparsedUnknownVariableValue) ParseVariableValue(mode configs.VariableParsingMode) (*terraform.InputValue, tfdiags.Diagnostics) {
return &terraform.InputValue{
func (v unparsedUnknownVariableValue) ParseVariableValue(mode configs.VariableParsingMode) (*opentf.InputValue, tfdiags.Diagnostics) {
return &opentf.InputValue{
Value: cty.UnknownVal(v.WantType),
SourceType: terraform.ValueFromInput,
SourceType: opentf.ValueFromInput,
}, nil
}

View File

@@ -24,7 +24,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
@@ -272,6 +272,6 @@ func (s *stateStorageThatFailsRefresh) RefreshState() error {
return fmt.Errorf("intentionally failing for testing purposes")
}
func (s *stateStorageThatFailsRefresh) PersistState(schemas *terraform.Schemas) error {
func (s *stateStorageThatFailsRefresh) PersistState(schemas *opentf.Schemas) error {
return fmt.Errorf("unimplemented")
}

View File

@@ -16,7 +16,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans/planfile"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
@@ -73,7 +73,7 @@ func (b *Local) opPlan(
}
if b.ContextOpts == nil {
b.ContextOpts = new(terraform.ContextOpts)
b.ContextOpts = new(opentf.ContextOpts)
}
// Get our context

View File

@@ -25,7 +25,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
)
func TestLocal_planBasic(t *testing.T) {
@@ -133,7 +133,7 @@ func TestLocal_plan_context_error(t *testing.T) {
// to test that we properly unlock the state if terraform.NewContext
// returns an error.
if b.ContextOpts == nil {
b.ContextOpts = &terraform.ContextOpts{}
b.ContextOpts = &opentf.ContextOpts{}
}
b.ContextOpts.Parallelism = -1

View File

@@ -20,7 +20,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/zclconf/go-cty/cty"
)
@@ -102,7 +102,7 @@ func TestLocal_refreshInput(t *testing.T) {
// Enable input asking since it is normally disabled by default
b.OpInput = true
b.ContextOpts.UIInput = &terraform.MockUIInput{InputReturnString: "bar"}
b.ContextOpts.UIInput = &opentf.MockUIInput{InputReturnString: "bar"}
op, configCleanup, done := testOperationRefresh(t, "./testdata/refresh-var-unset")
defer configCleanup()

View File

@@ -10,13 +10,13 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
)
// StateHook is a hook that continuously updates the state by calling
// WriteState on a statemgr.Full.
type StateHook struct {
terraform.NilHook
opentf.NilHook
sync.Mutex
StateMgr statemgr.Writer
@@ -31,7 +31,7 @@ type StateHook struct {
// Schemas are the schemas to use when persisting state due to
// PersistInterval. This is ignored if PersistInterval is zero,
// and PersistInterval is ignored if this is nil.
Schemas *terraform.Schemas
Schemas *opentf.Schemas
intermediatePersist IntermediateStatePersistInfo
}
@@ -59,9 +59,9 @@ type IntermediateStatePersistInfo struct {
ForcePersist bool
}
var _ terraform.Hook = (*StateHook)(nil)
var _ opentf.Hook = (*StateHook)(nil)
func (h *StateHook) PostStateUpdate(new *states.State) (terraform.HookAction, error) {
func (h *StateHook) PostStateUpdate(new *states.State) (opentf.HookAction, error) {
h.Lock()
defer h.Unlock()
@@ -75,13 +75,13 @@ func (h *StateHook) PostStateUpdate(new *states.State) (terraform.HookAction, er
if h.StateMgr != nil {
if err := h.StateMgr.WriteState(new); err != nil {
return terraform.HookActionHalt, err
return opentf.HookActionHalt, err
}
if mgrPersist, ok := h.StateMgr.(statemgr.Persister); ok && h.PersistInterval != 0 && h.Schemas != nil {
if h.shouldPersist() {
err := mgrPersist.PersistState(h.Schemas)
if err != nil {
return terraform.HookActionHalt, err
return opentf.HookActionHalt, err
}
h.intermediatePersist.LastPersist = time.Now()
} else {
@@ -90,7 +90,7 @@ func (h *StateHook) PostStateUpdate(new *states.State) (terraform.HookAction, er
}
}
return terraform.HookActionContinue, nil
return opentf.HookActionContinue, nil
}
func (h *StateHook) Stopping() {

View File

@@ -11,23 +11,23 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
)
func TestStateHook_impl(t *testing.T) {
var _ terraform.Hook = new(StateHook)
var _ opentf.Hook = new(StateHook)
}
func TestStateHook(t *testing.T) {
is := statemgr.NewTransientInMemory(nil)
var hook terraform.Hook = &StateHook{StateMgr: is}
var hook opentf.Hook = &StateHook{StateMgr: is}
s := statemgr.TestFullInitialState()
action, err := hook.PostStateUpdate(s)
if err != nil {
t.Fatalf("err: %s", err)
}
if action != terraform.HookActionContinue {
if action != opentf.HookActionContinue {
t.Fatalf("bad: %v", action)
}
if !is.State().Equal(s) {
@@ -39,7 +39,7 @@ func TestStateHookStopping(t *testing.T) {
is := &testPersistentState{}
hook := &StateHook{
StateMgr: is,
Schemas: &terraform.Schemas{},
Schemas: &opentf.Schemas{},
PersistInterval: 4 * time.Hour,
intermediatePersist: IntermediateStatePersistInfo{
LastPersist: time.Now(),
@@ -51,7 +51,7 @@ func TestStateHookStopping(t *testing.T) {
if err != nil {
t.Fatalf("unexpected error from PostStateUpdate: %s", err)
}
if got, want := action, terraform.HookActionContinue; got != want {
if got, want := action, opentf.HookActionContinue; got != want {
t.Fatalf("wrong hookaction %#v; want %#v", got, want)
}
if is.Written == nil || !is.Written.Equal(s) {
@@ -138,7 +138,7 @@ func TestStateHookCustomPersistRule(t *testing.T) {
is := &testPersistentStateThatRefusesToPersist{}
hook := &StateHook{
StateMgr: is,
Schemas: &terraform.Schemas{},
Schemas: &opentf.Schemas{},
PersistInterval: 4 * time.Hour,
intermediatePersist: IntermediateStatePersistInfo{
LastPersist: time.Now(),
@@ -150,7 +150,7 @@ func TestStateHookCustomPersistRule(t *testing.T) {
if err != nil {
t.Fatalf("unexpected error from PostStateUpdate: %s", err)
}
if got, want := action, terraform.HookActionContinue; got != want {
if got, want := action, opentf.HookActionContinue; got != want {
t.Fatalf("wrong hookaction %#v; want %#v", got, want)
}
if is.Written == nil || !is.Written.Equal(s) {
@@ -255,7 +255,7 @@ func (sm *testPersistentState) WriteState(state *states.State) error {
return nil
}
func (sm *testPersistentState) PersistState(schemas *terraform.Schemas) error {
func (sm *testPersistentState) PersistState(schemas *opentf.Schemas) error {
if schemas == nil {
return fmt.Errorf("no schemas")
}
@@ -281,7 +281,7 @@ func (sm *testPersistentStateThatRefusesToPersist) WriteState(state *states.Stat
return nil
}
func (sm *testPersistentStateThatRefusesToPersist) PersistState(schemas *terraform.Schemas) error {
func (sm *testPersistentStateThatRefusesToPersist) PersistState(schemas *opentf.Schemas) error {
if schemas == nil {
return fmt.Errorf("no schemas")
}

View File

@@ -15,7 +15,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
)
// TestLocal returns a configured Local struct with temporary paths and
@@ -35,16 +35,16 @@ func TestLocal(t *testing.T) *Local {
local.StateOutPath = filepath.Join(tempDir, "state.tfstate")
local.StateBackupPath = filepath.Join(tempDir, "state.tfstate.bak")
local.StateWorkspaceDir = filepath.Join(tempDir, "state.tfstate.d")
local.ContextOpts = &terraform.ContextOpts{}
local.ContextOpts = &opentf.ContextOpts{}
return local
}
// TestLocalProvider modifies the ContextOpts of the *Local parameter to
// have a provider with the given name.
func TestLocalProvider(t *testing.T, b *Local, name string, schema providers.ProviderSchema) *terraform.MockProvider {
func TestLocalProvider(t *testing.T, b *Local, name string, schema providers.ProviderSchema) *opentf.MockProvider {
// Build a mock resource provider for in-memory operations
p := new(terraform.MockProvider)
p := new(opentf.MockProvider)
p.GetProviderSchemaResponse = &schema
@@ -89,7 +89,7 @@ func TestLocalProvider(t *testing.T, b *Local, name string, schema providers.Pro
// Initialize the opts
if b.ContextOpts == nil {
b.ContextOpts = &terraform.ContextOpts{}
b.ContextOpts = &opentf.ContextOpts{}
}
// Set up our provider

View File

@@ -26,7 +26,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/logging"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/remote"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
tfversion "github.com/placeholderplaceholderplaceholder/opentf/version"
"github.com/zclconf/go-cty/cty"
@@ -53,7 +53,7 @@ type Remote struct {
// ContextOpts are the base context options to set when initializing a
// new OpenTF context. Many of these will be overridden or merged by
// Operation. See Operation for more details.
ContextOpts *terraform.ContextOpts
ContextOpts *opentf.ContextOpts
// client is the remote backend API client.
client *tfe.Client
@@ -869,7 +869,7 @@ func (b *Remote) cancel(cancelCtx context.Context, op *backend.Operation, r *tfe
// Only ask if the remote operation should be canceled
// if the auto approve flag is not set.
if !op.AutoApprove {
v, err := op.UIIn.Input(cancelCtx, &terraform.InputOpts{
v, err := op.UIIn.Input(cancelCtx, &opentf.InputOpts{
Id: "cancel",
Query: "\nDo you want to cancel the remote operation?",
Description: "Only 'yes' will be accepted to cancel.",

View File

@@ -14,7 +14,7 @@ import (
version "github.com/hashicorp/go-version"
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
@@ -220,7 +220,7 @@ func (b *Remote) opApply(stopCtx, cancelCtx context.Context, op *backend.Operati
if !w.AutoApply {
if mustConfirm {
opts := &terraform.InputOpts{Id: "approve"}
opts := &opentf.InputOpts{Id: "approve"}
if op.PlanMode == plans.DestroyMode {
opts.Query = "\nDo you really want to destroy all resources in workspace \"" + op.Workspace + "\"?"

View File

@@ -29,7 +29,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans/planfile"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
tfversion "github.com/placeholderplaceholderplaceholder/opentf/version"
)
@@ -235,7 +235,7 @@ func TestRemote_applyWithParallelism(t *testing.T) {
defer configCleanup()
if b.ContextOpts == nil {
b.ContextOpts = &terraform.ContextOpts{}
b.ContextOpts = &opentf.ContextOpts{}
}
b.ContextOpts.Parallelism = 3
op.Workspace = backend.DefaultStateName
@@ -580,7 +580,7 @@ func TestRemote_applyWithVariables(t *testing.T) {
op, configCleanup, done := testOperationApply(t, "./testdata/apply-variables")
defer configCleanup()
op.Variables = testVariables(terraform.ValueFromNamedFile, "foo", "bar")
op.Variables = testVariables(opentf.ValueFromNamedFile, "foo", "bar")
op.Workspace = backend.DefaultStateName
run, err := b.Operation(context.Background(), op)

View File

@@ -18,7 +18,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
"github.com/placeholderplaceholderplaceholder/opentf/internal/logging"
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
)
var (
@@ -242,7 +242,7 @@ func (b *Remote) hasExplicitVariableValues(op *backend.Operation) bool {
// their final values will come from the _remote_ execution context.
for _, v := range variables {
switch v.SourceType {
case terraform.ValueFromCLIArg, terraform.ValueFromNamedFile:
case opentf.ValueFromCLIArg, opentf.ValueFromNamedFile:
return true
}
}
@@ -431,7 +431,7 @@ func (b *Remote) checkPolicy(stopCtx, cancelCtx context.Context, op *backend.Ope
return generalError(fmt.Sprintf("Failed to override policy check.\n%s", runUrl), err)
}
} else {
opts := &terraform.InputOpts{
opts := &opentf.InputOpts{
Id: "override",
Query: "\nDo you want to override the soft failed policy check?",
Description: "Only 'override' will be accepted to override.",
@@ -463,7 +463,7 @@ func (b *Remote) checkPolicy(stopCtx, cancelCtx context.Context, op *backend.Ope
return nil
}
func (b *Remote) confirm(stopCtx context.Context, op *backend.Operation, opts *terraform.InputOpts, r *tfe.Run, keyword string) error {
func (b *Remote) confirm(stopCtx context.Context, op *backend.Operation, opts *opentf.InputOpts, r *tfe.Run, keyword string) error {
doneCtx, cancel := context.WithCancel(stopCtx)
result := make(chan error, 2)

View File

@@ -15,7 +15,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
"github.com/zclconf/go-cty/cty"
)
@@ -24,7 +24,7 @@ import (
func (b *Remote) LocalRun(op *backend.Operation) (*backend.LocalRun, statemgr.Full, tfdiags.Diagnostics) {
var diags tfdiags.Diagnostics
ret := &backend.LocalRun{
PlanOpts: &terraform.PlanOpts{
PlanOpts: &opentf.PlanOpts{
Mode: op.PlanMode,
Targets: op.Targets,
},
@@ -63,7 +63,7 @@ func (b *Remote) LocalRun(op *backend.Operation) (*backend.LocalRun, statemgr.Fu
}
// Initialize our context options
var opts terraform.ContextOpts
var opts opentf.ContextOpts
if v := b.ContextOpts; v != nil {
opts = *v
}
@@ -142,7 +142,7 @@ func (b *Remote) LocalRun(op *backend.Operation) (*backend.LocalRun, statemgr.Fu
}
}
tfCtx, ctxDiags := terraform.NewContext(&opts)
tfCtx, ctxDiags := opentf.NewContext(&opts)
diags = diags.Append(ctxDiags)
ret.Core = tfCtx
@@ -186,24 +186,24 @@ func (b *Remote) getRemoteWorkspaceID(ctx context.Context, localWorkspaceName st
return remoteWorkspace.ID, nil
}
func stubAllVariables(vv map[string]backend.UnparsedVariableValue, decls map[string]*configs.Variable) terraform.InputValues {
ret := make(terraform.InputValues, len(decls))
func stubAllVariables(vv map[string]backend.UnparsedVariableValue, decls map[string]*configs.Variable) opentf.InputValues {
ret := make(opentf.InputValues, len(decls))
for name, cfg := range decls {
raw, exists := vv[name]
if !exists {
ret[name] = &terraform.InputValue{
ret[name] = &opentf.InputValue{
Value: cty.UnknownVal(cfg.Type),
SourceType: terraform.ValueFromConfig,
SourceType: opentf.ValueFromConfig,
}
continue
}
val, diags := raw.ParseVariableValue(cfg.ParsingMode)
if diags.HasErrors() {
ret[name] = &terraform.InputValue{
ret[name] = &opentf.InputValue{
Value: cty.UnknownVal(cfg.Type),
SourceType: terraform.ValueFromConfig,
SourceType: opentf.ValueFromConfig,
}
continue
}
@@ -222,7 +222,7 @@ type remoteStoredVariableValue struct {
var _ backend.UnparsedVariableValue = (*remoteStoredVariableValue)(nil)
func (v *remoteStoredVariableValue) ParseVariableValue(mode configs.VariableParsingMode) (*terraform.InputValue, tfdiags.Diagnostics) {
func (v *remoteStoredVariableValue) ParseVariableValue(mode configs.VariableParsingMode) (*opentf.InputValue, tfdiags.Diagnostics) {
var diags tfdiags.Diagnostics
var val cty.Value
@@ -285,7 +285,7 @@ func (v *remoteStoredVariableValue) ParseVariableValue(mode configs.VariablePars
val = cty.StringVal(v.definition.Value)
}
return &terraform.InputValue{
return &opentf.InputValue{
Value: val,
// We mark these as "from input" with the rationale that entering
@@ -293,6 +293,6 @@ func (v *remoteStoredVariableValue) ParseVariableValue(mode configs.VariablePars
// roughly speaking, a similar idea to entering variable values at
// the interactive CLI prompts. It's not a perfect correspondance,
// but it's closer than the other options.
SourceType: terraform.ValueFromInput,
SourceType: opentf.ValueFromInput,
}, diags
}

View File

@@ -8,7 +8,7 @@ import (
"reflect"
"testing"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
tfe "github.com/hashicorp/go-tfe"
@@ -256,7 +256,7 @@ func TestRemoteVariablesDoNotOverride(t *testing.T) {
tests := map[string]struct {
localVariables map[string]backend.UnparsedVariableValue
remoteVariables []*tfe.VariableCreateOptions
expectedVariables terraform.InputValues
expectedVariables opentf.InputValues
}{
"no local variables": {
map[string]backend.UnparsedVariableValue{},
@@ -277,28 +277,28 @@ func TestRemoteVariablesDoNotOverride(t *testing.T) {
Category: &catTerraform,
},
},
terraform.InputValues{
varName1: &terraform.InputValue{
opentf.InputValues{
varName1: &opentf.InputValue{
Value: cty.StringVal(varValue1),
SourceType: terraform.ValueFromInput,
SourceType: opentf.ValueFromInput,
SourceRange: tfdiags.SourceRange{
Filename: "",
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
End: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
},
},
varName2: &terraform.InputValue{
varName2: &opentf.InputValue{
Value: cty.StringVal(varValue2),
SourceType: terraform.ValueFromInput,
SourceType: opentf.ValueFromInput,
SourceRange: tfdiags.SourceRange{
Filename: "",
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
End: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
},
},
varName3: &terraform.InputValue{
varName3: &opentf.InputValue{
Value: cty.StringVal(varValue3),
SourceType: terraform.ValueFromInput,
SourceType: opentf.ValueFromInput,
SourceRange: tfdiags.SourceRange{
Filename: "",
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
@@ -326,28 +326,28 @@ func TestRemoteVariablesDoNotOverride(t *testing.T) {
Category: &catTerraform,
},
},
terraform.InputValues{
varName1: &terraform.InputValue{
opentf.InputValues{
varName1: &opentf.InputValue{
Value: cty.StringVal(varValue1),
SourceType: terraform.ValueFromInput,
SourceType: opentf.ValueFromInput,
SourceRange: tfdiags.SourceRange{
Filename: "",
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
End: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
},
},
varName2: &terraform.InputValue{
varName2: &opentf.InputValue{
Value: cty.StringVal(varValue2),
SourceType: terraform.ValueFromInput,
SourceType: opentf.ValueFromInput,
SourceRange: tfdiags.SourceRange{
Filename: "",
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
End: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
},
},
varName3: &terraform.InputValue{
varName3: &opentf.InputValue{
Value: cty.StringVal(varValue3),
SourceType: terraform.ValueFromNamedFile,
SourceType: opentf.ValueFromNamedFile,
SourceRange: tfdiags.SourceRange{
Filename: "fake.tfvars",
Start: tfdiags.SourcePos{Line: 1, Column: 1, Byte: 0},
@@ -371,28 +371,28 @@ func TestRemoteVariablesDoNotOverride(t *testing.T) {
Category: &catTerraform,
},
},
terraform.InputValues{
varName1: &terraform.InputValue{
opentf.InputValues{
varName1: &opentf.InputValue{
Value: cty.StringVal(varValue1),
SourceType: terraform.ValueFromInput,
SourceType: opentf.ValueFromInput,
SourceRange: tfdiags.SourceRange{
Filename: "",
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
End: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
},
},
varName2: &terraform.InputValue{
varName2: &opentf.InputValue{
Value: cty.StringVal(varValue2),
SourceType: terraform.ValueFromInput,
SourceType: opentf.ValueFromInput,
SourceRange: tfdiags.SourceRange{
Filename: "",
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
End: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
},
},
varName3: &terraform.InputValue{
varName3: &opentf.InputValue{
Value: cty.StringVal(varValue3),
SourceType: terraform.ValueFromNamedFile,
SourceType: opentf.ValueFromNamedFile,
SourceRange: tfdiags.SourceRange{
Filename: "fake.tfvars",
Start: tfdiags.SourcePos{Line: 1, Column: 1, Byte: 0},
@@ -461,10 +461,10 @@ func TestRemoteVariablesDoNotOverride(t *testing.T) {
type testUnparsedVariableValue string
func (v testUnparsedVariableValue) ParseVariableValue(mode configs.VariableParsingMode) (*terraform.InputValue, tfdiags.Diagnostics) {
return &terraform.InputValue{
func (v testUnparsedVariableValue) ParseVariableValue(mode configs.VariableParsingMode) (*opentf.InputValue, tfdiags.Diagnostics) {
return &opentf.InputValue{
Value: cty.StringVal(string(v)),
SourceType: terraform.ValueFromNamedFile,
SourceType: opentf.ValueFromNamedFile,
SourceRange: tfdiags.SourceRange{
Filename: "fake.tfvars",
Start: tfdiags.SourcePos{Line: 1, Column: 1, Byte: 0},

View File

@@ -28,7 +28,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans/planfile"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
)
func testOperationPlan(t *testing.T, configDir string) (*backend.Operation, func(), func(*testing.T) *terminal.TestOutput) {
@@ -210,7 +210,7 @@ func TestRemote_planWithParallelism(t *testing.T) {
defer configCleanup()
if b.ContextOpts == nil {
b.ContextOpts = &terraform.ContextOpts{}
b.ContextOpts = &opentf.ContextOpts{}
}
b.ContextOpts.Parallelism = 3
op.Workspace = backend.DefaultStateName
@@ -615,7 +615,7 @@ func TestRemote_planWithVariables(t *testing.T) {
op, configCleanup, done := testOperationPlan(t, "./testdata/plan-variables")
defer configCleanup()
op.Variables = testVariables(terraform.ValueFromCLIArg, "foo", "bar")
op.Variables = testVariables(opentf.ValueFromCLIArg, "foo", "bar")
op.Workspace = backend.DefaultStateName
run, err := b.Operation(context.Background(), op)

View File

@@ -25,7 +25,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/httpclient"
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/remote"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
"github.com/placeholderplaceholderplaceholder/opentf/version"
"github.com/zclconf/go-cty/cty"
@@ -49,7 +49,7 @@ type mockInput struct {
answers map[string]string
}
func (m *mockInput) Input(ctx context.Context, opts *terraform.InputOpts) (string, error) {
func (m *mockInput) Input(ctx context.Context, opts *opentf.InputOpts) (string, error) {
v, ok := m.answers[opts.Id]
if !ok {
return "", fmt.Errorf("unexpected input request in test: %s", opts.Id)
@@ -304,18 +304,18 @@ func testDisco(s *httptest.Server) *disco.Disco {
type unparsedVariableValue struct {
value string
source terraform.ValueSourceType
source opentf.ValueSourceType
}
func (v *unparsedVariableValue) ParseVariableValue(mode configs.VariableParsingMode) (*terraform.InputValue, tfdiags.Diagnostics) {
return &terraform.InputValue{
func (v *unparsedVariableValue) ParseVariableValue(mode configs.VariableParsingMode) (*opentf.InputValue, tfdiags.Diagnostics) {
return &opentf.InputValue{
Value: cty.StringVal(v.value),
SourceType: v.source,
}, tfdiags.Diagnostics{}
}
// testVariable returns a backend.UnparsedVariableValue used for testing.
func testVariables(s terraform.ValueSourceType, vs ...string) map[string]backend.UnparsedVariableValue {
func testVariables(s opentf.ValueSourceType, vs ...string) map[string]backend.UnparsedVariableValue {
vars := make(map[string]backend.UnparsedVariableValue, len(vs))
for _, v := range vs {
vars[v] = &unparsedVariableValue{

View File

@@ -8,7 +8,7 @@ import (
"github.com/hashicorp/hcl/v2"
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
"github.com/zclconf/go-cty/cty"
)
@@ -25,7 +25,7 @@ type UnparsedVariableValue interface {
//
// If error diagnostics are returned, the resulting value may be invalid
// or incomplete.
ParseVariableValue(mode configs.VariableParsingMode) (*terraform.InputValue, tfdiags.Diagnostics)
ParseVariableValue(mode configs.VariableParsingMode) (*opentf.InputValue, tfdiags.Diagnostics)
}
// ParseUndeclaredVariableValues processes a map of unparsed variable values
@@ -34,9 +34,9 @@ type UnparsedVariableValue interface {
// variables being present, depending on the source of these values. If more
// than two undeclared values are present in file form (config, auto, -var-file)
// the remaining errors are summarized to avoid a massive list of errors.
func ParseUndeclaredVariableValues(vv map[string]UnparsedVariableValue, decls map[string]*configs.Variable) (terraform.InputValues, tfdiags.Diagnostics) {
func ParseUndeclaredVariableValues(vv map[string]UnparsedVariableValue, decls map[string]*configs.Variable) (opentf.InputValues, tfdiags.Diagnostics) {
var diags tfdiags.Diagnostics
ret := make(terraform.InputValues, len(vv))
ret := make(opentf.InputValues, len(vv))
seenUndeclaredInFile := 0
for name, rv := range vv {
@@ -53,7 +53,7 @@ func ParseUndeclaredVariableValues(vv map[string]UnparsedVariableValue, decls ma
ret[name] = val
switch val.SourceType {
case terraform.ValueFromConfig, terraform.ValueFromAutoFile, terraform.ValueFromNamedFile:
case opentf.ValueFromConfig, opentf.ValueFromAutoFile, opentf.ValueFromNamedFile:
// We allow undeclared names for variable values from files and warn in case
// users have forgotten a variable {} declaration or have a typo in their var name.
// Some users will actively ignore this warning because they use a .tfvars file
@@ -67,12 +67,12 @@ func ParseUndeclaredVariableValues(vv map[string]UnparsedVariableValue, decls ma
}
seenUndeclaredInFile++
case terraform.ValueFromEnvVar:
case opentf.ValueFromEnvVar:
// We allow and ignore undeclared names for environment
// variables, because users will often set these globally
// when they are used across many (but not necessarily all)
// configurations.
case terraform.ValueFromCLIArg:
case opentf.ValueFromCLIArg:
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Value for undeclared variable",
@@ -105,9 +105,9 @@ func ParseUndeclaredVariableValues(vv map[string]UnparsedVariableValue, decls ma
// and returns an input values map of the ones declared in the specified
// variable declaration mapping. Diagnostics will be populating with
// any variable parsing errors encountered within this collection.
func ParseDeclaredVariableValues(vv map[string]UnparsedVariableValue, decls map[string]*configs.Variable) (terraform.InputValues, tfdiags.Diagnostics) {
func ParseDeclaredVariableValues(vv map[string]UnparsedVariableValue, decls map[string]*configs.Variable) (opentf.InputValues, tfdiags.Diagnostics) {
var diags tfdiags.Diagnostics
ret := make(terraform.InputValues, len(vv))
ret := make(opentf.InputValues, len(vv))
for name, rv := range vv {
var mode configs.VariableParsingMode
@@ -132,9 +132,9 @@ func ParseDeclaredVariableValues(vv map[string]UnparsedVariableValue, decls map[
return ret, diags
}
// Checks all given terraform.InputValues variable maps for the existance of
// Checks all given opentf.InputValues variable maps for the existance of
// a named variable
func isDefinedAny(name string, maps ...terraform.InputValues) bool {
func isDefinedAny(name string, maps ...opentf.InputValues) bool {
for _, m := range maps {
if _, defined := m[name]; defined {
return true
@@ -155,11 +155,11 @@ func isDefinedAny(name string, maps ...terraform.InputValues) bool {
//
// If this function returns without any errors in the diagnostics, the
// resulting input values map is guaranteed to be valid and ready to pass
// to terraform.NewContext. If the diagnostics contains errors, the returned
// to opentf.NewContext. If the diagnostics contains errors, the returned
// InputValues may be incomplete but will include the subset of variables
// that were successfully processed, allowing for careful analysis of the
// partial result.
func ParseVariableValues(vv map[string]UnparsedVariableValue, decls map[string]*configs.Variable) (terraform.InputValues, tfdiags.Diagnostics) {
func ParseVariableValues(vv map[string]UnparsedVariableValue, decls map[string]*configs.Variable) (opentf.InputValues, tfdiags.Diagnostics) {
ret, diags := ParseDeclaredVariableValues(vv, decls)
undeclared, diagsUndeclared := ParseUndeclaredVariableValues(vv, decls)
@@ -191,9 +191,9 @@ func ParseVariableValues(vv map[string]UnparsedVariableValue, decls map[string]*
// result is complete for any calling code that wants to cautiously
// analyze it for diagnostic purposes. Since our diagnostics now
// includes an error, normal processing will ignore this result.
ret[name] = &terraform.InputValue{
ret[name] = &opentf.InputValue{
Value: cty.DynamicVal,
SourceType: terraform.ValueFromConfig,
SourceType: opentf.ValueFromConfig,
SourceRange: tfdiags.SourceRangeFromHCL(vc.DeclRange),
}
} else {
@@ -203,9 +203,9 @@ func ParseVariableValues(vv map[string]UnparsedVariableValue, decls map[string]*
// that it wasn't set at all at this layer, and so OpenTF Core
// should substitute a default if available, or generate an error
// if not.
ret[name] = &terraform.InputValue{
ret[name] = &opentf.InputValue{
Value: cty.NilVal,
SourceType: terraform.ValueFromConfig,
SourceType: opentf.ValueFromConfig,
SourceRange: tfdiags.SourceRangeFromHCL(vc.DeclRange),
}
}

View File

@@ -12,7 +12,7 @@ import (
"github.com/zclconf/go-cty/cty"
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
@@ -72,10 +72,10 @@ func TestUnparsedValue(t *testing.T) {
t.Fatalf("wrong number of diagnostics %d; want %d", got, want)
}
wantVals := terraform.InputValues{
wantVals := opentf.InputValues{
"declared1": {
Value: cty.StringVal("5"),
SourceType: terraform.ValueFromNamedFile,
SourceType: opentf.ValueFromNamedFile,
SourceRange: tfdiags.SourceRange{
Filename: "fake.tfvars",
Start: tfdiags.SourcePos{Line: 1, Column: 1, Byte: 0},
@@ -108,10 +108,10 @@ func TestUnparsedValue(t *testing.T) {
t.Errorf("wrong summary for diagnostic 2\ngot: %s\nwant: %s", got, want)
}
wantVals := terraform.InputValues{
wantVals := opentf.InputValues{
"undeclared0": {
Value: cty.StringVal("0"),
SourceType: terraform.ValueFromNamedFile,
SourceType: opentf.ValueFromNamedFile,
SourceRange: tfdiags.SourceRange{
Filename: "fake.tfvars",
Start: tfdiags.SourcePos{Line: 1, Column: 1},
@@ -120,7 +120,7 @@ func TestUnparsedValue(t *testing.T) {
},
"undeclared1": {
Value: cty.StringVal("1"),
SourceType: terraform.ValueFromNamedFile,
SourceType: opentf.ValueFromNamedFile,
SourceRange: tfdiags.SourceRange{
Filename: "fake.tfvars",
Start: tfdiags.SourcePos{Line: 1, Column: 1},
@@ -129,7 +129,7 @@ func TestUnparsedValue(t *testing.T) {
},
"undeclared2": {
Value: cty.StringVal("2"),
SourceType: terraform.ValueFromNamedFile,
SourceType: opentf.ValueFromNamedFile,
SourceRange: tfdiags.SourceRange{
Filename: "fake.tfvars",
Start: tfdiags.SourcePos{Line: 1, Column: 1},
@@ -138,7 +138,7 @@ func TestUnparsedValue(t *testing.T) {
},
"undeclared3": {
Value: cty.StringVal("3"),
SourceType: terraform.ValueFromNamedFile,
SourceType: opentf.ValueFromNamedFile,
SourceRange: tfdiags.SourceRange{
Filename: "fake.tfvars",
Start: tfdiags.SourcePos{Line: 1, Column: 1},
@@ -147,7 +147,7 @@ func TestUnparsedValue(t *testing.T) {
},
"undeclared4": {
Value: cty.StringVal("4"),
SourceType: terraform.ValueFromNamedFile,
SourceType: opentf.ValueFromNamedFile,
SourceRange: tfdiags.SourceRange{
Filename: "fake.tfvars",
Start: tfdiags.SourcePos{Line: 1, Column: 1},
@@ -187,10 +187,10 @@ func TestUnparsedValue(t *testing.T) {
t.Errorf("wrong summary for diagnostic 3\ngot: %s\nwant: %s", got, want)
}
wantVals := terraform.InputValues{
wantVals := opentf.InputValues{
"declared1": {
Value: cty.StringVal("5"),
SourceType: terraform.ValueFromNamedFile,
SourceType: opentf.ValueFromNamedFile,
SourceRange: tfdiags.SourceRange{
Filename: "fake.tfvars",
Start: tfdiags.SourcePos{Line: 1, Column: 1, Byte: 0},
@@ -199,7 +199,7 @@ func TestUnparsedValue(t *testing.T) {
},
"missing1": {
Value: cty.DynamicVal,
SourceType: terraform.ValueFromConfig,
SourceType: opentf.ValueFromConfig,
SourceRange: tfdiags.SourceRange{
Filename: "fake.tf",
Start: tfdiags.SourcePos{Line: 3, Column: 1, Byte: 0},
@@ -208,7 +208,7 @@ func TestUnparsedValue(t *testing.T) {
},
"missing2": {
Value: cty.NilVal, // OpenTF Core handles substituting the default
SourceType: terraform.ValueFromConfig,
SourceType: opentf.ValueFromConfig,
SourceRange: tfdiags.SourceRange{
Filename: "fake.tf",
Start: tfdiags.SourcePos{Line: 4, Column: 1, Byte: 0},
@@ -224,10 +224,10 @@ func TestUnparsedValue(t *testing.T) {
type testUnparsedVariableValue string
func (v testUnparsedVariableValue) ParseVariableValue(mode configs.VariableParsingMode) (*terraform.InputValue, tfdiags.Diagnostics) {
return &terraform.InputValue{
func (v testUnparsedVariableValue) ParseVariableValue(mode configs.VariableParsingMode) (*opentf.InputValue, tfdiags.Diagnostics) {
return &opentf.InputValue{
Value: cty.StringVal(string(v)),
SourceType: terraform.ValueFromNamedFile,
SourceType: opentf.ValueFromNamedFile,
SourceRange: tfdiags.SourceRange{
Filename: "fake.tfvars",
Start: tfdiags.SourcePos{Line: 1, Column: 1, Byte: 0},