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},

View File

@ -30,7 +30,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema"
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
"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"
@ -58,7 +58,7 @@ type Cloud struct {
// ContextOpts are the base context options to set when initializing a
// new Terraform 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 cloud backend API client.
client *tfe.Client
@ -878,7 +878,7 @@ func (b *Cloud) 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

@ -16,7 +16,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/jsonformat"
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
@ -154,7 +154,7 @@ func (b *Cloud) opApply(stopCtx, cancelCtx context.Context, op *backend.Operatio
mustConfirm := (op.UIIn != nil && op.UIOut != nil) && !op.AutoApprove
if mustConfirm && b.input {
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

@ -33,7 +33,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"
)
@ -386,7 +386,7 @@ func TestCloud_applyWithParallelism(t *testing.T) {
defer configCleanup()
if b.ContextOpts == nil {
b.ContextOpts = &terraform.ContextOpts{}
b.ContextOpts = &opentf.ContextOpts{}
}
b.ContextOpts.Parallelism = 3
op.Workspace = testBackendSingleWorkspaceName
@ -668,7 +668,7 @@ func TestCloud_applyWithRequiredVariables(t *testing.T) {
defer configCleanup()
defer done(t)
op.Variables = testVariables(terraform.ValueFromNamedFile, "foo") // "bar" variable value missing
op.Variables = testVariables(opentf.ValueFromNamedFile, "foo") // "bar" variable value missing
op.Workspace = testBackendSingleWorkspaceName
run, err := b.Operation(context.Background(), op)

View File

@ -25,7 +25,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/jsonformat"
"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 (
@ -405,7 +405,7 @@ func (b *Cloud) checkPolicy(stopCtx, cancelCtx context.Context, op *backend.Oper
} else if !b.input {
return errPolicyOverrideNeedsUIConfirmation
} 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.",
@ -437,7 +437,7 @@ func (b *Cloud) checkPolicy(stopCtx, cancelCtx context.Context, op *backend.Oper
return nil
}
func (b *Cloud) confirm(stopCtx context.Context, op *backend.Operation, opts *terraform.InputOpts, r *tfe.Run, keyword string) error {
func (b *Cloud) 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 *Cloud) 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 *Cloud) LocalRun(op *backend.Operation) (*backend.LocalRun, statemgr.Ful
}
// Initialize our context options
var opts terraform.ContextOpts
var opts opentf.ContextOpts
if v := b.ContextOpts; v != nil {
opts = *v
}
@ -143,7 +143,7 @@ func (b *Cloud) LocalRun(op *backend.Operation) (*backend.LocalRun, statemgr.Ful
}
}
tfCtx, ctxDiags := terraform.NewContext(&opts)
tfCtx, ctxDiags := opentf.NewContext(&opts)
diags = diags.Append(ctxDiags)
ret.Core = tfCtx
@ -183,24 +183,24 @@ func (b *Cloud) getRemoteWorkspaceID(ctx context.Context, localWorkspaceName str
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
}
@ -219,7 +219,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
@ -282,7 +282,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
@ -290,6 +290,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

@ -19,7 +19,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/initwd"
"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"
)
@ -255,7 +255,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{},
@ -276,28 +276,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},
@ -308,7 +308,7 @@ func TestRemoteVariablesDoNotOverride(t *testing.T) {
},
"single conflicting local variable": {
map[string]backend.UnparsedVariableValue{
varName3: testUnparsedVariableValue{source: terraform.ValueFromNamedFile, value: cty.StringVal(varValue3)},
varName3: testUnparsedVariableValue{source: opentf.ValueFromNamedFile, value: cty.StringVal(varValue3)},
},
[]*tfe.VariableCreateOptions{
{
@ -325,28 +325,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},
@ -357,7 +357,7 @@ func TestRemoteVariablesDoNotOverride(t *testing.T) {
},
"no conflicting local variable": {
map[string]backend.UnparsedVariableValue{
varName3: testUnparsedVariableValue{source: terraform.ValueFromNamedFile, value: cty.StringVal(varValue3)},
varName3: testUnparsedVariableValue{source: opentf.ValueFromNamedFile, value: cty.StringVal(varValue3)},
},
[]*tfe.VariableCreateOptions{
{
@ -370,28 +370,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},

View File

@ -31,7 +31,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) {
@ -309,7 +309,7 @@ func TestCloud_planWithParallelism(t *testing.T) {
defer configCleanup()
if b.ContextOpts == nil {
b.ContextOpts = &terraform.ContextOpts{}
b.ContextOpts = &opentf.ContextOpts{}
}
b.ContextOpts.Parallelism = 3
op.Workspace = testBackendSingleWorkspaceName
@ -610,7 +610,7 @@ func TestCloud_planWithRequiredVariables(t *testing.T) {
defer configCleanup()
defer done(t)
op.Variables = testVariables(terraform.ValueFromCLIArg, "foo") // "bar" variable defined in config is missing
op.Variables = testVariables(opentf.ValueFromCLIArg, "foo") // "bar" variable defined in config is missing
op.Workspace = testBackendSingleWorkspaceName
run, err := b.Operation(context.Background(), op)

View File

@ -10,7 +10,7 @@ import (
"github.com/hashicorp/go-multierror"
tfe "github.com/hashicorp/go-tfe"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
)
type taskStages map[tfe.Stage]*tfe.TaskStage
@ -169,7 +169,7 @@ func processSummarizers(ctx *IntegrationContext, output IntegrationOutputWriter,
}
func (b *Cloud) processStageOverrides(context *IntegrationContext, output IntegrationOutputWriter, taskStageID string) (bool, error) {
opts := &terraform.InputOpts{
opts := &opentf.InputOpts{
Id: fmt.Sprintf("%c%c [bold]Override", Arrow, Arrow),
Query: "\nDo you want to override the failed policy check?",
Description: "Only 'override' will be accepted to override.",

View File

@ -7,12 +7,12 @@ import (
"github.com/hashicorp/hcl/v2/hclwrite"
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
func allowedSourceType(source terraform.ValueSourceType) bool {
return source == terraform.ValueFromNamedFile || source == terraform.ValueFromCLIArg || source == terraform.ValueFromEnvVar
func allowedSourceType(source opentf.ValueSourceType) bool {
return source == opentf.ValueFromNamedFile || source == opentf.ValueFromCLIArg || source == opentf.ValueFromEnvVar
}
// ParseCloudRunVariables accepts a mapping of unparsed values and a mapping of variable

View File

@ -10,7 +10,7 @@ import (
"github.com/hashicorp/hcl/v2"
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
"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"
)
@ -18,16 +18,16 @@ import (
func TestParseCloudRunVariables(t *testing.T) {
t.Run("populates variables from allowed sources", func(t *testing.T) {
vv := map[string]backend.UnparsedVariableValue{
"undeclared": testUnparsedVariableValue{source: terraform.ValueFromCLIArg, value: cty.StringVal("0")},
"declaredFromConfig": testUnparsedVariableValue{source: terraform.ValueFromConfig, value: cty.StringVal("1")},
"declaredFromNamedFileMapString": testUnparsedVariableValue{source: terraform.ValueFromNamedFile, value: cty.MapVal(map[string]cty.Value{"foo": cty.StringVal("bar")})},
"declaredFromNamedFileBool": testUnparsedVariableValue{source: terraform.ValueFromNamedFile, value: cty.BoolVal(true)},
"declaredFromNamedFileNumber": testUnparsedVariableValue{source: terraform.ValueFromNamedFile, value: cty.NumberIntVal(2)},
"declaredFromNamedFileListString": testUnparsedVariableValue{source: terraform.ValueFromNamedFile, value: cty.ListVal([]cty.Value{cty.StringVal("2a"), cty.StringVal("2b")})},
"declaredFromNamedFileNull": testUnparsedVariableValue{source: terraform.ValueFromNamedFile, value: cty.NullVal(cty.String)},
"declaredFromNamedMapComplex": testUnparsedVariableValue{source: terraform.ValueFromNamedFile, value: cty.MapVal(map[string]cty.Value{"foo": cty.ObjectVal(map[string]cty.Value{"qux": cty.ListVal([]cty.Value{cty.BoolVal(true), cty.BoolVal(false)})})})},
"declaredFromCLIArg": testUnparsedVariableValue{source: terraform.ValueFromCLIArg, value: cty.StringVal("3")},
"declaredFromEnvVar": testUnparsedVariableValue{source: terraform.ValueFromEnvVar, value: cty.StringVal("4")},
"undeclared": testUnparsedVariableValue{source: opentf.ValueFromCLIArg, value: cty.StringVal("0")},
"declaredFromConfig": testUnparsedVariableValue{source: opentf.ValueFromConfig, value: cty.StringVal("1")},
"declaredFromNamedFileMapString": testUnparsedVariableValue{source: opentf.ValueFromNamedFile, value: cty.MapVal(map[string]cty.Value{"foo": cty.StringVal("bar")})},
"declaredFromNamedFileBool": testUnparsedVariableValue{source: opentf.ValueFromNamedFile, value: cty.BoolVal(true)},
"declaredFromNamedFileNumber": testUnparsedVariableValue{source: opentf.ValueFromNamedFile, value: cty.NumberIntVal(2)},
"declaredFromNamedFileListString": testUnparsedVariableValue{source: opentf.ValueFromNamedFile, value: cty.ListVal([]cty.Value{cty.StringVal("2a"), cty.StringVal("2b")})},
"declaredFromNamedFileNull": testUnparsedVariableValue{source: opentf.ValueFromNamedFile, value: cty.NullVal(cty.String)},
"declaredFromNamedMapComplex": testUnparsedVariableValue{source: opentf.ValueFromNamedFile, value: cty.MapVal(map[string]cty.Value{"foo": cty.ObjectVal(map[string]cty.Value{"qux": cty.ListVal([]cty.Value{cty.BoolVal(true), cty.BoolVal(false)})})})},
"declaredFromCLIArg": testUnparsedVariableValue{source: opentf.ValueFromCLIArg, value: cty.StringVal("3")},
"declaredFromEnvVar": testUnparsedVariableValue{source: opentf.ValueFromEnvVar, value: cty.StringVal("4")},
}
decls := map[string]*configs.Variable{
@ -169,12 +169,12 @@ func TestParseCloudRunVariables(t *testing.T) {
}
type testUnparsedVariableValue struct {
source terraform.ValueSourceType
source opentf.ValueSourceType
value cty.Value
}
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: v.value,
SourceType: v.source,
SourceRange: tfdiags.SourceRange{

View File

@ -31,7 +31,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/remote"
"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"
)
// State implements the State interfaces in the state package to handle
@ -157,7 +157,7 @@ func (s *State) WriteState(state *states.State) error {
}
// PersistState uploads a snapshot of the latest state as a StateVersion to Terraform Cloud
func (s *State) PersistState(schemas *terraform.Schemas) error {
func (s *State) PersistState(schemas *opentf.Schemas) error {
s.mu.Lock()
defer s.mu.Unlock()

View File

@ -32,7 +32,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
"github.com/placeholderplaceholderplaceholder/opentf/version"
@ -63,7 +63,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)
@ -589,18 +589,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

@ -27,7 +27,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"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
@ -299,7 +299,7 @@ func TestApply_parallelism(t *testing.T) {
providerFactories := map[addrs.Provider]providers.Factory{}
for i := 0; i < 10; i++ {
name := fmt.Sprintf("test%d", i)
provider := &terraform.MockProvider{}
provider := &opentf.MockProvider{}
provider.GetProviderSchemaResponse = &providers.GetProviderSchemaResponse{
ResourceTypes: map[string]providers.Schema{
name + "_instance": {Block: &configschema.Block{}},
@ -2160,7 +2160,7 @@ func applyFixtureSchema() *providers.GetProviderSchemaResponse {
// GetSchemaResponse, PlanResourceChangeFn, and ApplyResourceChangeFn populated,
// with the plan/apply steps just passing through the data determined by
// Terraform Core.
func applyFixtureProvider() *terraform.MockProvider {
func applyFixtureProvider() *opentf.MockProvider {
p := testProvider()
p.GetProviderSchemaResponse = applyFixtureSchema()
p.PlanResourceChangeFn = func(req providers.PlanResourceChangeRequest) providers.PlanResourceChangeResponse {

View File

@ -50,7 +50,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/version"
)
@ -523,8 +523,8 @@ func testStateOutput(t *testing.T, path string, expected string) {
}
}
func testProvider() *terraform.MockProvider {
p := new(terraform.MockProvider)
func testProvider() *opentf.MockProvider {
p := new(opentf.MockProvider)
p.PlanResourceChangeFn = func(req providers.PlanResourceChangeRequest) (resp providers.PlanResourceChangeResponse) {
resp.PlannedState = req.ProposedNewState
return resp

View File

@ -13,7 +13,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/arguments"
"github.com/placeholderplaceholderplaceholder/opentf/internal/repl"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
"github.com/mitchellh/cli"
@ -121,7 +121,7 @@ func (c *ConsoleCommand) Run(args []string) int {
ErrorWriter: os.Stderr,
}
evalOpts := &terraform.EvalOpts{}
evalOpts := &opentf.EvalOpts{}
if lr.PlanOpts != nil {
// the LocalRun type is built primarily to support the main operations,
// so the variable values end up in the "PlanOpts" even though we're

View File

@ -12,7 +12,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/dag"
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans/planfile"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
@ -123,7 +123,7 @@ func (c *GraphCommand) Run(args []string) int {
}
}
var g *terraform.Graph
var g *opentf.Graph
var graphDiags tfdiags.Diagnostics
switch graphTypeStr {
case "plan":
@ -171,7 +171,7 @@ func (c *GraphCommand) Run(args []string) int {
return 1
}
graphStr, err := terraform.GraphDot(g, &dag.DotOpts{
graphStr, err := opentf.GraphDot(g, &dag.DotOpts{
DrawCycles: drawCycles,
MaxDepth: moduleDepth,
Verbose: verbose,

View File

@ -19,7 +19,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/arguments"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views"
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
@ -194,7 +194,7 @@ func (c *ImportCommand) Run(args []string) int {
c.showDiagnostics(diags)
return 1
}
opReq.Hooks = []terraform.Hook{c.uiHook()}
opReq.Hooks = []opentf.Hook{c.uiHook()}
{
var moreDiags tfdiags.Diagnostics
opReq.Variables, moreDiags = c.collectVariableValues()
@ -233,8 +233,8 @@ func (c *ImportCommand) Run(args []string) int {
// Perform the import. Note that as you can see it is possible for this
// API to import more than one resource at once. For now, we only allow
// one while we stabilize this feature.
newState, importDiags := lr.Core.Import(lr.Config, lr.InputState, &terraform.ImportOpts{
Targets: []*terraform.ImportTarget{
newState, importDiags := lr.Core.Import(lr.Config, lr.InputState, &opentf.ImportOpts{
Targets: []*opentf.ImportTarget{
{
Addr: addr,
@ -256,7 +256,7 @@ func (c *ImportCommand) Run(args []string) int {
}
// Get schemas, if possible, before writing state
var schemas *terraform.Schemas
var schemas *opentf.Schemas
if isCloudMode(b) {
var schemaDiags tfdiags.Diagnostics
schemas, schemaDiags = c.MaybeGetSchemas(newState, nil)

View File

@ -29,7 +29,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/getproviders"
"github.com/placeholderplaceholderplaceholder/opentf/internal/providercache"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
tfversion "github.com/placeholderplaceholderplaceholder/opentf/version"
)
@ -256,7 +256,7 @@ func (c *InitCommand) Run(args []string) int {
// the configuration declare that they don't support this Terraform
// version, so we can produce a version-related error message rather than
// potentially-confusing downstream errors.
versionDiags := terraform.CheckCoreVersionRequirements(config)
versionDiags := opentf.CheckCoreVersionRequirements(config)
if versionDiags.HasErrors() {
c.showDiagnostics(versionDiags)
return 1

View File

@ -15,7 +15,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs"
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema"
"github.com/placeholderplaceholderplaceholder/opentf/internal/getproviders"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
)
// Config represents the complete configuration source
@ -120,7 +120,7 @@ type provisioner struct {
}
// Marshal returns the json encoding of terraform configuration.
func Marshal(c *configs.Config, schemas *terraform.Schemas) ([]byte, error) {
func Marshal(c *configs.Config, schemas *opentf.Schemas) ([]byte, error) {
var output config
pcs := make(map[string]providerConfig)
@ -147,7 +147,7 @@ func Marshal(c *configs.Config, schemas *terraform.Schemas) ([]byte, error) {
func marshalProviderConfigs(
c *configs.Config,
schemas *terraform.Schemas,
schemas *opentf.Schemas,
m map[string]providerConfig,
) {
if c == nil {
@ -304,7 +304,7 @@ func marshalProviderConfigs(
}
}
func marshalModule(c *configs.Config, schemas *terraform.Schemas, addr string) (module, error) {
func marshalModule(c *configs.Config, schemas *opentf.Schemas, addr string) (module, error) {
var module module
var rs []resource
@ -373,7 +373,7 @@ func marshalModule(c *configs.Config, schemas *terraform.Schemas, addr string) (
return module, nil
}
func marshalModuleCalls(c *configs.Config, schemas *terraform.Schemas) map[string]moduleCall {
func marshalModuleCalls(c *configs.Config, schemas *opentf.Schemas) map[string]moduleCall {
ret := make(map[string]moduleCall)
for name, mc := range c.Module.ModuleCalls {
@ -384,7 +384,7 @@ func marshalModuleCalls(c *configs.Config, schemas *terraform.Schemas) map[strin
return ret
}
func marshalModuleCall(c *configs.Config, mc *configs.ModuleCall, schemas *terraform.Schemas) moduleCall {
func marshalModuleCall(c *configs.Config, mc *configs.ModuleCall, schemas *opentf.Schemas) moduleCall {
// It is possible to have a module call with a nil config.
if c == nil {
return moduleCall{}
@ -441,7 +441,7 @@ func marshalModuleCall(c *configs.Config, mc *configs.ModuleCall, schemas *terra
return ret
}
func marshalResources(resources map[string]*configs.Resource, schemas *terraform.Schemas, moduleAddr string) ([]resource, error) {
func marshalResources(resources map[string]*configs.Resource, schemas *opentf.Schemas, moduleAddr string) ([]resource, error) {
var rs []resource
for _, v := range resources {
providerConfigKey := opaqueProviderKey(v.ProviderConfigAddr().StringCompact(), moduleAddr)

View File

@ -24,7 +24,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 TestRenderHuman_EmptyPlan(t *testing.T) {
@ -6986,7 +6986,7 @@ func runTestCases(t *testing.T, testCases map[string]testCase) {
RequiredReplace: tc.RequiredReplace,
}
tfschemas := &terraform.Schemas{
tfschemas := &opentf.Schemas{
Providers: map[addrs.Provider]providers.ProviderSchema{
src.ProviderAddr.Provider: {
ResourceTypes: map[string]providers.Schema{

View File

@ -21,7 +21,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema"
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
)
func TestState(t *testing.T) {
@ -29,12 +29,12 @@ func TestState(t *testing.T) {
tests := []struct {
State *states.State
Schemas *terraform.Schemas
Schemas *opentf.Schemas
Want string
}{
{
State: &states.State{},
Schemas: &terraform.Schemas{},
Schemas: &opentf.Schemas{},
Want: "The state file is empty. No resources are represented.\n",
},
{
@ -98,8 +98,8 @@ func TestState(t *testing.T) {
}
}
func testProvider() *terraform.MockProvider {
p := new(terraform.MockProvider)
func testProvider() *opentf.MockProvider {
p := new(opentf.MockProvider)
p.ReadResourceFn = func(req providers.ReadResourceRequest) providers.ReadResourceResponse {
return providers.ReadResourceResponse{NewState: req.PriorState}
}
@ -153,9 +153,9 @@ func testProviderSchema() *providers.GetProviderSchemaResponse {
}
}
func testSchemas() *terraform.Schemas {
func testSchemas() *opentf.Schemas {
provider := testProvider()
return &terraform.Schemas{
return &opentf.Schemas{
Providers: map[addrs.Provider]providers.ProviderSchema{
addrs.NewDefaultProvider("test"): provider.GetProviderSchema(),
},

View File

@ -21,7 +21,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/version"
)
@ -171,7 +171,7 @@ type Variable struct {
// the part of the plan required by the jsonformat.Plan renderer.
func MarshalForRenderer(
p *plans.Plan,
schemas *terraform.Schemas,
schemas *opentf.Schemas,
) (map[string]Change, []ResourceChange, []ResourceChange, []ResourceAttr, error) {
output := newPlan()
@ -218,7 +218,7 @@ func MarshalForLog(
config *configs.Config,
p *plans.Plan,
sf *statefile.File,
schemas *terraform.Schemas,
schemas *opentf.Schemas,
) (*Plan, error) {
output := newPlan()
output.TerraformVersion = version.String()
@ -302,7 +302,7 @@ func Marshal(
config *configs.Config,
p *plans.Plan,
sf *statefile.File,
schemas *terraform.Schemas,
schemas *opentf.Schemas,
) ([]byte, error) {
output, err := MarshalForLog(config, p, sf, schemas)
if err != nil {
@ -372,7 +372,7 @@ func (p *Plan) marshalPlanVariables(vars map[string]plans.DynamicValue, decls ma
// This function is referenced directly from the structured renderer tests, to
// ensure parity between the renderers. It probably shouldn't be used anywhere
// else.
func MarshalResourceChanges(resources []*plans.ResourceInstanceChangeSrc, schemas *terraform.Schemas) ([]ResourceChange, error) {
func MarshalResourceChanges(resources []*plans.ResourceInstanceChangeSrc, schemas *opentf.Schemas) ([]ResourceChange, error) {
var ret []ResourceChange
var sortedResources []*plans.ResourceInstanceChangeSrc
@ -654,7 +654,7 @@ func MarshalOutputChanges(changes *plans.Changes) (map[string]Change, error) {
return outputChanges, nil
}
func (p *Plan) marshalPlannedValues(changes *plans.Changes, schemas *terraform.Schemas) error {
func (p *Plan) marshalPlannedValues(changes *plans.Changes, schemas *opentf.Schemas) error {
// marshal the planned changes into a module
plan, err := marshalPlannedValues(changes, schemas)
if err != nil {

View File

@ -16,7 +16,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema"
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
)
// StateValues is the common representation of resolved values for both the
@ -93,7 +93,7 @@ func marshalPlannedOutputs(changes *plans.Changes) (map[string]Output, error) {
}
func marshalPlannedValues(changes *plans.Changes, schemas *terraform.Schemas) (Module, error) {
func marshalPlannedValues(changes *plans.Changes, schemas *opentf.Schemas) (Module, error) {
var ret Module
// build two maps:
@ -166,7 +166,7 @@ func marshalPlannedValues(changes *plans.Changes, schemas *terraform.Schemas) (M
}
// marshalPlanResources
func marshalPlanResources(changes *plans.Changes, ris []addrs.AbsResourceInstance, schemas *terraform.Schemas) ([]Resource, error) {
func marshalPlanResources(changes *plans.Changes, ris []addrs.AbsResourceInstance, schemas *opentf.Schemas) ([]Resource, error) {
var ret []Resource
for _, ri := range ris {
@ -248,7 +248,7 @@ func marshalPlanResources(changes *plans.Changes, ris []addrs.AbsResourceInstanc
// the full module tree.
func marshalPlanModules(
changes *plans.Changes,
schemas *terraform.Schemas,
schemas *opentf.Schemas,
childModules []addrs.ModuleInstance,
moduleMap map[string][]addrs.ModuleInstance,
moduleResourceMap map[string][]addrs.AbsResourceInstance,

View File

@ -14,7 +14,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema"
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
)
func TestMarshalAttributeValues(t *testing.T) {
@ -344,8 +344,8 @@ func TestMarshalPlanValuesNoopDeposed(t *testing.T) {
}
}
func testSchemas() *terraform.Schemas {
return &terraform.Schemas{
func testSchemas() *opentf.Schemas {
return &opentf.Schemas{
Providers: map[addrs.Provider]providers.ProviderSchema{
addrs.NewDefaultProvider("test"): providers.ProviderSchema{
ResourceTypes: map[string]providers.Schema{

View File

@ -7,7 +7,7 @@ import (
"encoding/json"
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
)
// FormatVersion represents the version of the json format and will be
@ -39,7 +39,7 @@ func newProviders() *Providers {
// schema into the public structured JSON versions.
//
// This is a format that can be read by the structured plan renderer.
func MarshalForRenderer(s *terraform.Schemas) map[string]*Provider {
func MarshalForRenderer(s *opentf.Schemas) map[string]*Provider {
schemas := make(map[string]*Provider, len(s.Providers))
for k, v := range s.Providers {
schemas[k.String()] = marshalProvider(v)
@ -47,7 +47,7 @@ func MarshalForRenderer(s *terraform.Schemas) map[string]*Provider {
return schemas
}
func Marshal(s *terraform.Schemas) ([]byte, error) {
func Marshal(s *opentf.Schemas) ([]byte, error) {
providers := newProviders()
providers.Schemas = MarshalForRenderer(s)
ret, err := json.Marshal(providers)

View File

@ -16,7 +16,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/lang/marks"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
)
const (
@ -143,7 +143,7 @@ func newState() *State {
// MarshalForRenderer returns the pre-json encoding changes of the state, in a
// format available to the structured renderer.
func MarshalForRenderer(sf *statefile.File, schemas *terraform.Schemas) (Module, map[string]Output, error) {
func MarshalForRenderer(sf *statefile.File, schemas *opentf.Schemas) (Module, map[string]Output, error) {
if sf.State.Modules == nil {
// Empty state case.
return Module{}, nil, nil
@ -164,7 +164,7 @@ func MarshalForRenderer(sf *statefile.File, schemas *terraform.Schemas) (Module,
// MarshalForLog returns the origin JSON compatible state, read for a logging
// package to marshal further.
func MarshalForLog(sf *statefile.File, schemas *terraform.Schemas) (*State, error) {
func MarshalForLog(sf *statefile.File, schemas *opentf.Schemas) (*State, error) {
output := newState()
if sf == nil || sf.State.Empty() {
@ -190,7 +190,7 @@ func MarshalForLog(sf *statefile.File, schemas *terraform.Schemas) (*State, erro
}
// Marshal returns the json encoding of a terraform state.
func Marshal(sf *statefile.File, schemas *terraform.Schemas) ([]byte, error) {
func Marshal(sf *statefile.File, schemas *opentf.Schemas) ([]byte, error) {
output, err := MarshalForLog(sf, schemas)
if err != nil {
return nil, err
@ -200,7 +200,7 @@ func Marshal(sf *statefile.File, schemas *terraform.Schemas) ([]byte, error) {
return ret, err
}
func (jsonstate *State) marshalStateValues(s *states.State, schemas *terraform.Schemas) error {
func (jsonstate *State) marshalStateValues(s *states.State, schemas *opentf.Schemas) error {
var sv StateValues
var err error
@ -248,7 +248,7 @@ func MarshalOutputs(outputs map[string]*states.OutputValue) (map[string]Output,
return ret, nil
}
func marshalRootModule(s *states.State, schemas *terraform.Schemas) (Module, error) {
func marshalRootModule(s *states.State, schemas *opentf.Schemas) (Module, error) {
var ret Module
var err error
@ -295,7 +295,7 @@ func marshalRootModule(s *states.State, schemas *terraform.Schemas) (Module, err
// out of terraform state.
func marshalModules(
s *states.State,
schemas *terraform.Schemas,
schemas *opentf.Schemas,
modules []addrs.ModuleInstance,
moduleMap map[string][]addrs.ModuleInstance,
) ([]Module, error) {
@ -333,7 +333,7 @@ func marshalModules(
return ret, nil
}
func marshalResources(resources map[string]*states.Resource, module addrs.ModuleInstance, schemas *terraform.Schemas) ([]Resource, error) {
func marshalResources(resources map[string]*states.Resource, module addrs.ModuleInstance, schemas *opentf.Schemas) ([]Resource, error) {
var ret []Resource
var sortedResources []*states.Resource

View File

@ -16,7 +16,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/lang/marks"
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
)
func TestMarshalOutputs(t *testing.T) {
@ -183,7 +183,7 @@ func TestMarshalResources(t *testing.T) {
deposedKey := states.NewDeposedKey()
tests := map[string]struct {
Resources map[string]*states.Resource
Schemas *terraform.Schemas
Schemas *opentf.Schemas
Want []Resource
Err bool
}{
@ -806,8 +806,8 @@ func TestMarshalModules_parent_no_resources(t *testing.T) {
}
}
func testSchemas() *terraform.Schemas {
return &terraform.Schemas{
func testSchemas() *opentf.Schemas {
return &opentf.Schemas{
Providers: map[addrs.Provider]providers.ProviderSchema{
addrs.NewDefaultProvider("test"): {
ResourceTypes: map[string]providers.Schema{

View File

@ -27,7 +27,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/cliconfig"
"github.com/placeholderplaceholderplaceholder/opentf/internal/httpclient"
"github.com/placeholderplaceholderplaceholder/opentf/internal/logging"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
uuid "github.com/hashicorp/go-uuid"
@ -546,7 +546,7 @@ func (c *LoginCommand) interactiveGetTokenByPassword(hostname svchost.Hostname,
c.Ui.Output("\n---------------------------------------------------------------------------------\n")
c.Ui.Output("OpenTF must temporarily use your password to request an API token.\nThis password will NOT be saved locally.\n")
username, err := c.UIInput().Input(context.Background(), &terraform.InputOpts{
username, err := c.UIInput().Input(context.Background(), &opentf.InputOpts{
Id: "username",
Query: fmt.Sprintf("Username for %s:", hostname.ForDisplay()),
})
@ -554,7 +554,7 @@ func (c *LoginCommand) interactiveGetTokenByPassword(hostname svchost.Hostname,
diags = diags.Append(fmt.Errorf("Failed to request username: %s", err))
return nil, diags
}
password, err := c.UIInput().Input(context.Background(), &terraform.InputOpts{
password, err := c.UIInput().Input(context.Background(), &opentf.InputOpts{
Id: "password",
Query: fmt.Sprintf("Password for %s:", hostname.ForDisplay()),
Secret: true,
@ -637,7 +637,7 @@ func (c *LoginCommand) interactiveGetTokenByUI(hostname svchost.Hostname, credsC
}
}
token, err := c.UIInput().Input(context.Background(), &terraform.InputOpts{
token, err := c.UIInput().Input(context.Background(), &opentf.InputOpts{
Id: "token",
Query: fmt.Sprintf("Token for %s:", hostname.ForDisplay()),
Secret: true,
@ -698,7 +698,7 @@ func (c *LoginCommand) interactiveContextConsent(hostname svchost.Hostname, gran
}
}
v, err := c.UIInput().Input(context.Background(), &terraform.InputOpts{
v, err := c.UIInput().Input(context.Background(), &opentf.InputOpts{
Id: "approve",
Query: "Do you want to proceed?",
Description: `Only 'yes' will be accepted to confirm.`,

View File

@ -38,7 +38,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/provisioners"
"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/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
@ -334,8 +334,8 @@ const (
)
// InputMode returns the type of input we should ask for in the form of
// terraform.InputMode which is passed directly to Context.Input.
func (m *Meta) InputMode() terraform.InputMode {
// opentf.InputMode which is passed directly to Context.Input.
func (m *Meta) InputMode() opentf.InputMode {
if test || !m.input {
return 0
}
@ -348,14 +348,14 @@ func (m *Meta) InputMode() terraform.InputMode {
}
}
var mode terraform.InputMode
mode |= terraform.InputModeProvider
var mode opentf.InputMode
mode |= opentf.InputModeProvider
return mode
}
// UIInput returns a UIInput object to be used for asking for input.
func (m *Meta) UIInput() terraform.UIInput {
func (m *Meta) UIInput() opentf.UIInput {
return &UIInput{
Colorize: m.Colorize(),
}
@ -518,13 +518,13 @@ func (m *Meta) RunOperation(b backend.Enhanced, opReq *backend.Operation) (*back
// contextOpts returns the options to use to initialize a Terraform
// context with the settings from this Meta.
func (m *Meta) contextOpts() (*terraform.ContextOpts, error) {
func (m *Meta) contextOpts() (*opentf.ContextOpts, error) {
workspace, err := m.Workspace()
if err != nil {
return nil, err
}
var opts terraform.ContextOpts
var opts opentf.ContextOpts
opts.UIInput = m.UIInput()
opts.Parallelism = m.parallelism
@ -542,7 +542,7 @@ func (m *Meta) contextOpts() (*terraform.ContextOpts, error) {
opts.Provisioners = m.provisionerFactories()
}
opts.Meta = &terraform.ContextMeta{
opts.Meta = &opentf.ContextMeta{
Env: workspace,
OriginalWorkingDir: m.WorkingDir.OriginalWorkingDir(),
}
@ -651,7 +651,7 @@ func (m *Meta) uiHook() *views.UiHook {
}
// confirm asks a yes/no confirmation.
func (m *Meta) confirm(opts *terraform.InputOpts) (bool, error) {
func (m *Meta) confirm(opts *opentf.InputOpts) (bool, error) {
if !m.Input() {
return false, errors.New("input is disabled")
}
@ -833,7 +833,7 @@ func (m *Meta) checkRequiredVersion() tfdiags.Diagnostics {
return diags
}
versionDiags := terraform.CheckCoreVersionRequirements(config)
versionDiags := opentf.CheckCoreVersionRequirements(config)
if versionDiags.HasErrors() {
diags = diags.Append(versionDiags)
return diags
@ -847,7 +847,7 @@ func (m *Meta) checkRequiredVersion() tfdiags.Diagnostics {
// it could potentially return nil without errors. It is the
// responsibility of the caller to handle the lack of schema
// information accordingly
func (c *Meta) MaybeGetSchemas(state *states.State, config *configs.Config) (*terraform.Schemas, tfdiags.Diagnostics) {
func (c *Meta) MaybeGetSchemas(state *states.State, config *configs.Config) (*opentf.Schemas, tfdiags.Diagnostics) {
var diags tfdiags.Diagnostics
path, err := os.Getwd()
@ -870,7 +870,7 @@ func (c *Meta) MaybeGetSchemas(state *states.State, config *configs.Config) (*te
diags = diags.Append(err)
return nil, diags
}
tfCtx, ctxDiags := terraform.NewContext(opts)
tfCtx, ctxDiags := opentf.NewContext(opts)
diags = diags.Append(ctxDiags)
if ctxDiags.HasErrors() {
return nil, diags

View File

@ -30,7 +30,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs"
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
"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"
backendInit "github.com/placeholderplaceholderplaceholder/opentf/internal/backend/init"
@ -227,7 +227,7 @@ func (m *Meta) selectWorkspace(b backend.Backend) error {
// len is always 1 if using Name; 0 means we're using Tags and there
// aren't any matching workspaces. Which might be normal and fine, so
// let's just ask:
name, err := m.UIInput().Input(context.Background(), &terraform.InputOpts{
name, err := m.UIInput().Input(context.Background(), &opentf.InputOpts{
Id: "create-workspace",
Query: "\n[reset][bold][yellow]No workspaces found.[reset]",
Description: fmt.Sprintf(inputCloudInitCreateWorkspace, strings.Join(c.WorkspaceMapping.Tags, ", ")),
@ -274,7 +274,7 @@ func (m *Meta) selectWorkspace(b backend.Backend) error {
}
// Otherwise, ask the user to select a workspace from the list of existing workspaces.
v, err := m.UIInput().Input(context.Background(), &terraform.InputOpts{
v, err := m.UIInput().Input(context.Background(), &opentf.InputOpts{
Id: "select-workspace",
Query: fmt.Sprintf(
"\n[reset][bold][yellow]The currently selected workspace (%s) does not exist.[reset]",

View File

@ -23,7 +23,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views"
"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"
)
type backendMigrateOpts struct {
@ -168,7 +168,7 @@ func (m *Meta) backendMigrateState_S_S(opts *backendMigrateOpts) error {
if !migrate {
var err error
// Ask the user if they want to migrate their existing remote state
migrate, err = m.confirm(&terraform.InputOpts{
migrate, err = m.confirm(&opentf.InputOpts{
Id: "backend-migrate-multistate-to-multistate",
Query: fmt.Sprintf(
"Do you want to migrate all workspaces to %q?",
@ -228,7 +228,7 @@ func (m *Meta) backendMigrateState_S_s(opts *backendMigrateOpts) error {
if !migrate {
var err error
// Ask the user if they want to migrate their existing remote state
migrate, err = m.confirm(&terraform.InputOpts{
migrate, err = m.confirm(&opentf.InputOpts{
Id: "backend-migrate-multistate-to-single",
Query: fmt.Sprintf(
"Destination state %q doesn't support workspaces.\n"+
@ -461,15 +461,15 @@ func (m *Meta) backendMigrateState_s_s(opts *backendMigrateOpts) error {
}
func (m *Meta) backendMigrateEmptyConfirm(source, destination statemgr.Full, opts *backendMigrateOpts) (bool, error) {
var inputOpts *terraform.InputOpts
var inputOpts *opentf.InputOpts
if opts.DestinationType == "cloud" {
inputOpts = &terraform.InputOpts{
inputOpts = &opentf.InputOpts{
Id: "backend-migrate-copy-to-empty-cloud",
Query: "Do you want to copy existing state to Terraform Cloud?",
Description: fmt.Sprintf(strings.TrimSpace(inputBackendMigrateEmptyCloud), opts.SourceType),
}
} else {
inputOpts = &terraform.InputOpts{
inputOpts = &opentf.InputOpts{
Id: "backend-migrate-copy-to-empty",
Query: "Do you want to copy existing state to the new backend?",
Description: fmt.Sprintf(
@ -511,9 +511,9 @@ func (m *Meta) backendMigrateNonEmptyConfirm(
}
// Ask for confirmation
var inputOpts *terraform.InputOpts
var inputOpts *opentf.InputOpts
if opts.DestinationType == "cloud" {
inputOpts = &terraform.InputOpts{
inputOpts = &opentf.InputOpts{
Id: "backend-migrate-to-tfc",
Query: "Do you want to copy existing state to Terraform Cloud?",
Description: fmt.Sprintf(
@ -521,7 +521,7 @@ func (m *Meta) backendMigrateNonEmptyConfirm(
opts.SourceType, sourcePath, destinationPath),
}
} else {
inputOpts = &terraform.InputOpts{
inputOpts = &opentf.InputOpts{
Id: "backend-migrate-to-backend",
Query: "Do you want to copy existing state to the new backend?",
Description: fmt.Sprintf(
@ -808,7 +808,7 @@ func (m *Meta) promptSingleToCloudSingleStateMigration(opts *backendMigrateOpts)
migrate := opts.force
if !migrate {
var err error
migrate, err = m.confirm(&terraform.InputOpts{
migrate, err = m.confirm(&opentf.InputOpts{
Id: "backend-migrate-state-single-to-cloud-single",
Query: "Do you wish to proceed?",
Description: strings.TrimSpace(tfcInputBackendMigrateStateSingleToCloudSingle),
@ -829,7 +829,7 @@ func (m *Meta) promptRemotePrefixToCloudTagsMigration(opts *backendMigrateOpts)
migrate := opts.force
if !migrate {
var err error
migrate, err = m.confirm(&terraform.InputOpts{
migrate, err = m.confirm(&opentf.InputOpts{
Id: "backend-migrate-remote-multistate-to-cloud",
Query: "Do you wish to proceed?",
Description: strings.TrimSpace(tfcInputBackendMigrateRemoteMultiToCloud),
@ -856,7 +856,7 @@ func (m *Meta) promptMultiToSingleCloudMigration(opts *backendMigrateOpts) error
if !migrate {
var err error
// Ask the user if they want to migrate their existing remote state
migrate, err = m.confirm(&terraform.InputOpts{
migrate, err = m.confirm(&opentf.InputOpts{
Id: "backend-migrate-multistate-to-single",
Query: "Do you want to copy only your current workspace?",
Description: fmt.Sprintf(
@ -885,7 +885,7 @@ func (m *Meta) promptNewWorkspaceName(destinationType string) (string, error) {
}
message = `[reset][bold][yellow]Terraform Cloud requires all workspaces to be given an explicit name.[reset]`
}
name, err := m.UIInput().Input(context.Background(), &terraform.InputOpts{
name, err := m.UIInput().Input(context.Background(), &opentf.InputOpts{
Id: "new-state-name",
Query: message,
Description: strings.TrimSpace(inputBackendNewWorkspaceName),
@ -900,7 +900,7 @@ func (m *Meta) promptNewWorkspaceName(destinationType string) (string, error) {
func (m *Meta) promptMultiStateMigrationPattern(sourceType string) (string, error) {
// This is not the first prompt a user would be presented with in the migration to TFC, so no
// guard on m.input is needed here.
renameWorkspaces, err := m.UIInput().Input(context.Background(), &terraform.InputOpts{
renameWorkspaces, err := m.UIInput().Input(context.Background(), &opentf.InputOpts{
Id: "backend-migrate-multistate-to-tfc",
Query: fmt.Sprintf("[reset][bold][yellow]%s[reset]", "Would you like to rename your workspaces?"),
Description: fmt.Sprintf(strings.TrimSpace(tfcInputBackendMigrateMultiToMulti), sourceType),
@ -918,7 +918,7 @@ func (m *Meta) promptMultiStateMigrationPattern(sourceType string) (string, erro
return "*", nil
}
pattern, err := m.UIInput().Input(context.Background(), &terraform.InputOpts{
pattern, err := m.UIInput().Input(context.Background(), &opentf.InputOpts{
Id: "backend-migrate-multistate-to-tfc-pattern",
Query: fmt.Sprintf("[reset][bold][yellow]%s[reset]", "How would you like to rename your workspaces?"),
Description: strings.TrimSpace(tfcInputBackendMigrateMultiToMultiPattern),

View File

@ -22,7 +22,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema"
"github.com/placeholderplaceholderplaceholder/opentf/internal/initwd"
"github.com/placeholderplaceholderplaceholder/opentf/internal/registry"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
@ -282,7 +282,7 @@ func (m *Meta) inputForSchema(given cty.Value, schema *configschema.Block) (cty.
attrS := schema.Attributes[name]
for {
strVal, err := input.Input(context.Background(), &terraform.InputOpts{
strVal, err := input.Input(context.Background(), &opentf.InputOpts{
Id: name,
Query: name,
Description: attrS.Description,

View File

@ -17,7 +17,7 @@ import (
"github.com/mitchellh/cli"
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend/local"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
)
func TestMetaColorize(t *testing.T) {
@ -90,7 +90,7 @@ func TestMetaInputMode(t *testing.T) {
t.Fatalf("err: %s", err)
}
if m.InputMode() != terraform.InputModeStd {
if m.InputMode() != opentf.InputModeStd {
t.Fatalf("bad: %#v", m.InputMode())
}
}
@ -109,11 +109,11 @@ func TestMetaInputMode_envVar(t *testing.T) {
t.Fatalf("err: %s", err)
}
off := terraform.InputMode(0)
on := terraform.InputModeStd
off := opentf.InputMode(0)
on := opentf.InputModeStd
cases := []struct {
EnvVar string
Expected terraform.InputMode
Expected opentf.InputMode
}{
{"false", off},
{"0", off},

View File

@ -15,7 +15,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
@ -56,7 +56,7 @@ func (m *Meta) collectVariableValues() (map[string]backend.UnparsedVariableValue
ret[name] = unparsedVariableValueString{
str: rawVal,
name: name,
sourceType: terraform.ValueFromEnvVar,
sourceType: opentf.ValueFromEnvVar,
}
}
}
@ -66,12 +66,12 @@ func (m *Meta) collectVariableValues() (map[string]backend.UnparsedVariableValue
// (DefaultVarsFilename) along with the later-added search for all files
// ending in .auto.tfvars.
if _, err := os.Stat(DefaultVarsFilename); err == nil {
moreDiags := m.addVarsFromFile(DefaultVarsFilename, terraform.ValueFromAutoFile, ret)
moreDiags := m.addVarsFromFile(DefaultVarsFilename, opentf.ValueFromAutoFile, ret)
diags = diags.Append(moreDiags)
}
const defaultVarsFilenameJSON = DefaultVarsFilename + ".json"
if _, err := os.Stat(defaultVarsFilenameJSON); err == nil {
moreDiags := m.addVarsFromFile(defaultVarsFilenameJSON, terraform.ValueFromAutoFile, ret)
moreDiags := m.addVarsFromFile(defaultVarsFilenameJSON, opentf.ValueFromAutoFile, ret)
diags = diags.Append(moreDiags)
}
if infos, err := ioutil.ReadDir("."); err == nil {
@ -81,7 +81,7 @@ func (m *Meta) collectVariableValues() (map[string]backend.UnparsedVariableValue
if !isAutoVarFile(name) {
continue
}
moreDiags := m.addVarsFromFile(name, terraform.ValueFromAutoFile, ret)
moreDiags := m.addVarsFromFile(name, opentf.ValueFromAutoFile, ret)
diags = diags.Append(moreDiags)
}
}
@ -117,11 +117,11 @@ func (m *Meta) collectVariableValues() (map[string]backend.UnparsedVariableValue
ret[name] = unparsedVariableValueString{
str: rawVal,
name: name,
sourceType: terraform.ValueFromCLIArg,
sourceType: opentf.ValueFromCLIArg,
}
case "-var-file":
moreDiags := m.addVarsFromFile(rawFlag.Value, terraform.ValueFromNamedFile, ret)
moreDiags := m.addVarsFromFile(rawFlag.Value, opentf.ValueFromNamedFile, ret)
diags = diags.Append(moreDiags)
default:
@ -134,7 +134,7 @@ func (m *Meta) collectVariableValues() (map[string]backend.UnparsedVariableValue
return ret, diags
}
func (m *Meta) addVarsFromFile(filename string, sourceType terraform.ValueSourceType, to map[string]backend.UnparsedVariableValue) tfdiags.Diagnostics {
func (m *Meta) addVarsFromFile(filename string, sourceType opentf.ValueSourceType, to map[string]backend.UnparsedVariableValue) tfdiags.Diagnostics {
var diags tfdiags.Diagnostics
src, err := ioutil.ReadFile(filename)
@ -229,17 +229,17 @@ func (m *Meta) addVarsFromFile(filename string, sourceType terraform.ValueSource
// intended to deal with expressions inside "tfvars" files.
type unparsedVariableValueExpression struct {
expr hcl.Expression
sourceType terraform.ValueSourceType
sourceType opentf.ValueSourceType
}
func (v unparsedVariableValueExpression) ParseVariableValue(mode configs.VariableParsingMode) (*terraform.InputValue, tfdiags.Diagnostics) {
func (v unparsedVariableValueExpression) ParseVariableValue(mode configs.VariableParsingMode) (*opentf.InputValue, tfdiags.Diagnostics) {
var diags tfdiags.Diagnostics
val, hclDiags := v.expr.Value(nil) // nil because no function calls or variable references are allowed here
diags = diags.Append(hclDiags)
rng := tfdiags.SourceRangeFromHCL(v.expr.Range())
return &terraform.InputValue{
return &opentf.InputValue{
Value: val,
SourceType: v.sourceType,
SourceRange: rng,
@ -253,16 +253,16 @@ func (v unparsedVariableValueExpression) ParseVariableValue(mode configs.Variabl
type unparsedVariableValueString struct {
str string
name string
sourceType terraform.ValueSourceType
sourceType opentf.ValueSourceType
}
func (v unparsedVariableValueString) ParseVariableValue(mode configs.VariableParsingMode) (*terraform.InputValue, tfdiags.Diagnostics) {
func (v unparsedVariableValueString) ParseVariableValue(mode configs.VariableParsingMode) (*opentf.InputValue, tfdiags.Diagnostics) {
var diags tfdiags.Diagnostics
val, hclDiags := mode.Parse(v.name, v.str)
diags = diags.Append(hclDiags)
return &terraform.InputValue{
return &opentf.InputValue{
Value: val,
SourceType: v.sourceType,
}, diags

View File

@ -26,7 +26,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
@ -1436,7 +1436,7 @@ func TestPlan_parallelism(t *testing.T) {
providerFactories := map[addrs.Provider]providers.Factory{}
for i := 0; i < 10; i++ {
name := fmt.Sprintf("test%d", i)
provider := &terraform.MockProvider{}
provider := &opentf.MockProvider{}
provider.GetProviderSchemaResponse = &providers.GetProviderSchemaResponse{
ResourceTypes: map[string]providers.Schema{
name + "_instance": {Block: &configschema.Block{}},
@ -1632,7 +1632,7 @@ func planFixtureSchema() *providers.GetProviderSchemaResponse {
// operation with the configuration in testdata/plan. This mock has
// GetSchemaResponse and PlanResourceChangeFn populated, with the plan
// step just passing through the new object proposed by Terraform Core.
func planFixtureProvider() *terraform.MockProvider {
func planFixtureProvider() *opentf.MockProvider {
p := testProvider()
p.GetProviderSchemaResponse = planFixtureSchema()
p.PlanResourceChangeFn = func(req providers.PlanResourceChangeRequest) providers.PlanResourceChangeResponse {
@ -1673,7 +1673,7 @@ func planVarsFixtureSchema() *providers.GetProviderSchemaResponse {
// operation with the configuration in testdata/plan-vars. This mock has
// GetSchemaResponse and PlanResourceChangeFn populated, with the plan
// step just passing through the new object proposed by Terraform Core.
func planVarsFixtureProvider() *terraform.MockProvider {
func planVarsFixtureProvider() *opentf.MockProvider {
p := testProvider()
p.GetProviderSchemaResponse = planVarsFixtureSchema()
p.PlanResourceChangeFn = func(req providers.PlanResourceChangeRequest) providers.PlanResourceChangeResponse {
@ -1695,7 +1695,7 @@ func planVarsFixtureProvider() *terraform.MockProvider {
// planFixtureProvider returns a mock provider that is configured for basic
// operation with the configuration in testdata/plan. This mock has
// GetSchemaResponse and PlanResourceChangeFn populated, returning 3 warnings.
func planWarningsFixtureProvider() *terraform.MockProvider {
func planWarningsFixtureProvider() *opentf.MockProvider {
p := testProvider()
p.GetProviderSchemaResponse = planFixtureSchema()
p.PlanResourceChangeFn = func(req providers.PlanResourceChangeRequest) providers.PlanResourceChangeResponse {

View File

@ -15,7 +15,7 @@ import (
"github.com/mitchellh/cli"
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema"
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/zclconf/go-cty/cty"
)
@ -116,7 +116,7 @@ type providerSchema struct {
// testProvider returns a mock provider that is configured for basic
// operation with the configuration in testdata/providers-schema.
func providersSchemaFixtureProvider() *terraform.MockProvider {
func providersSchemaFixtureProvider() *opentf.MockProvider {
p := testProvider()
p.GetProviderSchemaResponse = providersSchemaFixtureSchema()
return p

View File

@ -20,7 +20,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"
)
@ -107,13 +107,13 @@ func (c *ShowCommand) Synopsis() string {
return "Show the current state or a saved plan"
}
func (c *ShowCommand) show(path string) (*plans.Plan, *cloudplan.RemotePlanJSON, *statefile.File, *configs.Config, *terraform.Schemas, tfdiags.Diagnostics) {
func (c *ShowCommand) show(path string) (*plans.Plan, *cloudplan.RemotePlanJSON, *statefile.File, *configs.Config, *opentf.Schemas, tfdiags.Diagnostics) {
var diags, showDiags tfdiags.Diagnostics
var plan *plans.Plan
var jsonPlan *cloudplan.RemotePlanJSON
var stateFile *statefile.File
var config *configs.Config
var schemas *terraform.Schemas
var schemas *opentf.Schemas
// No plan file or state file argument provided,
// so get the latest state snapshot

View File

@ -21,7 +21,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"
"github.com/placeholderplaceholderplaceholder/opentf/version"
)
@ -1054,7 +1054,7 @@ func showFixtureSensitiveSchema() *providers.GetProviderSchemaResponse {
// GetSchemaResponse, PlanResourceChangeFn, and ApplyResourceChangeFn populated,
// with the plan/apply steps just passing through the data determined by
// Terraform Core.
func showFixtureProvider() *terraform.MockProvider {
func showFixtureProvider() *opentf.MockProvider {
p := testProvider()
p.GetProviderSchemaResponse = showFixtureSchema()
p.ReadResourceFn = func(req providers.ReadResourceRequest) providers.ReadResourceResponse {
@ -1117,7 +1117,7 @@ func showFixtureProvider() *terraform.MockProvider {
// GetSchemaResponse, PlanResourceChangeFn, and ApplyResourceChangeFn populated,
// with the plan/apply steps just passing through the data determined by
// Terraform Core. It also has a sensitive attribute in the provider schema.
func showFixtureSensitiveProvider() *terraform.MockProvider {
func showFixtureSensitiveProvider() *opentf.MockProvider {
p := testProvider()
p.GetProviderSchemaResponse = showFixtureSensitiveSchema()
p.PlanResourceChangeFn = func(req providers.PlanResourceChangeRequest) providers.PlanResourceChangeResponse {

View File

@ -15,7 +15,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/clistate"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
@ -398,7 +398,7 @@ func (c *StateMvCommand) Run(args []string) int {
}
// Get schemas, if possible, before writing state
var schemas *terraform.Schemas
var schemas *opentf.Schemas
if isCloudMode(b) {
var schemaDiags tfdiags.Diagnostics
schemas, schemaDiags = c.MaybeGetSchemas(stateTo, nil)

View File

@ -16,7 +16,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views"
"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"
)
@ -134,7 +134,7 @@ func (c *StatePushCommand) Run(args []string) int {
}
// Get schemas, if possible, before writing state
var schemas *terraform.Schemas
var schemas *opentf.Schemas
var diags tfdiags.Diagnostics
if isCloudMode(b) {
schemas, diags = c.MaybeGetSchemas(srcStateFile.State, nil)

View File

@ -14,7 +14,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/clistate"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
@ -173,7 +173,7 @@ func (c *StateReplaceProviderCommand) Run(args []string) int {
}
// Get schemas, if possible, before writing state
var schemas *terraform.Schemas
var schemas *opentf.Schemas
if isCloudMode(b) {
var schemaDiags tfdiags.Diagnostics
schemas, schemaDiags = c.MaybeGetSchemas(state, nil)

View File

@ -13,7 +13,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/arguments"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/clistate"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
@ -123,7 +123,7 @@ func (c *StateRmCommand) Run(args []string) int {
}
// Get schemas, if possible, before writing state
var schemas *terraform.Schemas
var schemas *opentf.Schemas
if isCloudMode(b) {
var schemaDiags tfdiags.Diagnostics
schemas, schemaDiags = c.MaybeGetSchemas(state, nil)

View File

@ -12,7 +12,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/clistate"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
@ -130,7 +130,7 @@ func (c *TaintCommand) Run(args []string) int {
}
// Get schemas, if possible, before writing state
var schemas *terraform.Schemas
var schemas *opentf.Schemas
if isCloudMode(b) {
var schemaDiags tfdiags.Diagnostics
schemas, schemaDiags = c.MaybeGetSchemas(state, nil)

View File

@ -22,7 +22,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/moduletest"
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
@ -308,7 +308,7 @@ type TestSuiteRunner struct {
Config *configs.Config
GlobalVariables map[string]backend.UnparsedVariableValue
Opts *terraform.ContextOpts
Opts *opentf.ContextOpts
View views.Test
@ -615,7 +615,7 @@ func (runner *TestFileRunner) validate(config *configs.Config, run *moduletest.R
var diags tfdiags.Diagnostics
tfCtx, ctxDiags := terraform.NewContext(runner.Suite.Opts)
tfCtx, ctxDiags := opentf.NewContext(runner.Suite.Opts)
diags = diags.Append(ctxDiags)
if ctxDiags.HasErrors() {
return diags
@ -662,12 +662,12 @@ func (runner *TestFileRunner) destroy(config *configs.Config, state *states.Stat
return state, diags
}
planOpts := &terraform.PlanOpts{
planOpts := &opentf.PlanOpts{
Mode: plans.DestroyMode,
SetVariables: variables,
}
tfCtx, ctxDiags := terraform.NewContext(runner.Suite.Opts)
tfCtx, ctxDiags := opentf.NewContext(runner.Suite.Opts)
diags = diags.Append(ctxDiags)
if ctxDiags.HasErrors() {
return state, diags
@ -703,7 +703,7 @@ func (runner *TestFileRunner) destroy(config *configs.Config, state *states.Stat
return updated, diags
}
func (runner *TestFileRunner) plan(config *configs.Config, state *states.State, run *moduletest.Run, file *moduletest.File) (*terraform.Context, *plans.Plan, tfdiags.Diagnostics) {
func (runner *TestFileRunner) plan(config *configs.Config, state *states.State, run *moduletest.Run, file *moduletest.File) (*opentf.Context, *plans.Plan, tfdiags.Diagnostics) {
log.Printf("[TRACE] TestFileRunner: called plan for %s/%s", file.Name, run.Name)
var diags tfdiags.Diagnostics
@ -724,7 +724,7 @@ func (runner *TestFileRunner) plan(config *configs.Config, state *states.State,
return nil, nil, diags
}
planOpts := &terraform.PlanOpts{
planOpts := &opentf.PlanOpts{
Mode: func() plans.Mode {
switch run.Config.Options.Mode {
case configs.RefreshOnlyTestMode:
@ -740,7 +740,7 @@ func (runner *TestFileRunner) plan(config *configs.Config, state *states.State,
ExternalReferences: references,
}
tfCtx, ctxDiags := terraform.NewContext(runner.Suite.Opts)
tfCtx, ctxDiags := opentf.NewContext(runner.Suite.Opts)
diags = diags.Append(ctxDiags)
if ctxDiags.HasErrors() {
return nil, nil, diags
@ -770,7 +770,7 @@ func (runner *TestFileRunner) plan(config *configs.Config, state *states.State,
return tfCtx, plan, diags
}
func (runner *TestFileRunner) apply(plan *plans.Plan, state *states.State, config *configs.Config, run *moduletest.Run, file *moduletest.File) (*terraform.Context, *states.State, tfdiags.Diagnostics) {
func (runner *TestFileRunner) apply(plan *plans.Plan, state *states.State, config *configs.Config, run *moduletest.Run, file *moduletest.File) (*opentf.Context, *states.State, tfdiags.Diagnostics) {
log.Printf("[TRACE] TestFileRunner: called apply for %s/%s", file.Name, run.Name)
var diags tfdiags.Diagnostics
@ -794,7 +794,7 @@ func (runner *TestFileRunner) apply(plan *plans.Plan, state *states.State, confi
created = append(created, change)
}
tfCtx, ctxDiags := terraform.NewContext(runner.Suite.Opts)
tfCtx, ctxDiags := opentf.NewContext(runner.Suite.Opts)
diags = diags.Append(ctxDiags)
if ctxDiags.HasErrors() {
return nil, state, diags
@ -824,7 +824,7 @@ func (runner *TestFileRunner) apply(plan *plans.Plan, state *states.State, confi
return tfCtx, updated, diags
}
func (runner *TestFileRunner) wait(ctx *terraform.Context, runningCtx context.Context, run *moduletest.Run, file *moduletest.File, created []*plans.ResourceInstanceChangeSrc) (diags tfdiags.Diagnostics, cancelled bool) {
func (runner *TestFileRunner) wait(ctx *opentf.Context, runningCtx context.Context, run *moduletest.Run, file *moduletest.File, created []*plans.ResourceInstanceChangeSrc) (diags tfdiags.Diagnostics, cancelled bool) {
var identifier string
if file == nil {
identifier = "validate"
@ -997,13 +997,13 @@ func (runner *TestFileRunner) Cleanup(file *moduletest.File) {
// helper functions
// buildInputVariablesForTest creates a terraform.InputValues mapping for
// buildInputVariablesForTest creates a opentf.InputValues mapping for
// variable values that are relevant to the config being tested.
//
// Crucially, it differs from prepareInputVariablesForAssertions in that it only
// includes variables that are reference by the config and not everything that
// is defined within the test run block and test file.
func buildInputVariablesForTest(run *moduletest.Run, file *moduletest.File, config *configs.Config, globals map[string]backend.UnparsedVariableValue) (terraform.InputValues, tfdiags.Diagnostics) {
func buildInputVariablesForTest(run *moduletest.Run, file *moduletest.File, config *configs.Config, globals map[string]backend.UnparsedVariableValue) (opentf.InputValues, tfdiags.Diagnostics) {
variables := make(map[string]backend.UnparsedVariableValue)
for name := range config.Module.Variables {
if run != nil {
@ -1011,7 +1011,7 @@ func buildInputVariablesForTest(run *moduletest.Run, file *moduletest.File, conf
// Local variables take precedence.
variables[name] = unparsedVariableValueExpression{
expr: expr,
sourceType: terraform.ValueFromConfig,
sourceType: opentf.ValueFromConfig,
}
continue
}
@ -1022,7 +1022,7 @@ func buildInputVariablesForTest(run *moduletest.Run, file *moduletest.File, conf
// If it's not set locally, it maybe set for the entire file.
variables[name] = unparsedVariableValueExpression{
expr: expr,
sourceType: terraform.ValueFromConfig,
sourceType: opentf.ValueFromConfig,
}
continue
}
@ -1043,7 +1043,7 @@ func buildInputVariablesForTest(run *moduletest.Run, file *moduletest.File, conf
return backend.ParseVariableValues(variables, config.Module.Variables)
}
// prepareInputVariablesForAssertions creates a terraform.InputValues mapping
// prepareInputVariablesForAssertions creates a opentf.InputValues mapping
// that contains all the variables defined for a given run and file, alongside
// any unset variables that have defaults within the provided config.
//
@ -1055,14 +1055,14 @@ func buildInputVariablesForTest(run *moduletest.Run, file *moduletest.File, conf
// In addition, it modifies the provided config so that any variables that are
// available are also defined in the config. It returns a function that resets
// the config which must be called so the config can be reused going forward.
func prepareInputVariablesForAssertions(config *configs.Config, run *moduletest.Run, file *moduletest.File, globals map[string]backend.UnparsedVariableValue) (terraform.InputValues, func(), tfdiags.Diagnostics) {
func prepareInputVariablesForAssertions(config *configs.Config, run *moduletest.Run, file *moduletest.File, globals map[string]backend.UnparsedVariableValue) (opentf.InputValues, func(), tfdiags.Diagnostics) {
variables := make(map[string]backend.UnparsedVariableValue)
if run != nil {
for name, expr := range run.Config.Variables {
variables[name] = unparsedVariableValueExpression{
expr: expr,
sourceType: terraform.ValueFromConfig,
sourceType: opentf.ValueFromConfig,
}
}
}
@ -1076,7 +1076,7 @@ func prepareInputVariablesForAssertions(config *configs.Config, run *moduletest.
}
variables[name] = unparsedVariableValueExpression{
expr: expr,
sourceType: terraform.ValueFromConfig,
sourceType: opentf.ValueFromConfig,
}
}
}
@ -1094,7 +1094,7 @@ func prepareInputVariablesForAssertions(config *configs.Config, run *moduletest.
// We've gathered all the values we have, let's convert them into
// terraform.InputValues so they can be passed into the Terraform graph.
inputs := make(terraform.InputValues, len(variables))
inputs := make(opentf.InputValues, len(variables))
var diags tfdiags.Diagnostics
for name, variable := range variables {
value, valueDiags := variable.ParseVariableValue(configs.VariableParseLiteral)
@ -1114,9 +1114,9 @@ func prepareInputVariablesForAssertions(config *configs.Config, run *moduletest.
}
if variable.Default != cty.NilVal {
inputs[name] = &terraform.InputValue{
inputs[name] = &opentf.InputValue{
Value: variable.Default,
SourceType: terraform.ValueFromConfig,
SourceType: opentf.ValueFromConfig,
SourceRange: tfdiags.SourceRangeFromHCL(variable.DeclRange),
}
}

View File

@ -12,7 +12,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema"
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
@ -54,7 +54,7 @@ var (
// TestProvider is a wrapper around terraform.MockProvider that defines dynamic
// schemas, and keeps track of the resources and data sources that it contains.
type TestProvider struct {
Provider *terraform.MockProvider
Provider *opentf.MockProvider
data, resource cty.Value
@ -71,7 +71,7 @@ func NewProvider(store *ResourceStore) *TestProvider {
}
provider := &TestProvider{
Provider: new(terraform.MockProvider),
Provider: new(opentf.MockProvider),
Store: store,
}

View File

@ -21,7 +21,7 @@ import (
"github.com/bgentry/speakeasy"
"github.com/mattn/go-isatty"
"github.com/mitchellh/colorstring"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
)
var defaultInputReader io.Reader
@ -49,7 +49,7 @@ type UIInput struct {
once sync.Once
}
func (i *UIInput) Input(ctx context.Context, opts *terraform.InputOpts) (string, error) {
func (i *UIInput) Input(ctx context.Context, opts *opentf.InputOpts) (string, error) {
i.once.Do(i.init)
r := i.Reader

View File

@ -12,11 +12,11 @@ import (
"testing"
"time"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
)
func TestUIInput_impl(t *testing.T) {
var _ terraform.UIInput = new(UIInput)
var _ opentf.UIInput = new(UIInput)
}
func TestUIInputInput(t *testing.T) {
@ -25,7 +25,7 @@ func TestUIInputInput(t *testing.T) {
Writer: bytes.NewBuffer(nil),
}
v, err := i.Input(context.Background(), &terraform.InputOpts{})
v, err := i.Input(context.Background(), &opentf.InputOpts{})
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
@ -52,7 +52,7 @@ func TestUIInputInput_canceled(t *testing.T) {
}()
// Get input until the context is canceled.
v, err := i.Input(ctx, &terraform.InputOpts{})
v, err := i.Input(ctx, &opentf.InputOpts{})
if err != context.Canceled {
t.Fatalf("expected a context.Canceled error, got: %v", err)
}
@ -75,7 +75,7 @@ func TestUIInputInput_canceled(t *testing.T) {
w.Close()
}()
v, err = i.Input(context.Background(), &terraform.InputOpts{})
v, err = i.Input(context.Background(), &opentf.InputOpts{})
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
@ -91,7 +91,7 @@ func TestUIInputInput_spaces(t *testing.T) {
Writer: bytes.NewBuffer(nil),
}
v, err := i.Input(context.Background(), &terraform.InputOpts{})
v, err := i.Input(context.Background(), &opentf.InputOpts{})
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
@ -107,7 +107,7 @@ func TestUIInputInput_Error(t *testing.T) {
Writer: bytes.NewBuffer(nil),
}
v, err := i.Input(context.Background(), &terraform.InputOpts{})
v, err := i.Input(context.Background(), &opentf.InputOpts{})
if err == nil {
t.Fatalf("Error is not 'nil'")
}

View File

@ -12,7 +12,7 @@ import (
"github.com/mitchellh/cli"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
@ -94,7 +94,7 @@ func (c *UnlockCommand) Run(args []string) int {
"This will allow local OpenTF commands to modify this state, even though it\n" +
"may still be in use. Only 'yes' will be accepted to confirm."
v, err := c.UIInput().Input(context.Background(), &terraform.InputOpts{
v, err := c.UIInput().Input(context.Background(), &opentf.InputOpts{
Id: "force-unlock",
Query: "Do you really want to force-unlock?",
Description: desc,

View File

@ -12,7 +12,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/clistate"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
@ -169,7 +169,7 @@ func (c *UntaintCommand) Run(args []string) int {
}
// Get schemas, if possible, before writing state
var schemas *terraform.Schemas
var schemas *opentf.Schemas
if isCloudMode(b) {
var schemaDiags tfdiags.Diagnostics
schemas, schemaDiags = c.MaybeGetSchemas(state, nil)

View File

@ -12,7 +12,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/arguments"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views"
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
@ -88,7 +88,7 @@ func (c *ValidateCommand) validate(dir, testDir string, noTests bool) tfdiags.Di
return diags
}
tfCtx, ctxDiags := terraform.NewContext(opts)
tfCtx, ctxDiags := opentf.NewContext(opts)
diags = diags.Append(ctxDiags)
if ctxDiags.HasErrors() {
return diags

View File

@ -10,7 +10,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/format"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views/json"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
@ -20,7 +20,7 @@ type Apply interface {
Outputs(outputValues map[string]*states.OutputValue)
Operation() Operation
Hooks() []terraform.Hook
Hooks() []opentf.Hook
Diagnostics(diags tfdiags.Diagnostics)
HelpPrompt()
@ -99,8 +99,8 @@ func (v *ApplyHuman) Operation() Operation {
return NewOperation(arguments.ViewHuman, v.inAutomation, v.view)
}
func (v *ApplyHuman) Hooks() []terraform.Hook {
return []terraform.Hook{
func (v *ApplyHuman) Hooks() []opentf.Hook {
return []opentf.Hook{
v.countHook,
NewUiHook(v.view),
}
@ -159,8 +159,8 @@ func (v *ApplyJSON) Operation() Operation {
return &OperationJSON{view: v.view}
}
func (v *ApplyJSON) Hooks() []terraform.Hook {
return []terraform.Hook{
func (v *ApplyJSON) Hooks() []opentf.Hook {
return []opentf.Hook{
v.countHook,
newJSONHook(v.view),
}

View File

@ -11,7 +11,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/addrs"
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
)
// countHook is a hook that counts the number of resources
@ -30,10 +30,10 @@ type countHook struct {
pending map[string]plans.Action
sync.Mutex
terraform.NilHook
opentf.NilHook
}
var _ terraform.Hook = (*countHook)(nil)
var _ opentf.Hook = (*countHook)(nil)
func (h *countHook) Reset() {
h.Lock()
@ -46,7 +46,7 @@ func (h *countHook) Reset() {
h.Imported = 0
}
func (h *countHook) PreApply(addr addrs.AbsResourceInstance, gen states.Generation, action plans.Action, priorState, plannedNewState cty.Value) (terraform.HookAction, error) {
func (h *countHook) PreApply(addr addrs.AbsResourceInstance, gen states.Generation, action plans.Action, priorState, plannedNewState cty.Value) (opentf.HookAction, error) {
h.Lock()
defer h.Unlock()
@ -56,10 +56,10 @@ func (h *countHook) PreApply(addr addrs.AbsResourceInstance, gen states.Generati
h.pending[addr.String()] = action
return terraform.HookActionContinue, nil
return opentf.HookActionContinue, nil
}
func (h *countHook) PostApply(addr addrs.AbsResourceInstance, gen states.Generation, newState cty.Value, err error) (terraform.HookAction, error) {
func (h *countHook) PostApply(addr addrs.AbsResourceInstance, gen states.Generation, newState cty.Value, err error) (opentf.HookAction, error) {
h.Lock()
defer h.Unlock()
@ -84,16 +84,16 @@ func (h *countHook) PostApply(addr addrs.AbsResourceInstance, gen states.Generat
}
}
return terraform.HookActionContinue, nil
return opentf.HookActionContinue, nil
}
func (h *countHook) PostDiff(addr addrs.AbsResourceInstance, gen states.Generation, action plans.Action, priorState, plannedNewState cty.Value) (terraform.HookAction, error) {
func (h *countHook) PostDiff(addr addrs.AbsResourceInstance, gen states.Generation, action plans.Action, priorState, plannedNewState cty.Value) (opentf.HookAction, error) {
h.Lock()
defer h.Unlock()
// We don't count anything for data resources
if addr.Resource.Resource.Mode == addrs.DataResourceMode {
return terraform.HookActionContinue, nil
return opentf.HookActionContinue, nil
}
switch action {
@ -107,13 +107,13 @@ func (h *countHook) PostDiff(addr addrs.AbsResourceInstance, gen states.Generati
h.ToChange += 1
}
return terraform.HookActionContinue, nil
return opentf.HookActionContinue, nil
}
func (h *countHook) PostApplyImport(addr addrs.AbsResourceInstance, importing plans.ImportingSrc) (terraform.HookAction, error) {
func (h *countHook) PostApplyImport(addr addrs.AbsResourceInstance, importing plans.ImportingSrc) (opentf.HookAction, error) {
h.Lock()
defer h.Unlock()
h.Imported++
return terraform.HookActionContinue, nil
return opentf.HookActionContinue, nil
}

View File

@ -12,13 +12,13 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/addrs"
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
legacy "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf"
)
func TestCountHook_impl(t *testing.T) {
var _ terraform.Hook = new(countHook)
var _ opentf.Hook = new(countHook)
}
func TestCountHookPostDiff_DestroyDeposed(t *testing.T) {

View File

@ -17,7 +17,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views/json"
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
)
// How long to wait between sending heartbeat/progress messages
@ -33,7 +33,7 @@ func newJSONHook(view *JSONView) *jsonHook {
}
type jsonHook struct {
terraform.NilHook
opentf.NilHook
view *JSONView
@ -47,7 +47,7 @@ type jsonHook struct {
timeAfter func(time.Duration) <-chan time.Time
}
var _ terraform.Hook = (*jsonHook)(nil)
var _ opentf.Hook = (*jsonHook)(nil)
type applyProgress struct {
addr addrs.AbsResourceInstance
@ -62,7 +62,7 @@ type applyProgress struct {
heartbeatDone chan struct{}
}
func (h *jsonHook) PreApply(addr addrs.AbsResourceInstance, gen states.Generation, action plans.Action, priorState, plannedNewState cty.Value) (terraform.HookAction, error) {
func (h *jsonHook) PreApply(addr addrs.AbsResourceInstance, gen states.Generation, action plans.Action, priorState, plannedNewState cty.Value) (opentf.HookAction, error) {
if action != plans.NoOp {
idKey, idValue := format.ObjectValueIDOrName(priorState)
h.view.Hook(json.NewApplyStart(addr, action, idKey, idValue))
@ -82,7 +82,7 @@ func (h *jsonHook) PreApply(addr addrs.AbsResourceInstance, gen states.Generatio
if action != plans.NoOp {
go h.applyingHeartbeat(progress)
}
return terraform.HookActionContinue, nil
return opentf.HookActionContinue, nil
}
func (h *jsonHook) applyingHeartbeat(progress applyProgress) {
@ -99,7 +99,7 @@ func (h *jsonHook) applyingHeartbeat(progress applyProgress) {
}
}
func (h *jsonHook) PostApply(addr addrs.AbsResourceInstance, gen states.Generation, newState cty.Value, err error) (terraform.HookAction, error) {
func (h *jsonHook) PostApply(addr addrs.AbsResourceInstance, gen states.Generation, newState cty.Value, err error) (opentf.HookAction, error) {
key := addr.String()
h.applyingLock.Lock()
progress := h.applying[key]
@ -110,7 +110,7 @@ func (h *jsonHook) PostApply(addr addrs.AbsResourceInstance, gen states.Generati
h.applyingLock.Unlock()
if progress.action == plans.NoOp {
return terraform.HookActionContinue, nil
return opentf.HookActionContinue, nil
}
elapsed := h.timeNow().Round(time.Second).Sub(progress.start)
@ -124,15 +124,15 @@ func (h *jsonHook) PostApply(addr addrs.AbsResourceInstance, gen states.Generati
idKey, idValue := format.ObjectValueID(newState)
h.view.Hook(json.NewApplyComplete(addr, progress.action, idKey, idValue, elapsed))
}
return terraform.HookActionContinue, nil
return opentf.HookActionContinue, nil
}
func (h *jsonHook) PreProvisionInstanceStep(addr addrs.AbsResourceInstance, typeName string) (terraform.HookAction, error) {
func (h *jsonHook) PreProvisionInstanceStep(addr addrs.AbsResourceInstance, typeName string) (opentf.HookAction, error) {
h.view.Hook(json.NewProvisionStart(addr, typeName))
return terraform.HookActionContinue, nil
return opentf.HookActionContinue, nil
}
func (h *jsonHook) PostProvisionInstanceStep(addr addrs.AbsResourceInstance, typeName string, err error) (terraform.HookAction, error) {
func (h *jsonHook) PostProvisionInstanceStep(addr addrs.AbsResourceInstance, typeName string, err error) (opentf.HookAction, error) {
if err != nil {
// Errors are collected and displayed post-apply, so no need to
// re-render them here. Instead just signal that this provisioner step
@ -141,7 +141,7 @@ func (h *jsonHook) PostProvisionInstanceStep(addr addrs.AbsResourceInstance, typ
} else {
h.view.Hook(json.NewProvisionComplete(addr, typeName))
}
return terraform.HookActionContinue, nil
return opentf.HookActionContinue, nil
}
func (h *jsonHook) ProvisionOutput(addr addrs.AbsResourceInstance, typeName string, msg string) {
@ -155,14 +155,14 @@ func (h *jsonHook) ProvisionOutput(addr addrs.AbsResourceInstance, typeName stri
}
}
func (h *jsonHook) PreRefresh(addr addrs.AbsResourceInstance, gen states.Generation, priorState cty.Value) (terraform.HookAction, error) {
func (h *jsonHook) PreRefresh(addr addrs.AbsResourceInstance, gen states.Generation, priorState cty.Value) (opentf.HookAction, error) {
idKey, idValue := format.ObjectValueID(priorState)
h.view.Hook(json.NewRefreshStart(addr, idKey, idValue))
return terraform.HookActionContinue, nil
return opentf.HookActionContinue, nil
}
func (h *jsonHook) PostRefresh(addr addrs.AbsResourceInstance, gen states.Generation, priorState cty.Value, newState cty.Value) (terraform.HookAction, error) {
func (h *jsonHook) PostRefresh(addr addrs.AbsResourceInstance, gen states.Generation, priorState cty.Value, newState cty.Value) (opentf.HookAction, error) {
idKey, idValue := format.ObjectValueID(newState)
h.view.Hook(json.NewRefreshComplete(addr, idKey, idValue))
return terraform.HookActionContinue, nil
return opentf.HookActionContinue, nil
}

View File

@ -13,7 +13,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
"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"
)
@ -329,13 +329,13 @@ func TestJSONHook_refresh(t *testing.T) {
testJSONViewOutputEquals(t, done(t).Stdout(), want)
}
func testHookReturnValues(t *testing.T, action terraform.HookAction, err error) {
func testHookReturnValues(t *testing.T, action opentf.HookAction, err error) {
t.Helper()
if err != nil {
t.Fatal(err)
}
if action != terraform.HookActionContinue {
if action != opentf.HookActionContinue {
t.Fatalf("Expected hook to continue, given: %#v", action)
}
}

View File

@ -19,7 +19,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
)
const defaultPeriodicUiTimer = 10 * time.Second
@ -34,7 +34,7 @@ func NewUiHook(view *View) *UiHook {
}
type UiHook struct {
terraform.NilHook
opentf.NilHook
view *View
viewLock sync.Mutex
@ -45,7 +45,7 @@ type UiHook struct {
resourcesLock sync.Mutex
}
var _ terraform.Hook = (*UiHook)(nil)
var _ opentf.Hook = (*UiHook)(nil)
// uiResourceState tracks the state of a single resource
type uiResourceState struct {
@ -71,7 +71,7 @@ const (
uiResourceNoOp
)
func (h *UiHook) PreApply(addr addrs.AbsResourceInstance, gen states.Generation, action plans.Action, priorState, plannedNewState cty.Value) (terraform.HookAction, error) {
func (h *UiHook) PreApply(addr addrs.AbsResourceInstance, gen states.Generation, action plans.Action, priorState, plannedNewState cty.Value) (opentf.HookAction, error) {
dispAddr := addr.String()
if gen != states.CurrentGen {
dispAddr = fmt.Sprintf("%s (deposed object %s)", dispAddr, gen)
@ -99,7 +99,7 @@ func (h *UiHook) PreApply(addr addrs.AbsResourceInstance, gen states.Generation,
// We don't expect any other actions in here, so anything else is a
// bug in the caller but we'll ignore it in order to be robust.
h.println(fmt.Sprintf("(Unknown action %s for %s)", action, dispAddr))
return terraform.HookActionContinue, nil
return opentf.HookActionContinue, nil
}
var stateIdSuffix string
@ -141,7 +141,7 @@ func (h *UiHook) PreApply(addr addrs.AbsResourceInstance, gen states.Generation,
go h.stillApplying(uiState)
}
return terraform.HookActionContinue, nil
return opentf.HookActionContinue, nil
}
func (h *UiHook) stillApplying(state uiResourceState) {
@ -184,7 +184,7 @@ func (h *UiHook) stillApplying(state uiResourceState) {
}
}
func (h *UiHook) PostApply(addr addrs.AbsResourceInstance, gen states.Generation, newState cty.Value, applyerr error) (terraform.HookAction, error) {
func (h *UiHook) PostApply(addr addrs.AbsResourceInstance, gen states.Generation, newState cty.Value, applyerr error) (opentf.HookAction, error) {
id := addr.String()
h.resourcesLock.Lock()
@ -213,14 +213,14 @@ func (h *UiHook) PostApply(addr addrs.AbsResourceInstance, gen states.Generation
msg = "Read complete"
case uiResourceNoOp:
// We don't make any announcements about no-op changes
return terraform.HookActionContinue, nil
return opentf.HookActionContinue, nil
case uiResourceUnknown:
return terraform.HookActionContinue, nil
return opentf.HookActionContinue, nil
}
if applyerr != nil {
// Errors are collected and printed in ApplyCommand, no need to duplicate
return terraform.HookActionContinue, nil
return opentf.HookActionContinue, nil
}
addrStr := addr.String()
@ -234,15 +234,15 @@ func (h *UiHook) PostApply(addr addrs.AbsResourceInstance, gen states.Generation
h.println(colorized)
return terraform.HookActionContinue, nil
return opentf.HookActionContinue, nil
}
func (h *UiHook) PreProvisionInstanceStep(addr addrs.AbsResourceInstance, typeName string) (terraform.HookAction, error) {
func (h *UiHook) PreProvisionInstanceStep(addr addrs.AbsResourceInstance, typeName string) (opentf.HookAction, error) {
h.println(fmt.Sprintf(
h.view.colorize.Color("[reset][bold]%s: Provisioning with '%s'...[reset]"),
addr, typeName,
))
return terraform.HookActionContinue, nil
return opentf.HookActionContinue, nil
}
func (h *UiHook) ProvisionOutput(addr addrs.AbsResourceInstance, typeName string, msg string) {
@ -264,7 +264,7 @@ func (h *UiHook) ProvisionOutput(addr addrs.AbsResourceInstance, typeName string
h.println(strings.TrimSpace(buf.String()))
}
func (h *UiHook) PreRefresh(addr addrs.AbsResourceInstance, gen states.Generation, priorState cty.Value) (terraform.HookAction, error) {
func (h *UiHook) PreRefresh(addr addrs.AbsResourceInstance, gen states.Generation, priorState cty.Value) (opentf.HookAction, error) {
var stateIdSuffix string
if k, v := format.ObjectValueID(priorState); k != "" && v != "" {
stateIdSuffix = fmt.Sprintf(" [%s=%s]", k, v)
@ -278,18 +278,18 @@ func (h *UiHook) PreRefresh(addr addrs.AbsResourceInstance, gen states.Generatio
h.println(fmt.Sprintf(
h.view.colorize.Color("[reset][bold]%s: Refreshing state...%s"),
addrStr, stateIdSuffix))
return terraform.HookActionContinue, nil
return opentf.HookActionContinue, nil
}
func (h *UiHook) PreImportState(addr addrs.AbsResourceInstance, importID string) (terraform.HookAction, error) {
func (h *UiHook) PreImportState(addr addrs.AbsResourceInstance, importID string) (opentf.HookAction, error) {
h.println(fmt.Sprintf(
h.view.colorize.Color("[reset][bold]%s: Importing from ID %q..."),
addr, importID,
))
return terraform.HookActionContinue, nil
return opentf.HookActionContinue, nil
}
func (h *UiHook) PostImportState(addr addrs.AbsResourceInstance, imported []providers.ImportedResource) (terraform.HookAction, error) {
func (h *UiHook) PostImportState(addr addrs.AbsResourceInstance, imported []providers.ImportedResource) (opentf.HookAction, error) {
h.println(fmt.Sprintf(
h.view.colorize.Color("[reset][bold][green]%s: Import prepared!"),
addr,
@ -301,34 +301,34 @@ func (h *UiHook) PostImportState(addr addrs.AbsResourceInstance, imported []prov
))
}
return terraform.HookActionContinue, nil
return opentf.HookActionContinue, nil
}
func (h *UiHook) PrePlanImport(addr addrs.AbsResourceInstance, importID string) (terraform.HookAction, error) {
func (h *UiHook) PrePlanImport(addr addrs.AbsResourceInstance, importID string) (opentf.HookAction, error) {
h.println(fmt.Sprintf(
h.view.colorize.Color("[reset][bold]%s: Preparing import... [id=%s]"),
addr, importID,
))
return terraform.HookActionContinue, nil
return opentf.HookActionContinue, nil
}
func (h *UiHook) PreApplyImport(addr addrs.AbsResourceInstance, importing plans.ImportingSrc) (terraform.HookAction, error) {
func (h *UiHook) PreApplyImport(addr addrs.AbsResourceInstance, importing plans.ImportingSrc) (opentf.HookAction, error) {
h.println(fmt.Sprintf(
h.view.colorize.Color("[reset][bold]%s: Importing... [id=%s]"),
addr, importing.ID,
))
return terraform.HookActionContinue, nil
return opentf.HookActionContinue, nil
}
func (h *UiHook) PostApplyImport(addr addrs.AbsResourceInstance, importing plans.ImportingSrc) (terraform.HookAction, error) {
func (h *UiHook) PostApplyImport(addr addrs.AbsResourceInstance, importing plans.ImportingSrc) (opentf.HookAction, error) {
h.println(fmt.Sprintf(
h.view.colorize.Color("[reset][bold]%s: Import complete [id=%s]"),
addr, importing.ID,
))
return terraform.HookActionContinue, nil
return opentf.HookActionContinue, nil
}
// Wrap calls to the view so that concurrent calls do not interleave println.

View File

@ -19,7 +19,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"
)
// Test the PreApply hook for creating a new resource
@ -55,7 +55,7 @@ func TestUiHookPreApply_create(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if action != terraform.HookActionContinue {
if action != opentf.HookActionContinue {
t.Fatalf("Expected hook to continue, given: %#v", action)
}
@ -113,7 +113,7 @@ func TestUiHookPreApply_periodicTimer(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if action != terraform.HookActionContinue {
if action != opentf.HookActionContinue {
t.Fatalf("Expected hook to continue, given: %#v", action)
}
@ -177,7 +177,7 @@ func TestUiHookPreApply_destroy(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if action != terraform.HookActionContinue {
if action != opentf.HookActionContinue {
t.Fatalf("Expected hook to continue, given: %#v", action)
}
@ -228,7 +228,7 @@ func TestUiHookPostApply_colorInterpolation(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if action != terraform.HookActionContinue {
if action != opentf.HookActionContinue {
t.Fatalf("Expected hook to continue, given: %#v", action)
}
result := done(t)
@ -281,7 +281,7 @@ func TestUiHookPostApply_emptyState(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if action != terraform.HookActionContinue {
if action != opentf.HookActionContinue {
t.Fatalf("Expected hook to continue, given: %#v", action)
}
result := done(t)
@ -314,7 +314,7 @@ func TestPreProvisionInstanceStep(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if action != terraform.HookActionContinue {
if action != opentf.HookActionContinue {
t.Fatalf("Expected hook to continue, given: %#v", action)
}
result := done(t)
@ -430,7 +430,7 @@ func TestPreRefresh(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if action != terraform.HookActionContinue {
if action != opentf.HookActionContinue {
t.Fatalf("Expected hook to continue, given: %#v", action)
}
result := done(t)
@ -462,7 +462,7 @@ func TestPreRefresh_noID(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if action != terraform.HookActionContinue {
if action != opentf.HookActionContinue {
t.Fatalf("Expected hook to continue, given: %#v", action)
}
result := done(t)
@ -489,7 +489,7 @@ func TestPreImportState(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if action != terraform.HookActionContinue {
if action != opentf.HookActionContinue {
t.Fatalf("Expected hook to continue, given: %#v", action)
}
result := done(t)
@ -537,7 +537,7 @@ func TestPostImportState(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if action != terraform.HookActionContinue {
if action != opentf.HookActionContinue {
t.Fatalf("Expected hook to continue, given: %#v", action)
}
result := done(t)

View File

@ -17,7 +17,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views/json"
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
@ -30,7 +30,7 @@ type Operation interface {
EmergencyDumpState(stateFile *statefile.File) error
PlannedChange(change *plans.ResourceInstanceChangeSrc)
Plan(plan *plans.Plan, schemas *terraform.Schemas)
Plan(plan *plans.Plan, schemas *opentf.Schemas)
PlanNextStep(planPath string, genConfigPath string)
Diagnostics(diags tfdiags.Diagnostics)
@ -91,7 +91,7 @@ func (v *OperationHuman) EmergencyDumpState(stateFile *statefile.File) error {
return nil
}
func (v *OperationHuman) Plan(plan *plans.Plan, schemas *terraform.Schemas) {
func (v *OperationHuman) Plan(plan *plans.Plan, schemas *opentf.Schemas) {
outputs, changed, drift, attrs, err := jsonplan.MarshalForRenderer(plan, schemas)
if err != nil {
v.view.streams.Eprintf("Failed to marshal plan to json: %s", err)
@ -209,7 +209,7 @@ func (v *OperationJSON) EmergencyDumpState(stateFile *statefile.File) error {
// Log a change summary and a series of "planned" messages for the changes in
// the plan.
func (v *OperationJSON) Plan(plan *plans.Plan, schemas *terraform.Schemas) {
func (v *OperationJSON) Plan(plan *plans.Plan, schemas *opentf.Schemas) {
for _, dr := range plan.DriftedResources {
// In refresh-only mode, we output all resources marked as drifted,
// including those which have moved without other changes. In other plan

View File

@ -16,7 +16,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/zclconf/go-cty/cty"
)
@ -81,11 +81,11 @@ func TestOperation_emergencyDumpState(t *testing.T) {
func TestOperation_planNoChanges(t *testing.T) {
tests := map[string]struct {
plan func(schemas *terraform.Schemas) *plans.Plan
plan func(schemas *opentf.Schemas) *plans.Plan
wantText string
}{
"nothing at all in normal mode": {
func(schemas *terraform.Schemas) *plans.Plan {
func(schemas *opentf.Schemas) *plans.Plan {
return &plans.Plan{
UIMode: plans.NormalMode,
Changes: plans.NewChanges(),
@ -94,7 +94,7 @@ func TestOperation_planNoChanges(t *testing.T) {
"no differences, so no changes are needed.",
},
"nothing at all in refresh-only mode": {
func(schemas *terraform.Schemas) *plans.Plan {
func(schemas *opentf.Schemas) *plans.Plan {
return &plans.Plan{
UIMode: plans.RefreshOnlyMode,
Changes: plans.NewChanges(),
@ -103,7 +103,7 @@ func TestOperation_planNoChanges(t *testing.T) {
"OpenTF has checked that the real remote objects still match",
},
"nothing at all in destroy mode": {
func(schemas *terraform.Schemas) *plans.Plan {
func(schemas *opentf.Schemas) *plans.Plan {
return &plans.Plan{
UIMode: plans.DestroyMode,
Changes: plans.NewChanges(),
@ -112,7 +112,7 @@ func TestOperation_planNoChanges(t *testing.T) {
"No objects need to be destroyed.",
},
"no drift detected in normal noop": {
func(schemas *terraform.Schemas) *plans.Plan {
func(schemas *opentf.Schemas) *plans.Plan {
addr := addrs.Resource{
Mode: addrs.ManagedResourceMode,
Type: "test_resource",
@ -153,7 +153,7 @@ func TestOperation_planNoChanges(t *testing.T) {
"No changes",
},
"drift detected in normal mode": {
func(schemas *terraform.Schemas) *plans.Plan {
func(schemas *opentf.Schemas) *plans.Plan {
addr := addrs.Resource{
Mode: addrs.ManagedResourceMode,
Type: "test_resource",
@ -200,7 +200,7 @@ func TestOperation_planNoChanges(t *testing.T) {
"Objects have changed outside of OpenTF",
},
"drift detected in refresh-only mode": {
func(schemas *terraform.Schemas) *plans.Plan {
func(schemas *opentf.Schemas) *plans.Plan {
addr := addrs.Resource{
Mode: addrs.ManagedResourceMode,
Type: "test_resource",
@ -241,7 +241,7 @@ func TestOperation_planNoChanges(t *testing.T) {
"If you were expecting these changes then you can apply this plan",
},
"move-only changes in refresh-only mode": {
func(schemas *terraform.Schemas) *plans.Plan {
func(schemas *opentf.Schemas) *plans.Plan {
addr := addrs.Resource{
Mode: addrs.ManagedResourceMode,
Type: "test_resource",
@ -290,7 +290,7 @@ func TestOperation_planNoChanges(t *testing.T) {
"test_resource.anywhere has moved to test_resource.somewhere",
},
"drift detected in destroy mode": {
func(schemas *terraform.Schemas) *plans.Plan {
func(schemas *opentf.Schemas) *plans.Plan {
return &plans.Plan{
UIMode: plans.DestroyMode,
Changes: plans.NewChanges(),

View File

@ -7,14 +7,14 @@ import (
"fmt"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/arguments"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
// The Plan view is used for the plan command.
type Plan interface {
Operation() Operation
Hooks() []terraform.Hook
Hooks() []opentf.Hook
Diagnostics(diags tfdiags.Diagnostics)
HelpPrompt()
@ -51,8 +51,8 @@ func (v *PlanHuman) Operation() Operation {
return NewOperation(arguments.ViewHuman, v.inAutomation, v.view)
}
func (v *PlanHuman) Hooks() []terraform.Hook {
return []terraform.Hook{
func (v *PlanHuman) Hooks() []opentf.Hook {
return []opentf.Hook{
NewUiHook(v.view),
}
}
@ -77,8 +77,8 @@ func (v *PlanJSON) Operation() Operation {
return &OperationJSON{view: v.view}
}
func (v *PlanJSON) Hooks() []terraform.Hook {
return []terraform.Hook{
func (v *PlanJSON) Hooks() []opentf.Hook {
return []opentf.Hook{
newJSONHook(v.view),
}
}

View File

@ -12,7 +12,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/zclconf/go-cty/cty"
)
@ -130,17 +130,17 @@ func testPlanWithDatasource(t *testing.T) *plans.Plan {
return plan
}
func testSchemas() *terraform.Schemas {
func testSchemas() *opentf.Schemas {
provider := testProvider()
return &terraform.Schemas{
return &opentf.Schemas{
Providers: map[addrs.Provider]providers.ProviderSchema{
addrs.NewDefaultProvider("test"): provider.GetProviderSchema(),
},
}
}
func testProvider() *terraform.MockProvider {
p := new(terraform.MockProvider)
func testProvider() *opentf.MockProvider {
p := new(opentf.MockProvider)
p.ReadResourceFn = func(req providers.ReadResourceRequest) providers.ReadResourceResponse {
return providers.ReadResourceResponse{NewState: req.PriorState}
}

View File

@ -9,7 +9,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/arguments"
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views/json"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
@ -18,7 +18,7 @@ type Refresh interface {
Outputs(outputValues map[string]*states.OutputValue)
Operation() Operation
Hooks() []terraform.Hook
Hooks() []opentf.Hook
Diagnostics(diags tfdiags.Diagnostics)
HelpPrompt()
@ -65,8 +65,8 @@ func (v *RefreshHuman) Operation() Operation {
return NewOperation(arguments.ViewHuman, v.inAutomation, v.view)
}
func (v *RefreshHuman) Hooks() []terraform.Hook {
return []terraform.Hook{
func (v *RefreshHuman) Hooks() []opentf.Hook {
return []opentf.Hook{
v.countHook,
NewUiHook(v.view),
}
@ -101,8 +101,8 @@ func (v *RefreshJSON) Operation() Operation {
return &OperationJSON{view: v.view}
}
func (v *RefreshJSON) Hooks() []terraform.Hook {
return []terraform.Hook{
func (v *RefreshJSON) Hooks() []opentf.Hook {
return []opentf.Hook{
newJSONHook(v.view),
}
}

View File

@ -17,13 +17,13 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs"
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
type Show interface {
// Display renders the plan, if it is available. If plan is nil, it renders the statefile.
Display(config *configs.Config, plan *plans.Plan, planJSON *cloudplan.RemotePlanJSON, stateFile *statefile.File, schemas *terraform.Schemas) int
Display(config *configs.Config, plan *plans.Plan, planJSON *cloudplan.RemotePlanJSON, stateFile *statefile.File, schemas *opentf.Schemas) int
// Diagnostics renders early diagnostics, resulting from argument parsing.
Diagnostics(diags tfdiags.Diagnostics)
@ -46,7 +46,7 @@ type ShowHuman struct {
var _ Show = (*ShowHuman)(nil)
func (v *ShowHuman) Display(config *configs.Config, plan *plans.Plan, planJSON *cloudplan.RemotePlanJSON, stateFile *statefile.File, schemas *terraform.Schemas) int {
func (v *ShowHuman) Display(config *configs.Config, plan *plans.Plan, planJSON *cloudplan.RemotePlanJSON, stateFile *statefile.File, schemas *opentf.Schemas) int {
renderer := jsonformat.Renderer{
Colorize: v.view.colorize,
Streams: v.view.streams,
@ -131,7 +131,7 @@ type ShowJSON struct {
var _ Show = (*ShowJSON)(nil)
func (v *ShowJSON) Display(config *configs.Config, plan *plans.Plan, planJSON *cloudplan.RemotePlanJSON, stateFile *statefile.File, schemas *terraform.Schemas) int {
func (v *ShowJSON) Display(config *configs.Config, plan *plans.Plan, planJSON *cloudplan.RemotePlanJSON, stateFile *statefile.File, schemas *opentf.Schemas) int {
// Prefer to display a pre-built JSON plan, if we got one; then, fall back
// to building one ourselves.
if planJSON != nil {

View File

@ -19,7 +19,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/zclconf/go-cty/cty"
)
@ -34,7 +34,7 @@ func TestShowHuman(t *testing.T) {
plan *plans.Plan
jsonPlan *cloudplan.RemotePlanJSON
stateFile *statefile.File
schemas *terraform.Schemas
schemas *opentf.Schemas
wantExact bool
wantString string
}{
@ -179,7 +179,7 @@ func TestShowJSON(t *testing.T) {
view.Configure(&arguments.View{NoColor: true})
v := NewShow(arguments.ViewJSON, view)
schemas := &terraform.Schemas{
schemas := &opentf.Schemas{
Providers: map[addrs.Provider]providers.ProviderSchema{
addrs.NewDefaultProvider("test"): {
ResourceTypes: map[string]providers.Schema{

View File

@ -18,7 +18,7 @@ import (
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
)
@ -140,7 +140,7 @@ func (t *TestHuman) Run(run *moduletest.Run, file *moduletest.File) {
// We're going to be more verbose about what we print, here's the plan
// or the state depending on the type of run we did.
schemas := &terraform.Schemas{
schemas := &opentf.Schemas{
Providers: run.Verbose.Providers,
Provisioners: run.Verbose.Provisioners,
}
@ -402,7 +402,7 @@ func (t *TestJSON) Run(run *moduletest.Run, file *moduletest.File) {
if run.Verbose != nil {
schemas := &terraform.Schemas{
schemas := &opentf.Schemas{
Providers: run.Verbose.Providers,
Provisioners: run.Verbose.Provisioners,
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package terraform
package opentf
import (
"bytes"
@ -96,7 +96,7 @@ type PlanOpts struct {
//
// The given planning options allow control of various other details of the
// planning process that are not represented directly in the configuration.
// You can use terraform.DefaultPlanOpts to generate a normal plan with no
// You can use opentf.DefaultPlanOpts to generate a normal plan with no
// special options.
//
// If the returned diagnostics contains no errors then the returned plan is

Some files were not shown because too many files have changed in this diff Show More