mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Replace internal/terraform -> internal/opentf
This commit is contained in:
parent
12e8eeaa09
commit
42e7c5b25c
@ -27,7 +27,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans/planfile"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans/planfile"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
"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/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
"github.com/zclconf/go-cty/cty"
|
"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
|
// calculate from an Operation object, which we can then use for local
|
||||||
// operations.
|
// 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
|
// generate new artifacts which supersede parts of the LocalRun object that
|
||||||
// started the operation, so callers should be careful to use those subsequent
|
// started the operation, so callers should be careful to use those subsequent
|
||||||
// artifacts instead of the fields of LocalRun where appropriate. The LocalRun
|
// artifacts instead of the fields of LocalRun where appropriate. The LocalRun
|
||||||
@ -190,7 +190,7 @@ type Local interface {
|
|||||||
type LocalRun struct {
|
type LocalRun struct {
|
||||||
// Core is an already-initialized OpenTF Core context, ready to be
|
// Core is an already-initialized OpenTF Core context, ready to be
|
||||||
// used to run operations such as Plan and Apply.
|
// 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
|
// Config is the configuration we're working with, which typically comes
|
||||||
// from either config files directly on local disk (when we're creating
|
// 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
|
// This is nil when we're applying a saved plan, because the plan itself
|
||||||
// contains enough information about its options to apply it.
|
// 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
|
// Plan is a plan loaded from a saved plan file, if our operation is to
|
||||||
// apply that saved plan.
|
// apply that saved plan.
|
||||||
@ -266,7 +266,7 @@ type Operation struct {
|
|||||||
|
|
||||||
// Hooks can be used to perform actions triggered by various events during
|
// Hooks can be used to perform actions triggered by various events during
|
||||||
// the operation's lifecycle.
|
// 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 is a plan that was passed as an argument. This is valid for
|
||||||
// plan and apply arguments but may not work for all backends.
|
// plan and apply arguments but may not work for all backends.
|
||||||
@ -294,8 +294,8 @@ type Operation struct {
|
|||||||
View views.Operation
|
View views.Operation
|
||||||
|
|
||||||
// Input/output/control options.
|
// Input/output/control options.
|
||||||
UIIn terraform.UIInput
|
UIIn opentf.UIInput
|
||||||
UIOut terraform.UIOutput
|
UIOut opentf.UIOutput
|
||||||
|
|
||||||
// StateLocker is used to lock the state while providing UI feedback to the
|
// 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.
|
// user. This will be replaced by the Backend to update the context.
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
"github.com/mitchellh/colorstring"
|
"github.com/mitchellh/colorstring"
|
||||||
|
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
|
"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
|
// 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
|
// ContextOpts are the base context options to set when initializing a
|
||||||
// OpenTF context. Many of these will be overridden or merged by
|
// OpenTF context. Many of these will be overridden or merged by
|
||||||
// Operation. See Operation for more details.
|
// Operation. See Operation for more details.
|
||||||
ContextOpts *terraform.ContextOpts
|
ContextOpts *opentf.ContextOpts
|
||||||
|
|
||||||
// Input will ask for necessary input prior to performing any operations.
|
// Input will ask for necessary input prior to performing any operations.
|
||||||
//
|
//
|
||||||
|
@ -19,7 +19,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/logging"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/logging"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
"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/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
"github.com/zclconf/go-cty/cty"
|
"github.com/zclconf/go-cty/cty"
|
||||||
)
|
)
|
||||||
@ -68,7 +68,7 @@ type Local struct {
|
|||||||
|
|
||||||
// OpenTF context. Many of these will be overridden or merged by
|
// OpenTF context. Many of these will be overridden or merged by
|
||||||
// Operation. See Operation for more details.
|
// Operation. See Operation for more details.
|
||||||
ContextOpts *terraform.ContextOpts
|
ContextOpts *opentf.ContextOpts
|
||||||
|
|
||||||
// OpInput will ask for necessary input prior to performing any operations.
|
// 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
|
// 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.
|
// operation within this process.
|
||||||
//
|
//
|
||||||
// The given operation parameter will be merged with the ContextOpts on
|
// The given operation parameter will be merged with the ContextOpts on
|
||||||
@ -340,7 +340,7 @@ func (b *Local) opWait(
|
|||||||
doneCh <-chan struct{},
|
doneCh <-chan struct{},
|
||||||
stopCtx context.Context,
|
stopCtx context.Context,
|
||||||
cancelCtx context.Context,
|
cancelCtx context.Context,
|
||||||
tfCtx *terraform.Context,
|
tfCtx *opentf.Context,
|
||||||
opStateMgr statemgr.Persister,
|
opStateMgr statemgr.Persister,
|
||||||
view views.Operation) (canceled bool) {
|
view views.Operation) (canceled bool) {
|
||||||
// Wait for the operation to finish or for us to be interrupted so
|
// Wait for the operation to finish or for us to be interrupted so
|
||||||
|
@ -18,7 +18,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
"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/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
|
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",
|
Id: "approve",
|
||||||
Query: "\n" + query,
|
Query: "\n" + query,
|
||||||
Description: desc,
|
Description: desc,
|
||||||
|
@ -15,7 +15,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configload"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configload"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans/planfile"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans/planfile"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
"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/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
"github.com/zclconf/go-cty/cty"
|
"github.com/zclconf/go-cty/cty"
|
||||||
)
|
)
|
||||||
@ -68,7 +68,7 @@ func (b *Local) localRun(op *backend.Operation) (*backend.LocalRun, *configload.
|
|||||||
ret := &backend.LocalRun{}
|
ret := &backend.LocalRun{}
|
||||||
|
|
||||||
// Initialize our context options
|
// Initialize our context options
|
||||||
var coreOpts terraform.ContextOpts
|
var coreOpts opentf.ContextOpts
|
||||||
if v := b.ContextOpts; v != nil {
|
if v := b.ContextOpts; v != nil {
|
||||||
coreOpts = *v
|
coreOpts = *v
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ func (b *Local) localRun(op *backend.Operation) (*backend.LocalRun, *configload.
|
|||||||
if op.Type != backend.OperationTypeInvalid {
|
if op.Type != backend.OperationTypeInvalid {
|
||||||
// If input asking is enabled, then do that
|
// If input asking is enabled, then do that
|
||||||
if op.PlanFile == nil && b.OpInput {
|
if op.PlanFile == nil && b.OpInput {
|
||||||
mode := terraform.InputModeProvider
|
mode := opentf.InputModeProvider
|
||||||
|
|
||||||
log.Printf("[TRACE] backend/local: requesting interactive input, if necessary")
|
log.Printf("[TRACE] backend/local: requesting interactive input, if necessary")
|
||||||
inputDiags := ret.Core.Input(ret.Config, mode)
|
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
|
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
|
var diags tfdiags.Diagnostics
|
||||||
|
|
||||||
// Load the configuration using the caller-provided configuration loader.
|
// 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
|
return nil, nil, diags
|
||||||
}
|
}
|
||||||
|
|
||||||
planOpts := &terraform.PlanOpts{
|
planOpts := &opentf.PlanOpts{
|
||||||
Mode: op.PlanMode,
|
Mode: op.PlanMode,
|
||||||
Targets: op.Targets,
|
Targets: op.Targets,
|
||||||
ForceReplace: op.ForceReplace,
|
ForceReplace: op.ForceReplace,
|
||||||
@ -208,7 +208,7 @@ func (b *Local) localRunDirect(op *backend.Operation, run *backend.LocalRun, cor
|
|||||||
// snapshot, from the previous run.
|
// snapshot, from the previous run.
|
||||||
run.InputState = s.State()
|
run.InputState = s.State()
|
||||||
|
|
||||||
tfCtx, moreDiags := terraform.NewContext(coreOpts)
|
tfCtx, moreDiags := opentf.NewContext(coreOpts)
|
||||||
diags = diags.Append(moreDiags)
|
diags = diags.Append(moreDiags)
|
||||||
if moreDiags.HasErrors() {
|
if moreDiags.HasErrors() {
|
||||||
return nil, nil, diags
|
return nil, nil, diags
|
||||||
@ -217,7 +217,7 @@ func (b *Local) localRunDirect(op *backend.Operation, run *backend.LocalRun, cor
|
|||||||
return run, configSnap, diags
|
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
|
var diags tfdiags.Diagnostics
|
||||||
|
|
||||||
const errSummary = "Invalid plan file"
|
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.
|
// we need to apply the plan.
|
||||||
run.Plan = plan
|
run.Plan = plan
|
||||||
|
|
||||||
tfCtx, moreDiags := terraform.NewContext(coreOpts)
|
tfCtx, moreDiags := opentf.NewContext(coreOpts)
|
||||||
diags = diags.Append(moreDiags)
|
diags = diags.Append(moreDiags)
|
||||||
if moreDiags.HasErrors() {
|
if moreDiags.HasErrors() {
|
||||||
return nil, nil, diags
|
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:
|
// 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
|
// the primary resolution to missing variables is to provide them by some other
|
||||||
// means.
|
// 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
|
var needed []string
|
||||||
if b.OpInput && uiInput != nil {
|
if b.OpInput && uiInput != nil {
|
||||||
for name, vc := range vcs {
|
for name, vc := range vcs {
|
||||||
@ -400,7 +400,7 @@ func (b *Local) interactiveCollectVariables(ctx context.Context, existing map[st
|
|||||||
}
|
}
|
||||||
for _, name := range needed {
|
for _, name := range needed {
|
||||||
vc := vcs[name]
|
vc := vcs[name]
|
||||||
rawValue, err := uiInput.Input(ctx, &terraform.InputOpts{
|
rawValue, err := uiInput.Input(ctx, &opentf.InputOpts{
|
||||||
Id: fmt.Sprintf("var.%s", name),
|
Id: fmt.Sprintf("var.%s", name),
|
||||||
Query: fmt.Sprintf("var.%s", name),
|
Query: fmt.Sprintf("var.%s", name),
|
||||||
Description: vc.Description,
|
Description: vc.Description,
|
||||||
@ -478,16 +478,16 @@ type unparsedInteractiveVariableValue struct {
|
|||||||
|
|
||||||
var _ backend.UnparsedVariableValue = unparsedInteractiveVariableValue{}
|
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
|
var diags tfdiags.Diagnostics
|
||||||
val, valDiags := mode.Parse(v.Name, v.RawValue)
|
val, valDiags := mode.Parse(v.Name, v.RawValue)
|
||||||
diags = diags.Append(valDiags)
|
diags = diags.Append(valDiags)
|
||||||
if diags.HasErrors() {
|
if diags.HasErrors() {
|
||||||
return nil, diags
|
return nil, diags
|
||||||
}
|
}
|
||||||
return &terraform.InputValue{
|
return &opentf.InputValue{
|
||||||
Value: val,
|
Value: val,
|
||||||
SourceType: terraform.ValueFromInput,
|
SourceType: opentf.ValueFromInput,
|
||||||
}, diags
|
}, diags
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -498,9 +498,9 @@ type unparsedUnknownVariableValue struct {
|
|||||||
|
|
||||||
var _ backend.UnparsedVariableValue = unparsedUnknownVariableValue{}
|
var _ backend.UnparsedVariableValue = unparsedUnknownVariableValue{}
|
||||||
|
|
||||||
func (v unparsedUnknownVariableValue) ParseVariableValue(mode configs.VariableParsingMode) (*terraform.InputValue, tfdiags.Diagnostics) {
|
func (v unparsedUnknownVariableValue) ParseVariableValue(mode configs.VariableParsingMode) (*opentf.InputValue, tfdiags.Diagnostics) {
|
||||||
return &terraform.InputValue{
|
return &opentf.InputValue{
|
||||||
Value: cty.UnknownVal(v.WantType),
|
Value: cty.UnknownVal(v.WantType),
|
||||||
SourceType: terraform.ValueFromInput,
|
SourceType: opentf.ValueFromInput,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -272,6 +272,6 @@ func (s *stateStorageThatFailsRefresh) RefreshState() error {
|
|||||||
return fmt.Errorf("intentionally failing for testing purposes")
|
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")
|
return fmt.Errorf("unimplemented")
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans/planfile"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans/planfile"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
"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/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ func (b *Local) opPlan(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if b.ContextOpts == nil {
|
if b.ContextOpts == nil {
|
||||||
b.ContextOpts = new(terraform.ContextOpts)
|
b.ContextOpts = new(opentf.ContextOpts)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get our context
|
// Get our context
|
||||||
|
@ -25,7 +25,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLocal_planBasic(t *testing.T) {
|
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
|
// to test that we properly unlock the state if terraform.NewContext
|
||||||
// returns an error.
|
// returns an error.
|
||||||
if b.ContextOpts == nil {
|
if b.ContextOpts == nil {
|
||||||
b.ContextOpts = &terraform.ContextOpts{}
|
b.ContextOpts = &opentf.ContextOpts{}
|
||||||
}
|
}
|
||||||
b.ContextOpts.Parallelism = -1
|
b.ContextOpts.Parallelism = -1
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
|
|
||||||
"github.com/zclconf/go-cty/cty"
|
"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
|
// Enable input asking since it is normally disabled by default
|
||||||
b.OpInput = true
|
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")
|
op, configCleanup, done := testOperationRefresh(t, "./testdata/refresh-var-unset")
|
||||||
defer configCleanup()
|
defer configCleanup()
|
||||||
|
@ -10,13 +10,13 @@ import (
|
|||||||
|
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
"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
|
// StateHook is a hook that continuously updates the state by calling
|
||||||
// WriteState on a statemgr.Full.
|
// WriteState on a statemgr.Full.
|
||||||
type StateHook struct {
|
type StateHook struct {
|
||||||
terraform.NilHook
|
opentf.NilHook
|
||||||
sync.Mutex
|
sync.Mutex
|
||||||
|
|
||||||
StateMgr statemgr.Writer
|
StateMgr statemgr.Writer
|
||||||
@ -31,7 +31,7 @@ type StateHook struct {
|
|||||||
// Schemas are the schemas to use when persisting state due to
|
// Schemas are the schemas to use when persisting state due to
|
||||||
// PersistInterval. This is ignored if PersistInterval is zero,
|
// PersistInterval. This is ignored if PersistInterval is zero,
|
||||||
// and PersistInterval is ignored if this is nil.
|
// and PersistInterval is ignored if this is nil.
|
||||||
Schemas *terraform.Schemas
|
Schemas *opentf.Schemas
|
||||||
|
|
||||||
intermediatePersist IntermediateStatePersistInfo
|
intermediatePersist IntermediateStatePersistInfo
|
||||||
}
|
}
|
||||||
@ -59,9 +59,9 @@ type IntermediateStatePersistInfo struct {
|
|||||||
ForcePersist bool
|
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()
|
h.Lock()
|
||||||
defer h.Unlock()
|
defer h.Unlock()
|
||||||
|
|
||||||
@ -75,13 +75,13 @@ func (h *StateHook) PostStateUpdate(new *states.State) (terraform.HookAction, er
|
|||||||
|
|
||||||
if h.StateMgr != nil {
|
if h.StateMgr != nil {
|
||||||
if err := h.StateMgr.WriteState(new); err != 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 mgrPersist, ok := h.StateMgr.(statemgr.Persister); ok && h.PersistInterval != 0 && h.Schemas != nil {
|
||||||
if h.shouldPersist() {
|
if h.shouldPersist() {
|
||||||
err := mgrPersist.PersistState(h.Schemas)
|
err := mgrPersist.PersistState(h.Schemas)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return terraform.HookActionHalt, err
|
return opentf.HookActionHalt, err
|
||||||
}
|
}
|
||||||
h.intermediatePersist.LastPersist = time.Now()
|
h.intermediatePersist.LastPersist = time.Now()
|
||||||
} else {
|
} 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() {
|
func (h *StateHook) Stopping() {
|
||||||
|
@ -11,23 +11,23 @@ import (
|
|||||||
"github.com/google/go-cmp/cmp"
|
"github.com/google/go-cmp/cmp"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
"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) {
|
func TestStateHook_impl(t *testing.T) {
|
||||||
var _ terraform.Hook = new(StateHook)
|
var _ opentf.Hook = new(StateHook)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestStateHook(t *testing.T) {
|
func TestStateHook(t *testing.T) {
|
||||||
is := statemgr.NewTransientInMemory(nil)
|
is := statemgr.NewTransientInMemory(nil)
|
||||||
var hook terraform.Hook = &StateHook{StateMgr: is}
|
var hook opentf.Hook = &StateHook{StateMgr: is}
|
||||||
|
|
||||||
s := statemgr.TestFullInitialState()
|
s := statemgr.TestFullInitialState()
|
||||||
action, err := hook.PostStateUpdate(s)
|
action, err := hook.PostStateUpdate(s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("err: %s", err)
|
t.Fatalf("err: %s", err)
|
||||||
}
|
}
|
||||||
if action != terraform.HookActionContinue {
|
if action != opentf.HookActionContinue {
|
||||||
t.Fatalf("bad: %v", action)
|
t.Fatalf("bad: %v", action)
|
||||||
}
|
}
|
||||||
if !is.State().Equal(s) {
|
if !is.State().Equal(s) {
|
||||||
@ -39,7 +39,7 @@ func TestStateHookStopping(t *testing.T) {
|
|||||||
is := &testPersistentState{}
|
is := &testPersistentState{}
|
||||||
hook := &StateHook{
|
hook := &StateHook{
|
||||||
StateMgr: is,
|
StateMgr: is,
|
||||||
Schemas: &terraform.Schemas{},
|
Schemas: &opentf.Schemas{},
|
||||||
PersistInterval: 4 * time.Hour,
|
PersistInterval: 4 * time.Hour,
|
||||||
intermediatePersist: IntermediateStatePersistInfo{
|
intermediatePersist: IntermediateStatePersistInfo{
|
||||||
LastPersist: time.Now(),
|
LastPersist: time.Now(),
|
||||||
@ -51,7 +51,7 @@ func TestStateHookStopping(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unexpected error from PostStateUpdate: %s", err)
|
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)
|
t.Fatalf("wrong hookaction %#v; want %#v", got, want)
|
||||||
}
|
}
|
||||||
if is.Written == nil || !is.Written.Equal(s) {
|
if is.Written == nil || !is.Written.Equal(s) {
|
||||||
@ -138,7 +138,7 @@ func TestStateHookCustomPersistRule(t *testing.T) {
|
|||||||
is := &testPersistentStateThatRefusesToPersist{}
|
is := &testPersistentStateThatRefusesToPersist{}
|
||||||
hook := &StateHook{
|
hook := &StateHook{
|
||||||
StateMgr: is,
|
StateMgr: is,
|
||||||
Schemas: &terraform.Schemas{},
|
Schemas: &opentf.Schemas{},
|
||||||
PersistInterval: 4 * time.Hour,
|
PersistInterval: 4 * time.Hour,
|
||||||
intermediatePersist: IntermediateStatePersistInfo{
|
intermediatePersist: IntermediateStatePersistInfo{
|
||||||
LastPersist: time.Now(),
|
LastPersist: time.Now(),
|
||||||
@ -150,7 +150,7 @@ func TestStateHookCustomPersistRule(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unexpected error from PostStateUpdate: %s", err)
|
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)
|
t.Fatalf("wrong hookaction %#v; want %#v", got, want)
|
||||||
}
|
}
|
||||||
if is.Written == nil || !is.Written.Equal(s) {
|
if is.Written == nil || !is.Written.Equal(s) {
|
||||||
@ -255,7 +255,7 @@ func (sm *testPersistentState) WriteState(state *states.State) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sm *testPersistentState) PersistState(schemas *terraform.Schemas) error {
|
func (sm *testPersistentState) PersistState(schemas *opentf.Schemas) error {
|
||||||
if schemas == nil {
|
if schemas == nil {
|
||||||
return fmt.Errorf("no schemas")
|
return fmt.Errorf("no schemas")
|
||||||
}
|
}
|
||||||
@ -281,7 +281,7 @@ func (sm *testPersistentStateThatRefusesToPersist) WriteState(state *states.Stat
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sm *testPersistentStateThatRefusesToPersist) PersistState(schemas *terraform.Schemas) error {
|
func (sm *testPersistentStateThatRefusesToPersist) PersistState(schemas *opentf.Schemas) error {
|
||||||
if schemas == nil {
|
if schemas == nil {
|
||||||
return fmt.Errorf("no schemas")
|
return fmt.Errorf("no schemas")
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
"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
|
// 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.StateOutPath = filepath.Join(tempDir, "state.tfstate")
|
||||||
local.StateBackupPath = filepath.Join(tempDir, "state.tfstate.bak")
|
local.StateBackupPath = filepath.Join(tempDir, "state.tfstate.bak")
|
||||||
local.StateWorkspaceDir = filepath.Join(tempDir, "state.tfstate.d")
|
local.StateWorkspaceDir = filepath.Join(tempDir, "state.tfstate.d")
|
||||||
local.ContextOpts = &terraform.ContextOpts{}
|
local.ContextOpts = &opentf.ContextOpts{}
|
||||||
|
|
||||||
return local
|
return local
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestLocalProvider modifies the ContextOpts of the *Local parameter to
|
// TestLocalProvider modifies the ContextOpts of the *Local parameter to
|
||||||
// have a provider with the given name.
|
// 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
|
// Build a mock resource provider for in-memory operations
|
||||||
p := new(terraform.MockProvider)
|
p := new(opentf.MockProvider)
|
||||||
|
|
||||||
p.GetProviderSchemaResponse = &schema
|
p.GetProviderSchemaResponse = &schema
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ func TestLocalProvider(t *testing.T, b *Local, name string, schema providers.Pro
|
|||||||
|
|
||||||
// Initialize the opts
|
// Initialize the opts
|
||||||
if b.ContextOpts == nil {
|
if b.ContextOpts == nil {
|
||||||
b.ContextOpts = &terraform.ContextOpts{}
|
b.ContextOpts = &opentf.ContextOpts{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up our provider
|
// Set up our provider
|
||||||
|
@ -26,7 +26,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/logging"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/logging"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/remote"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/remote"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
"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/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
tfversion "github.com/placeholderplaceholderplaceholder/opentf/version"
|
tfversion "github.com/placeholderplaceholderplaceholder/opentf/version"
|
||||||
"github.com/zclconf/go-cty/cty"
|
"github.com/zclconf/go-cty/cty"
|
||||||
@ -53,7 +53,7 @@ type Remote struct {
|
|||||||
// ContextOpts are the base context options to set when initializing a
|
// ContextOpts are the base context options to set when initializing a
|
||||||
// new OpenTF context. Many of these will be overridden or merged by
|
// new OpenTF context. Many of these will be overridden or merged by
|
||||||
// Operation. See Operation for more details.
|
// Operation. See Operation for more details.
|
||||||
ContextOpts *terraform.ContextOpts
|
ContextOpts *opentf.ContextOpts
|
||||||
|
|
||||||
// client is the remote backend API client.
|
// client is the remote backend API client.
|
||||||
client *tfe.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
|
// Only ask if the remote operation should be canceled
|
||||||
// if the auto approve flag is not set.
|
// if the auto approve flag is not set.
|
||||||
if !op.AutoApprove {
|
if !op.AutoApprove {
|
||||||
v, err := op.UIIn.Input(cancelCtx, &terraform.InputOpts{
|
v, err := op.UIIn.Input(cancelCtx, &opentf.InputOpts{
|
||||||
Id: "cancel",
|
Id: "cancel",
|
||||||
Query: "\nDo you want to cancel the remote operation?",
|
Query: "\nDo you want to cancel the remote operation?",
|
||||||
Description: "Only 'yes' will be accepted to cancel.",
|
Description: "Only 'yes' will be accepted to cancel.",
|
||||||
|
@ -14,7 +14,7 @@ import (
|
|||||||
version "github.com/hashicorp/go-version"
|
version "github.com/hashicorp/go-version"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
"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 !w.AutoApply {
|
||||||
if mustConfirm {
|
if mustConfirm {
|
||||||
opts := &terraform.InputOpts{Id: "approve"}
|
opts := &opentf.InputOpts{Id: "approve"}
|
||||||
|
|
||||||
if op.PlanMode == plans.DestroyMode {
|
if op.PlanMode == plans.DestroyMode {
|
||||||
opts.Query = "\nDo you really want to destroy all resources in workspace \"" + op.Workspace + "\"?"
|
opts.Query = "\nDo you really want to destroy all resources in workspace \"" + op.Workspace + "\"?"
|
||||||
|
@ -29,7 +29,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans/planfile"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans/planfile"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
tfversion "github.com/placeholderplaceholderplaceholder/opentf/version"
|
tfversion "github.com/placeholderplaceholderplaceholder/opentf/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -235,7 +235,7 @@ func TestRemote_applyWithParallelism(t *testing.T) {
|
|||||||
defer configCleanup()
|
defer configCleanup()
|
||||||
|
|
||||||
if b.ContextOpts == nil {
|
if b.ContextOpts == nil {
|
||||||
b.ContextOpts = &terraform.ContextOpts{}
|
b.ContextOpts = &opentf.ContextOpts{}
|
||||||
}
|
}
|
||||||
b.ContextOpts.Parallelism = 3
|
b.ContextOpts.Parallelism = 3
|
||||||
op.Workspace = backend.DefaultStateName
|
op.Workspace = backend.DefaultStateName
|
||||||
@ -580,7 +580,7 @@ func TestRemote_applyWithVariables(t *testing.T) {
|
|||||||
op, configCleanup, done := testOperationApply(t, "./testdata/apply-variables")
|
op, configCleanup, done := testOperationApply(t, "./testdata/apply-variables")
|
||||||
defer configCleanup()
|
defer configCleanup()
|
||||||
|
|
||||||
op.Variables = testVariables(terraform.ValueFromNamedFile, "foo", "bar")
|
op.Variables = testVariables(opentf.ValueFromNamedFile, "foo", "bar")
|
||||||
op.Workspace = backend.DefaultStateName
|
op.Workspace = backend.DefaultStateName
|
||||||
|
|
||||||
run, err := b.Operation(context.Background(), op)
|
run, err := b.Operation(context.Background(), op)
|
||||||
|
@ -18,7 +18,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/logging"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/logging"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -242,7 +242,7 @@ func (b *Remote) hasExplicitVariableValues(op *backend.Operation) bool {
|
|||||||
// their final values will come from the _remote_ execution context.
|
// their final values will come from the _remote_ execution context.
|
||||||
for _, v := range variables {
|
for _, v := range variables {
|
||||||
switch v.SourceType {
|
switch v.SourceType {
|
||||||
case terraform.ValueFromCLIArg, terraform.ValueFromNamedFile:
|
case opentf.ValueFromCLIArg, opentf.ValueFromNamedFile:
|
||||||
return true
|
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)
|
return generalError(fmt.Sprintf("Failed to override policy check.\n%s", runUrl), err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
opts := &terraform.InputOpts{
|
opts := &opentf.InputOpts{
|
||||||
Id: "override",
|
Id: "override",
|
||||||
Query: "\nDo you want to override the soft failed policy check?",
|
Query: "\nDo you want to override the soft failed policy check?",
|
||||||
Description: "Only 'override' will be accepted to override.",
|
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
|
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)
|
doneCtx, cancel := context.WithCancel(stopCtx)
|
||||||
result := make(chan error, 2)
|
result := make(chan error, 2)
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
"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/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
"github.com/zclconf/go-cty/cty"
|
"github.com/zclconf/go-cty/cty"
|
||||||
)
|
)
|
||||||
@ -24,7 +24,7 @@ import (
|
|||||||
func (b *Remote) LocalRun(op *backend.Operation) (*backend.LocalRun, statemgr.Full, tfdiags.Diagnostics) {
|
func (b *Remote) LocalRun(op *backend.Operation) (*backend.LocalRun, statemgr.Full, tfdiags.Diagnostics) {
|
||||||
var diags tfdiags.Diagnostics
|
var diags tfdiags.Diagnostics
|
||||||
ret := &backend.LocalRun{
|
ret := &backend.LocalRun{
|
||||||
PlanOpts: &terraform.PlanOpts{
|
PlanOpts: &opentf.PlanOpts{
|
||||||
Mode: op.PlanMode,
|
Mode: op.PlanMode,
|
||||||
Targets: op.Targets,
|
Targets: op.Targets,
|
||||||
},
|
},
|
||||||
@ -63,7 +63,7 @@ func (b *Remote) LocalRun(op *backend.Operation) (*backend.LocalRun, statemgr.Fu
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Initialize our context options
|
// Initialize our context options
|
||||||
var opts terraform.ContextOpts
|
var opts opentf.ContextOpts
|
||||||
if v := b.ContextOpts; v != nil {
|
if v := b.ContextOpts; v != nil {
|
||||||
opts = *v
|
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)
|
diags = diags.Append(ctxDiags)
|
||||||
ret.Core = tfCtx
|
ret.Core = tfCtx
|
||||||
|
|
||||||
@ -186,24 +186,24 @@ func (b *Remote) getRemoteWorkspaceID(ctx context.Context, localWorkspaceName st
|
|||||||
return remoteWorkspace.ID, nil
|
return remoteWorkspace.ID, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func stubAllVariables(vv map[string]backend.UnparsedVariableValue, decls map[string]*configs.Variable) terraform.InputValues {
|
func stubAllVariables(vv map[string]backend.UnparsedVariableValue, decls map[string]*configs.Variable) opentf.InputValues {
|
||||||
ret := make(terraform.InputValues, len(decls))
|
ret := make(opentf.InputValues, len(decls))
|
||||||
|
|
||||||
for name, cfg := range decls {
|
for name, cfg := range decls {
|
||||||
raw, exists := vv[name]
|
raw, exists := vv[name]
|
||||||
if !exists {
|
if !exists {
|
||||||
ret[name] = &terraform.InputValue{
|
ret[name] = &opentf.InputValue{
|
||||||
Value: cty.UnknownVal(cfg.Type),
|
Value: cty.UnknownVal(cfg.Type),
|
||||||
SourceType: terraform.ValueFromConfig,
|
SourceType: opentf.ValueFromConfig,
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
val, diags := raw.ParseVariableValue(cfg.ParsingMode)
|
val, diags := raw.ParseVariableValue(cfg.ParsingMode)
|
||||||
if diags.HasErrors() {
|
if diags.HasErrors() {
|
||||||
ret[name] = &terraform.InputValue{
|
ret[name] = &opentf.InputValue{
|
||||||
Value: cty.UnknownVal(cfg.Type),
|
Value: cty.UnknownVal(cfg.Type),
|
||||||
SourceType: terraform.ValueFromConfig,
|
SourceType: opentf.ValueFromConfig,
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -222,7 +222,7 @@ type remoteStoredVariableValue struct {
|
|||||||
|
|
||||||
var _ backend.UnparsedVariableValue = (*remoteStoredVariableValue)(nil)
|
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 diags tfdiags.Diagnostics
|
||||||
var val cty.Value
|
var val cty.Value
|
||||||
|
|
||||||
@ -285,7 +285,7 @@ func (v *remoteStoredVariableValue) ParseVariableValue(mode configs.VariablePars
|
|||||||
val = cty.StringVal(v.definition.Value)
|
val = cty.StringVal(v.definition.Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &terraform.InputValue{
|
return &opentf.InputValue{
|
||||||
Value: val,
|
Value: val,
|
||||||
|
|
||||||
// We mark these as "from input" with the rationale that entering
|
// 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
|
// roughly speaking, a similar idea to entering variable values at
|
||||||
// the interactive CLI prompts. It's not a perfect correspondance,
|
// the interactive CLI prompts. It's not a perfect correspondance,
|
||||||
// but it's closer than the other options.
|
// but it's closer than the other options.
|
||||||
SourceType: terraform.ValueFromInput,
|
SourceType: opentf.ValueFromInput,
|
||||||
}, diags
|
}, diags
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
|
|
||||||
tfe "github.com/hashicorp/go-tfe"
|
tfe "github.com/hashicorp/go-tfe"
|
||||||
@ -256,7 +256,7 @@ func TestRemoteVariablesDoNotOverride(t *testing.T) {
|
|||||||
tests := map[string]struct {
|
tests := map[string]struct {
|
||||||
localVariables map[string]backend.UnparsedVariableValue
|
localVariables map[string]backend.UnparsedVariableValue
|
||||||
remoteVariables []*tfe.VariableCreateOptions
|
remoteVariables []*tfe.VariableCreateOptions
|
||||||
expectedVariables terraform.InputValues
|
expectedVariables opentf.InputValues
|
||||||
}{
|
}{
|
||||||
"no local variables": {
|
"no local variables": {
|
||||||
map[string]backend.UnparsedVariableValue{},
|
map[string]backend.UnparsedVariableValue{},
|
||||||
@ -277,28 +277,28 @@ func TestRemoteVariablesDoNotOverride(t *testing.T) {
|
|||||||
Category: &catTerraform,
|
Category: &catTerraform,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
terraform.InputValues{
|
opentf.InputValues{
|
||||||
varName1: &terraform.InputValue{
|
varName1: &opentf.InputValue{
|
||||||
Value: cty.StringVal(varValue1),
|
Value: cty.StringVal(varValue1),
|
||||||
SourceType: terraform.ValueFromInput,
|
SourceType: opentf.ValueFromInput,
|
||||||
SourceRange: tfdiags.SourceRange{
|
SourceRange: tfdiags.SourceRange{
|
||||||
Filename: "",
|
Filename: "",
|
||||||
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
|
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
|
||||||
End: 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),
|
Value: cty.StringVal(varValue2),
|
||||||
SourceType: terraform.ValueFromInput,
|
SourceType: opentf.ValueFromInput,
|
||||||
SourceRange: tfdiags.SourceRange{
|
SourceRange: tfdiags.SourceRange{
|
||||||
Filename: "",
|
Filename: "",
|
||||||
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
|
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
|
||||||
End: 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),
|
Value: cty.StringVal(varValue3),
|
||||||
SourceType: terraform.ValueFromInput,
|
SourceType: opentf.ValueFromInput,
|
||||||
SourceRange: tfdiags.SourceRange{
|
SourceRange: tfdiags.SourceRange{
|
||||||
Filename: "",
|
Filename: "",
|
||||||
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
|
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
|
||||||
@ -326,28 +326,28 @@ func TestRemoteVariablesDoNotOverride(t *testing.T) {
|
|||||||
Category: &catTerraform,
|
Category: &catTerraform,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
terraform.InputValues{
|
opentf.InputValues{
|
||||||
varName1: &terraform.InputValue{
|
varName1: &opentf.InputValue{
|
||||||
Value: cty.StringVal(varValue1),
|
Value: cty.StringVal(varValue1),
|
||||||
SourceType: terraform.ValueFromInput,
|
SourceType: opentf.ValueFromInput,
|
||||||
SourceRange: tfdiags.SourceRange{
|
SourceRange: tfdiags.SourceRange{
|
||||||
Filename: "",
|
Filename: "",
|
||||||
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
|
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
|
||||||
End: 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),
|
Value: cty.StringVal(varValue2),
|
||||||
SourceType: terraform.ValueFromInput,
|
SourceType: opentf.ValueFromInput,
|
||||||
SourceRange: tfdiags.SourceRange{
|
SourceRange: tfdiags.SourceRange{
|
||||||
Filename: "",
|
Filename: "",
|
||||||
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
|
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
|
||||||
End: 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),
|
Value: cty.StringVal(varValue3),
|
||||||
SourceType: terraform.ValueFromNamedFile,
|
SourceType: opentf.ValueFromNamedFile,
|
||||||
SourceRange: tfdiags.SourceRange{
|
SourceRange: tfdiags.SourceRange{
|
||||||
Filename: "fake.tfvars",
|
Filename: "fake.tfvars",
|
||||||
Start: tfdiags.SourcePos{Line: 1, Column: 1, Byte: 0},
|
Start: tfdiags.SourcePos{Line: 1, Column: 1, Byte: 0},
|
||||||
@ -371,28 +371,28 @@ func TestRemoteVariablesDoNotOverride(t *testing.T) {
|
|||||||
Category: &catTerraform,
|
Category: &catTerraform,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
terraform.InputValues{
|
opentf.InputValues{
|
||||||
varName1: &terraform.InputValue{
|
varName1: &opentf.InputValue{
|
||||||
Value: cty.StringVal(varValue1),
|
Value: cty.StringVal(varValue1),
|
||||||
SourceType: terraform.ValueFromInput,
|
SourceType: opentf.ValueFromInput,
|
||||||
SourceRange: tfdiags.SourceRange{
|
SourceRange: tfdiags.SourceRange{
|
||||||
Filename: "",
|
Filename: "",
|
||||||
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
|
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
|
||||||
End: 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),
|
Value: cty.StringVal(varValue2),
|
||||||
SourceType: terraform.ValueFromInput,
|
SourceType: opentf.ValueFromInput,
|
||||||
SourceRange: tfdiags.SourceRange{
|
SourceRange: tfdiags.SourceRange{
|
||||||
Filename: "",
|
Filename: "",
|
||||||
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
|
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
|
||||||
End: 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),
|
Value: cty.StringVal(varValue3),
|
||||||
SourceType: terraform.ValueFromNamedFile,
|
SourceType: opentf.ValueFromNamedFile,
|
||||||
SourceRange: tfdiags.SourceRange{
|
SourceRange: tfdiags.SourceRange{
|
||||||
Filename: "fake.tfvars",
|
Filename: "fake.tfvars",
|
||||||
Start: tfdiags.SourcePos{Line: 1, Column: 1, Byte: 0},
|
Start: tfdiags.SourcePos{Line: 1, Column: 1, Byte: 0},
|
||||||
@ -461,10 +461,10 @@ func TestRemoteVariablesDoNotOverride(t *testing.T) {
|
|||||||
|
|
||||||
type testUnparsedVariableValue string
|
type testUnparsedVariableValue string
|
||||||
|
|
||||||
func (v testUnparsedVariableValue) ParseVariableValue(mode configs.VariableParsingMode) (*terraform.InputValue, tfdiags.Diagnostics) {
|
func (v testUnparsedVariableValue) ParseVariableValue(mode configs.VariableParsingMode) (*opentf.InputValue, tfdiags.Diagnostics) {
|
||||||
return &terraform.InputValue{
|
return &opentf.InputValue{
|
||||||
Value: cty.StringVal(string(v)),
|
Value: cty.StringVal(string(v)),
|
||||||
SourceType: terraform.ValueFromNamedFile,
|
SourceType: opentf.ValueFromNamedFile,
|
||||||
SourceRange: tfdiags.SourceRange{
|
SourceRange: tfdiags.SourceRange{
|
||||||
Filename: "fake.tfvars",
|
Filename: "fake.tfvars",
|
||||||
Start: tfdiags.SourcePos{Line: 1, Column: 1, Byte: 0},
|
Start: tfdiags.SourcePos{Line: 1, Column: 1, Byte: 0},
|
||||||
|
@ -28,7 +28,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans/planfile"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans/planfile"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
|
"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) {
|
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()
|
defer configCleanup()
|
||||||
|
|
||||||
if b.ContextOpts == nil {
|
if b.ContextOpts == nil {
|
||||||
b.ContextOpts = &terraform.ContextOpts{}
|
b.ContextOpts = &opentf.ContextOpts{}
|
||||||
}
|
}
|
||||||
b.ContextOpts.Parallelism = 3
|
b.ContextOpts.Parallelism = 3
|
||||||
op.Workspace = backend.DefaultStateName
|
op.Workspace = backend.DefaultStateName
|
||||||
@ -615,7 +615,7 @@ func TestRemote_planWithVariables(t *testing.T) {
|
|||||||
op, configCleanup, done := testOperationPlan(t, "./testdata/plan-variables")
|
op, configCleanup, done := testOperationPlan(t, "./testdata/plan-variables")
|
||||||
defer configCleanup()
|
defer configCleanup()
|
||||||
|
|
||||||
op.Variables = testVariables(terraform.ValueFromCLIArg, "foo", "bar")
|
op.Variables = testVariables(opentf.ValueFromCLIArg, "foo", "bar")
|
||||||
op.Workspace = backend.DefaultStateName
|
op.Workspace = backend.DefaultStateName
|
||||||
|
|
||||||
run, err := b.Operation(context.Background(), op)
|
run, err := b.Operation(context.Background(), op)
|
||||||
|
@ -25,7 +25,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/httpclient"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/httpclient"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/remote"
|
"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/internal/tfdiags"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/version"
|
"github.com/placeholderplaceholderplaceholder/opentf/version"
|
||||||
"github.com/zclconf/go-cty/cty"
|
"github.com/zclconf/go-cty/cty"
|
||||||
@ -49,7 +49,7 @@ type mockInput struct {
|
|||||||
answers map[string]string
|
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]
|
v, ok := m.answers[opts.Id]
|
||||||
if !ok {
|
if !ok {
|
||||||
return "", fmt.Errorf("unexpected input request in test: %s", opts.Id)
|
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 {
|
type unparsedVariableValue struct {
|
||||||
value string
|
value string
|
||||||
source terraform.ValueSourceType
|
source opentf.ValueSourceType
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *unparsedVariableValue) ParseVariableValue(mode configs.VariableParsingMode) (*terraform.InputValue, tfdiags.Diagnostics) {
|
func (v *unparsedVariableValue) ParseVariableValue(mode configs.VariableParsingMode) (*opentf.InputValue, tfdiags.Diagnostics) {
|
||||||
return &terraform.InputValue{
|
return &opentf.InputValue{
|
||||||
Value: cty.StringVal(v.value),
|
Value: cty.StringVal(v.value),
|
||||||
SourceType: v.source,
|
SourceType: v.source,
|
||||||
}, tfdiags.Diagnostics{}
|
}, tfdiags.Diagnostics{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// testVariable returns a backend.UnparsedVariableValue used for testing.
|
// 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))
|
vars := make(map[string]backend.UnparsedVariableValue, len(vs))
|
||||||
for _, v := range vs {
|
for _, v := range vs {
|
||||||
vars[v] = &unparsedVariableValue{
|
vars[v] = &unparsedVariableValue{
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
"github.com/hashicorp/hcl/v2"
|
"github.com/hashicorp/hcl/v2"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs"
|
"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/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
"github.com/zclconf/go-cty/cty"
|
"github.com/zclconf/go-cty/cty"
|
||||||
)
|
)
|
||||||
@ -25,7 +25,7 @@ type UnparsedVariableValue interface {
|
|||||||
//
|
//
|
||||||
// If error diagnostics are returned, the resulting value may be invalid
|
// If error diagnostics are returned, the resulting value may be invalid
|
||||||
// or incomplete.
|
// 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
|
// 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
|
// 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)
|
// 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.
|
// 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
|
var diags tfdiags.Diagnostics
|
||||||
ret := make(terraform.InputValues, len(vv))
|
ret := make(opentf.InputValues, len(vv))
|
||||||
seenUndeclaredInFile := 0
|
seenUndeclaredInFile := 0
|
||||||
|
|
||||||
for name, rv := range vv {
|
for name, rv := range vv {
|
||||||
@ -53,7 +53,7 @@ func ParseUndeclaredVariableValues(vv map[string]UnparsedVariableValue, decls ma
|
|||||||
ret[name] = val
|
ret[name] = val
|
||||||
|
|
||||||
switch val.SourceType {
|
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
|
// 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.
|
// 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
|
// 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++
|
seenUndeclaredInFile++
|
||||||
|
|
||||||
case terraform.ValueFromEnvVar:
|
case opentf.ValueFromEnvVar:
|
||||||
// We allow and ignore undeclared names for environment
|
// We allow and ignore undeclared names for environment
|
||||||
// variables, because users will often set these globally
|
// variables, because users will often set these globally
|
||||||
// when they are used across many (but not necessarily all)
|
// when they are used across many (but not necessarily all)
|
||||||
// configurations.
|
// configurations.
|
||||||
case terraform.ValueFromCLIArg:
|
case opentf.ValueFromCLIArg:
|
||||||
diags = diags.Append(tfdiags.Sourceless(
|
diags = diags.Append(tfdiags.Sourceless(
|
||||||
tfdiags.Error,
|
tfdiags.Error,
|
||||||
"Value for undeclared variable",
|
"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
|
// and returns an input values map of the ones declared in the specified
|
||||||
// variable declaration mapping. Diagnostics will be populating with
|
// variable declaration mapping. Diagnostics will be populating with
|
||||||
// any variable parsing errors encountered within this collection.
|
// 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
|
var diags tfdiags.Diagnostics
|
||||||
ret := make(terraform.InputValues, len(vv))
|
ret := make(opentf.InputValues, len(vv))
|
||||||
|
|
||||||
for name, rv := range vv {
|
for name, rv := range vv {
|
||||||
var mode configs.VariableParsingMode
|
var mode configs.VariableParsingMode
|
||||||
@ -132,9 +132,9 @@ func ParseDeclaredVariableValues(vv map[string]UnparsedVariableValue, decls map[
|
|||||||
return ret, diags
|
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
|
// a named variable
|
||||||
func isDefinedAny(name string, maps ...terraform.InputValues) bool {
|
func isDefinedAny(name string, maps ...opentf.InputValues) bool {
|
||||||
for _, m := range maps {
|
for _, m := range maps {
|
||||||
if _, defined := m[name]; defined {
|
if _, defined := m[name]; defined {
|
||||||
return true
|
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
|
// If this function returns without any errors in the diagnostics, the
|
||||||
// resulting input values map is guaranteed to be valid and ready to pass
|
// 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
|
// InputValues may be incomplete but will include the subset of variables
|
||||||
// that were successfully processed, allowing for careful analysis of the
|
// that were successfully processed, allowing for careful analysis of the
|
||||||
// partial result.
|
// 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)
|
ret, diags := ParseDeclaredVariableValues(vv, decls)
|
||||||
undeclared, diagsUndeclared := ParseUndeclaredVariableValues(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
|
// result is complete for any calling code that wants to cautiously
|
||||||
// analyze it for diagnostic purposes. Since our diagnostics now
|
// analyze it for diagnostic purposes. Since our diagnostics now
|
||||||
// includes an error, normal processing will ignore this result.
|
// includes an error, normal processing will ignore this result.
|
||||||
ret[name] = &terraform.InputValue{
|
ret[name] = &opentf.InputValue{
|
||||||
Value: cty.DynamicVal,
|
Value: cty.DynamicVal,
|
||||||
SourceType: terraform.ValueFromConfig,
|
SourceType: opentf.ValueFromConfig,
|
||||||
SourceRange: tfdiags.SourceRangeFromHCL(vc.DeclRange),
|
SourceRange: tfdiags.SourceRangeFromHCL(vc.DeclRange),
|
||||||
}
|
}
|
||||||
} else {
|
} 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
|
// that it wasn't set at all at this layer, and so OpenTF Core
|
||||||
// should substitute a default if available, or generate an error
|
// should substitute a default if available, or generate an error
|
||||||
// if not.
|
// if not.
|
||||||
ret[name] = &terraform.InputValue{
|
ret[name] = &opentf.InputValue{
|
||||||
Value: cty.NilVal,
|
Value: cty.NilVal,
|
||||||
SourceType: terraform.ValueFromConfig,
|
SourceType: opentf.ValueFromConfig,
|
||||||
SourceRange: tfdiags.SourceRangeFromHCL(vc.DeclRange),
|
SourceRange: tfdiags.SourceRangeFromHCL(vc.DeclRange),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
"github.com/zclconf/go-cty/cty"
|
"github.com/zclconf/go-cty/cty"
|
||||||
|
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs"
|
"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/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -72,10 +72,10 @@ func TestUnparsedValue(t *testing.T) {
|
|||||||
t.Fatalf("wrong number of diagnostics %d; want %d", got, want)
|
t.Fatalf("wrong number of diagnostics %d; want %d", got, want)
|
||||||
}
|
}
|
||||||
|
|
||||||
wantVals := terraform.InputValues{
|
wantVals := opentf.InputValues{
|
||||||
"declared1": {
|
"declared1": {
|
||||||
Value: cty.StringVal("5"),
|
Value: cty.StringVal("5"),
|
||||||
SourceType: terraform.ValueFromNamedFile,
|
SourceType: opentf.ValueFromNamedFile,
|
||||||
SourceRange: tfdiags.SourceRange{
|
SourceRange: tfdiags.SourceRange{
|
||||||
Filename: "fake.tfvars",
|
Filename: "fake.tfvars",
|
||||||
Start: tfdiags.SourcePos{Line: 1, Column: 1, Byte: 0},
|
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)
|
t.Errorf("wrong summary for diagnostic 2\ngot: %s\nwant: %s", got, want)
|
||||||
}
|
}
|
||||||
|
|
||||||
wantVals := terraform.InputValues{
|
wantVals := opentf.InputValues{
|
||||||
"undeclared0": {
|
"undeclared0": {
|
||||||
Value: cty.StringVal("0"),
|
Value: cty.StringVal("0"),
|
||||||
SourceType: terraform.ValueFromNamedFile,
|
SourceType: opentf.ValueFromNamedFile,
|
||||||
SourceRange: tfdiags.SourceRange{
|
SourceRange: tfdiags.SourceRange{
|
||||||
Filename: "fake.tfvars",
|
Filename: "fake.tfvars",
|
||||||
Start: tfdiags.SourcePos{Line: 1, Column: 1},
|
Start: tfdiags.SourcePos{Line: 1, Column: 1},
|
||||||
@ -120,7 +120,7 @@ func TestUnparsedValue(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"undeclared1": {
|
"undeclared1": {
|
||||||
Value: cty.StringVal("1"),
|
Value: cty.StringVal("1"),
|
||||||
SourceType: terraform.ValueFromNamedFile,
|
SourceType: opentf.ValueFromNamedFile,
|
||||||
SourceRange: tfdiags.SourceRange{
|
SourceRange: tfdiags.SourceRange{
|
||||||
Filename: "fake.tfvars",
|
Filename: "fake.tfvars",
|
||||||
Start: tfdiags.SourcePos{Line: 1, Column: 1},
|
Start: tfdiags.SourcePos{Line: 1, Column: 1},
|
||||||
@ -129,7 +129,7 @@ func TestUnparsedValue(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"undeclared2": {
|
"undeclared2": {
|
||||||
Value: cty.StringVal("2"),
|
Value: cty.StringVal("2"),
|
||||||
SourceType: terraform.ValueFromNamedFile,
|
SourceType: opentf.ValueFromNamedFile,
|
||||||
SourceRange: tfdiags.SourceRange{
|
SourceRange: tfdiags.SourceRange{
|
||||||
Filename: "fake.tfvars",
|
Filename: "fake.tfvars",
|
||||||
Start: tfdiags.SourcePos{Line: 1, Column: 1},
|
Start: tfdiags.SourcePos{Line: 1, Column: 1},
|
||||||
@ -138,7 +138,7 @@ func TestUnparsedValue(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"undeclared3": {
|
"undeclared3": {
|
||||||
Value: cty.StringVal("3"),
|
Value: cty.StringVal("3"),
|
||||||
SourceType: terraform.ValueFromNamedFile,
|
SourceType: opentf.ValueFromNamedFile,
|
||||||
SourceRange: tfdiags.SourceRange{
|
SourceRange: tfdiags.SourceRange{
|
||||||
Filename: "fake.tfvars",
|
Filename: "fake.tfvars",
|
||||||
Start: tfdiags.SourcePos{Line: 1, Column: 1},
|
Start: tfdiags.SourcePos{Line: 1, Column: 1},
|
||||||
@ -147,7 +147,7 @@ func TestUnparsedValue(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"undeclared4": {
|
"undeclared4": {
|
||||||
Value: cty.StringVal("4"),
|
Value: cty.StringVal("4"),
|
||||||
SourceType: terraform.ValueFromNamedFile,
|
SourceType: opentf.ValueFromNamedFile,
|
||||||
SourceRange: tfdiags.SourceRange{
|
SourceRange: tfdiags.SourceRange{
|
||||||
Filename: "fake.tfvars",
|
Filename: "fake.tfvars",
|
||||||
Start: tfdiags.SourcePos{Line: 1, Column: 1},
|
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)
|
t.Errorf("wrong summary for diagnostic 3\ngot: %s\nwant: %s", got, want)
|
||||||
}
|
}
|
||||||
|
|
||||||
wantVals := terraform.InputValues{
|
wantVals := opentf.InputValues{
|
||||||
"declared1": {
|
"declared1": {
|
||||||
Value: cty.StringVal("5"),
|
Value: cty.StringVal("5"),
|
||||||
SourceType: terraform.ValueFromNamedFile,
|
SourceType: opentf.ValueFromNamedFile,
|
||||||
SourceRange: tfdiags.SourceRange{
|
SourceRange: tfdiags.SourceRange{
|
||||||
Filename: "fake.tfvars",
|
Filename: "fake.tfvars",
|
||||||
Start: tfdiags.SourcePos{Line: 1, Column: 1, Byte: 0},
|
Start: tfdiags.SourcePos{Line: 1, Column: 1, Byte: 0},
|
||||||
@ -199,7 +199,7 @@ func TestUnparsedValue(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"missing1": {
|
"missing1": {
|
||||||
Value: cty.DynamicVal,
|
Value: cty.DynamicVal,
|
||||||
SourceType: terraform.ValueFromConfig,
|
SourceType: opentf.ValueFromConfig,
|
||||||
SourceRange: tfdiags.SourceRange{
|
SourceRange: tfdiags.SourceRange{
|
||||||
Filename: "fake.tf",
|
Filename: "fake.tf",
|
||||||
Start: tfdiags.SourcePos{Line: 3, Column: 1, Byte: 0},
|
Start: tfdiags.SourcePos{Line: 3, Column: 1, Byte: 0},
|
||||||
@ -208,7 +208,7 @@ func TestUnparsedValue(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"missing2": {
|
"missing2": {
|
||||||
Value: cty.NilVal, // OpenTF Core handles substituting the default
|
Value: cty.NilVal, // OpenTF Core handles substituting the default
|
||||||
SourceType: terraform.ValueFromConfig,
|
SourceType: opentf.ValueFromConfig,
|
||||||
SourceRange: tfdiags.SourceRange{
|
SourceRange: tfdiags.SourceRange{
|
||||||
Filename: "fake.tf",
|
Filename: "fake.tf",
|
||||||
Start: tfdiags.SourcePos{Line: 4, Column: 1, Byte: 0},
|
Start: tfdiags.SourcePos{Line: 4, Column: 1, Byte: 0},
|
||||||
@ -224,10 +224,10 @@ func TestUnparsedValue(t *testing.T) {
|
|||||||
|
|
||||||
type testUnparsedVariableValue string
|
type testUnparsedVariableValue string
|
||||||
|
|
||||||
func (v testUnparsedVariableValue) ParseVariableValue(mode configs.VariableParsingMode) (*terraform.InputValue, tfdiags.Diagnostics) {
|
func (v testUnparsedVariableValue) ParseVariableValue(mode configs.VariableParsingMode) (*opentf.InputValue, tfdiags.Diagnostics) {
|
||||||
return &terraform.InputValue{
|
return &opentf.InputValue{
|
||||||
Value: cty.StringVal(string(v)),
|
Value: cty.StringVal(string(v)),
|
||||||
SourceType: terraform.ValueFromNamedFile,
|
SourceType: opentf.ValueFromNamedFile,
|
||||||
SourceRange: tfdiags.SourceRange{
|
SourceRange: tfdiags.SourceRange{
|
||||||
Filename: "fake.tfvars",
|
Filename: "fake.tfvars",
|
||||||
Start: tfdiags.SourcePos{Line: 1, Column: 1, Byte: 0},
|
Start: tfdiags.SourcePos{Line: 1, Column: 1, Byte: 0},
|
||||||
|
@ -30,7 +30,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
"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/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
tfversion "github.com/placeholderplaceholderplaceholder/opentf/version"
|
tfversion "github.com/placeholderplaceholderplaceholder/opentf/version"
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ type Cloud struct {
|
|||||||
// ContextOpts are the base context options to set when initializing a
|
// ContextOpts are the base context options to set when initializing a
|
||||||
// new Terraform context. Many of these will be overridden or merged by
|
// new Terraform context. Many of these will be overridden or merged by
|
||||||
// Operation. See Operation for more details.
|
// Operation. See Operation for more details.
|
||||||
ContextOpts *terraform.ContextOpts
|
ContextOpts *opentf.ContextOpts
|
||||||
|
|
||||||
// client is the cloud backend API client.
|
// client is the cloud backend API client.
|
||||||
client *tfe.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
|
// Only ask if the remote operation should be canceled
|
||||||
// if the auto approve flag is not set.
|
// if the auto approve flag is not set.
|
||||||
if !op.AutoApprove {
|
if !op.AutoApprove {
|
||||||
v, err := op.UIIn.Input(cancelCtx, &terraform.InputOpts{
|
v, err := op.UIIn.Input(cancelCtx, &opentf.InputOpts{
|
||||||
Id: "cancel",
|
Id: "cancel",
|
||||||
Query: "\nDo you want to cancel the remote operation?",
|
Query: "\nDo you want to cancel the remote operation?",
|
||||||
Description: "Only 'yes' will be accepted to cancel.",
|
Description: "Only 'yes' will be accepted to cancel.",
|
||||||
|
@ -16,7 +16,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/jsonformat"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/jsonformat"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
"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
|
mustConfirm := (op.UIIn != nil && op.UIOut != nil) && !op.AutoApprove
|
||||||
|
|
||||||
if mustConfirm && b.input {
|
if mustConfirm && b.input {
|
||||||
opts := &terraform.InputOpts{Id: "approve"}
|
opts := &opentf.InputOpts{Id: "approve"}
|
||||||
|
|
||||||
if op.PlanMode == plans.DestroyMode {
|
if op.PlanMode == plans.DestroyMode {
|
||||||
opts.Query = "\nDo you really want to destroy all resources in workspace \"" + op.Workspace + "\"?"
|
opts.Query = "\nDo you really want to destroy all resources in workspace \"" + op.Workspace + "\"?"
|
||||||
|
@ -33,7 +33,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans/planfile"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans/planfile"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
tfversion "github.com/placeholderplaceholderplaceholder/opentf/version"
|
tfversion "github.com/placeholderplaceholderplaceholder/opentf/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -386,7 +386,7 @@ func TestCloud_applyWithParallelism(t *testing.T) {
|
|||||||
defer configCleanup()
|
defer configCleanup()
|
||||||
|
|
||||||
if b.ContextOpts == nil {
|
if b.ContextOpts == nil {
|
||||||
b.ContextOpts = &terraform.ContextOpts{}
|
b.ContextOpts = &opentf.ContextOpts{}
|
||||||
}
|
}
|
||||||
b.ContextOpts.Parallelism = 3
|
b.ContextOpts.Parallelism = 3
|
||||||
op.Workspace = testBackendSingleWorkspaceName
|
op.Workspace = testBackendSingleWorkspaceName
|
||||||
@ -668,7 +668,7 @@ func TestCloud_applyWithRequiredVariables(t *testing.T) {
|
|||||||
defer configCleanup()
|
defer configCleanup()
|
||||||
defer done(t)
|
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
|
op.Workspace = testBackendSingleWorkspaceName
|
||||||
|
|
||||||
run, err := b.Operation(context.Background(), op)
|
run, err := b.Operation(context.Background(), op)
|
||||||
|
@ -25,7 +25,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/jsonformat"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/jsonformat"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/logging"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/logging"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -405,7 +405,7 @@ func (b *Cloud) checkPolicy(stopCtx, cancelCtx context.Context, op *backend.Oper
|
|||||||
} else if !b.input {
|
} else if !b.input {
|
||||||
return errPolicyOverrideNeedsUIConfirmation
|
return errPolicyOverrideNeedsUIConfirmation
|
||||||
} else {
|
} else {
|
||||||
opts := &terraform.InputOpts{
|
opts := &opentf.InputOpts{
|
||||||
Id: "override",
|
Id: "override",
|
||||||
Query: "\nDo you want to override the soft failed policy check?",
|
Query: "\nDo you want to override the soft failed policy check?",
|
||||||
Description: "Only 'override' will be accepted to override.",
|
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
|
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)
|
doneCtx, cancel := context.WithCancel(stopCtx)
|
||||||
result := make(chan error, 2)
|
result := make(chan error, 2)
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
"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/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
"github.com/zclconf/go-cty/cty"
|
"github.com/zclconf/go-cty/cty"
|
||||||
)
|
)
|
||||||
@ -24,7 +24,7 @@ import (
|
|||||||
func (b *Cloud) LocalRun(op *backend.Operation) (*backend.LocalRun, statemgr.Full, tfdiags.Diagnostics) {
|
func (b *Cloud) LocalRun(op *backend.Operation) (*backend.LocalRun, statemgr.Full, tfdiags.Diagnostics) {
|
||||||
var diags tfdiags.Diagnostics
|
var diags tfdiags.Diagnostics
|
||||||
ret := &backend.LocalRun{
|
ret := &backend.LocalRun{
|
||||||
PlanOpts: &terraform.PlanOpts{
|
PlanOpts: &opentf.PlanOpts{
|
||||||
Mode: op.PlanMode,
|
Mode: op.PlanMode,
|
||||||
Targets: op.Targets,
|
Targets: op.Targets,
|
||||||
},
|
},
|
||||||
@ -63,7 +63,7 @@ func (b *Cloud) LocalRun(op *backend.Operation) (*backend.LocalRun, statemgr.Ful
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Initialize our context options
|
// Initialize our context options
|
||||||
var opts terraform.ContextOpts
|
var opts opentf.ContextOpts
|
||||||
if v := b.ContextOpts; v != nil {
|
if v := b.ContextOpts; v != nil {
|
||||||
opts = *v
|
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)
|
diags = diags.Append(ctxDiags)
|
||||||
ret.Core = tfCtx
|
ret.Core = tfCtx
|
||||||
|
|
||||||
@ -183,24 +183,24 @@ func (b *Cloud) getRemoteWorkspaceID(ctx context.Context, localWorkspaceName str
|
|||||||
return remoteWorkspace.ID, nil
|
return remoteWorkspace.ID, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func stubAllVariables(vv map[string]backend.UnparsedVariableValue, decls map[string]*configs.Variable) terraform.InputValues {
|
func stubAllVariables(vv map[string]backend.UnparsedVariableValue, decls map[string]*configs.Variable) opentf.InputValues {
|
||||||
ret := make(terraform.InputValues, len(decls))
|
ret := make(opentf.InputValues, len(decls))
|
||||||
|
|
||||||
for name, cfg := range decls {
|
for name, cfg := range decls {
|
||||||
raw, exists := vv[name]
|
raw, exists := vv[name]
|
||||||
if !exists {
|
if !exists {
|
||||||
ret[name] = &terraform.InputValue{
|
ret[name] = &opentf.InputValue{
|
||||||
Value: cty.UnknownVal(cfg.Type),
|
Value: cty.UnknownVal(cfg.Type),
|
||||||
SourceType: terraform.ValueFromConfig,
|
SourceType: opentf.ValueFromConfig,
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
val, diags := raw.ParseVariableValue(cfg.ParsingMode)
|
val, diags := raw.ParseVariableValue(cfg.ParsingMode)
|
||||||
if diags.HasErrors() {
|
if diags.HasErrors() {
|
||||||
ret[name] = &terraform.InputValue{
|
ret[name] = &opentf.InputValue{
|
||||||
Value: cty.UnknownVal(cfg.Type),
|
Value: cty.UnknownVal(cfg.Type),
|
||||||
SourceType: terraform.ValueFromConfig,
|
SourceType: opentf.ValueFromConfig,
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -219,7 +219,7 @@ type remoteStoredVariableValue struct {
|
|||||||
|
|
||||||
var _ backend.UnparsedVariableValue = (*remoteStoredVariableValue)(nil)
|
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 diags tfdiags.Diagnostics
|
||||||
var val cty.Value
|
var val cty.Value
|
||||||
|
|
||||||
@ -282,7 +282,7 @@ func (v *remoteStoredVariableValue) ParseVariableValue(mode configs.VariablePars
|
|||||||
val = cty.StringVal(v.definition.Value)
|
val = cty.StringVal(v.definition.Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &terraform.InputValue{
|
return &opentf.InputValue{
|
||||||
Value: val,
|
Value: val,
|
||||||
|
|
||||||
// We mark these as "from input" with the rationale that entering
|
// 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
|
// roughly speaking, a similar idea to entering variable values at
|
||||||
// the interactive CLI prompts. It's not a perfect correspondance,
|
// the interactive CLI prompts. It's not a perfect correspondance,
|
||||||
// but it's closer than the other options.
|
// but it's closer than the other options.
|
||||||
SourceType: terraform.ValueFromInput,
|
SourceType: opentf.ValueFromInput,
|
||||||
}, diags
|
}, diags
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/initwd"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/initwd"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -255,7 +255,7 @@ func TestRemoteVariablesDoNotOverride(t *testing.T) {
|
|||||||
tests := map[string]struct {
|
tests := map[string]struct {
|
||||||
localVariables map[string]backend.UnparsedVariableValue
|
localVariables map[string]backend.UnparsedVariableValue
|
||||||
remoteVariables []*tfe.VariableCreateOptions
|
remoteVariables []*tfe.VariableCreateOptions
|
||||||
expectedVariables terraform.InputValues
|
expectedVariables opentf.InputValues
|
||||||
}{
|
}{
|
||||||
"no local variables": {
|
"no local variables": {
|
||||||
map[string]backend.UnparsedVariableValue{},
|
map[string]backend.UnparsedVariableValue{},
|
||||||
@ -276,28 +276,28 @@ func TestRemoteVariablesDoNotOverride(t *testing.T) {
|
|||||||
Category: &catTerraform,
|
Category: &catTerraform,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
terraform.InputValues{
|
opentf.InputValues{
|
||||||
varName1: &terraform.InputValue{
|
varName1: &opentf.InputValue{
|
||||||
Value: cty.StringVal(varValue1),
|
Value: cty.StringVal(varValue1),
|
||||||
SourceType: terraform.ValueFromInput,
|
SourceType: opentf.ValueFromInput,
|
||||||
SourceRange: tfdiags.SourceRange{
|
SourceRange: tfdiags.SourceRange{
|
||||||
Filename: "",
|
Filename: "",
|
||||||
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
|
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
|
||||||
End: 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),
|
Value: cty.StringVal(varValue2),
|
||||||
SourceType: terraform.ValueFromInput,
|
SourceType: opentf.ValueFromInput,
|
||||||
SourceRange: tfdiags.SourceRange{
|
SourceRange: tfdiags.SourceRange{
|
||||||
Filename: "",
|
Filename: "",
|
||||||
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
|
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
|
||||||
End: 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),
|
Value: cty.StringVal(varValue3),
|
||||||
SourceType: terraform.ValueFromInput,
|
SourceType: opentf.ValueFromInput,
|
||||||
SourceRange: tfdiags.SourceRange{
|
SourceRange: tfdiags.SourceRange{
|
||||||
Filename: "",
|
Filename: "",
|
||||||
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
|
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
|
||||||
@ -308,7 +308,7 @@ func TestRemoteVariablesDoNotOverride(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"single conflicting local variable": {
|
"single conflicting local variable": {
|
||||||
map[string]backend.UnparsedVariableValue{
|
map[string]backend.UnparsedVariableValue{
|
||||||
varName3: testUnparsedVariableValue{source: terraform.ValueFromNamedFile, value: cty.StringVal(varValue3)},
|
varName3: testUnparsedVariableValue{source: opentf.ValueFromNamedFile, value: cty.StringVal(varValue3)},
|
||||||
},
|
},
|
||||||
[]*tfe.VariableCreateOptions{
|
[]*tfe.VariableCreateOptions{
|
||||||
{
|
{
|
||||||
@ -325,28 +325,28 @@ func TestRemoteVariablesDoNotOverride(t *testing.T) {
|
|||||||
Category: &catTerraform,
|
Category: &catTerraform,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
terraform.InputValues{
|
opentf.InputValues{
|
||||||
varName1: &terraform.InputValue{
|
varName1: &opentf.InputValue{
|
||||||
Value: cty.StringVal(varValue1),
|
Value: cty.StringVal(varValue1),
|
||||||
SourceType: terraform.ValueFromInput,
|
SourceType: opentf.ValueFromInput,
|
||||||
SourceRange: tfdiags.SourceRange{
|
SourceRange: tfdiags.SourceRange{
|
||||||
Filename: "",
|
Filename: "",
|
||||||
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
|
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
|
||||||
End: 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),
|
Value: cty.StringVal(varValue2),
|
||||||
SourceType: terraform.ValueFromInput,
|
SourceType: opentf.ValueFromInput,
|
||||||
SourceRange: tfdiags.SourceRange{
|
SourceRange: tfdiags.SourceRange{
|
||||||
Filename: "",
|
Filename: "",
|
||||||
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
|
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
|
||||||
End: 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),
|
Value: cty.StringVal(varValue3),
|
||||||
SourceType: terraform.ValueFromNamedFile,
|
SourceType: opentf.ValueFromNamedFile,
|
||||||
SourceRange: tfdiags.SourceRange{
|
SourceRange: tfdiags.SourceRange{
|
||||||
Filename: "fake.tfvars",
|
Filename: "fake.tfvars",
|
||||||
Start: tfdiags.SourcePos{Line: 1, Column: 1, Byte: 0},
|
Start: tfdiags.SourcePos{Line: 1, Column: 1, Byte: 0},
|
||||||
@ -357,7 +357,7 @@ func TestRemoteVariablesDoNotOverride(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"no conflicting local variable": {
|
"no conflicting local variable": {
|
||||||
map[string]backend.UnparsedVariableValue{
|
map[string]backend.UnparsedVariableValue{
|
||||||
varName3: testUnparsedVariableValue{source: terraform.ValueFromNamedFile, value: cty.StringVal(varValue3)},
|
varName3: testUnparsedVariableValue{source: opentf.ValueFromNamedFile, value: cty.StringVal(varValue3)},
|
||||||
},
|
},
|
||||||
[]*tfe.VariableCreateOptions{
|
[]*tfe.VariableCreateOptions{
|
||||||
{
|
{
|
||||||
@ -370,28 +370,28 @@ func TestRemoteVariablesDoNotOverride(t *testing.T) {
|
|||||||
Category: &catTerraform,
|
Category: &catTerraform,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
terraform.InputValues{
|
opentf.InputValues{
|
||||||
varName1: &terraform.InputValue{
|
varName1: &opentf.InputValue{
|
||||||
Value: cty.StringVal(varValue1),
|
Value: cty.StringVal(varValue1),
|
||||||
SourceType: terraform.ValueFromInput,
|
SourceType: opentf.ValueFromInput,
|
||||||
SourceRange: tfdiags.SourceRange{
|
SourceRange: tfdiags.SourceRange{
|
||||||
Filename: "",
|
Filename: "",
|
||||||
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
|
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
|
||||||
End: 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),
|
Value: cty.StringVal(varValue2),
|
||||||
SourceType: terraform.ValueFromInput,
|
SourceType: opentf.ValueFromInput,
|
||||||
SourceRange: tfdiags.SourceRange{
|
SourceRange: tfdiags.SourceRange{
|
||||||
Filename: "",
|
Filename: "",
|
||||||
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
|
Start: tfdiags.SourcePos{Line: 0, Column: 0, Byte: 0},
|
||||||
End: 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),
|
Value: cty.StringVal(varValue3),
|
||||||
SourceType: terraform.ValueFromNamedFile,
|
SourceType: opentf.ValueFromNamedFile,
|
||||||
SourceRange: tfdiags.SourceRange{
|
SourceRange: tfdiags.SourceRange{
|
||||||
Filename: "fake.tfvars",
|
Filename: "fake.tfvars",
|
||||||
Start: tfdiags.SourcePos{Line: 1, Column: 1, Byte: 0},
|
Start: tfdiags.SourcePos{Line: 1, Column: 1, Byte: 0},
|
||||||
|
@ -31,7 +31,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans/planfile"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans/planfile"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
|
"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) {
|
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()
|
defer configCleanup()
|
||||||
|
|
||||||
if b.ContextOpts == nil {
|
if b.ContextOpts == nil {
|
||||||
b.ContextOpts = &terraform.ContextOpts{}
|
b.ContextOpts = &opentf.ContextOpts{}
|
||||||
}
|
}
|
||||||
b.ContextOpts.Parallelism = 3
|
b.ContextOpts.Parallelism = 3
|
||||||
op.Workspace = testBackendSingleWorkspaceName
|
op.Workspace = testBackendSingleWorkspaceName
|
||||||
@ -610,7 +610,7 @@ func TestCloud_planWithRequiredVariables(t *testing.T) {
|
|||||||
defer configCleanup()
|
defer configCleanup()
|
||||||
defer done(t)
|
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
|
op.Workspace = testBackendSingleWorkspaceName
|
||||||
|
|
||||||
run, err := b.Operation(context.Background(), op)
|
run, err := b.Operation(context.Background(), op)
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
"github.com/hashicorp/go-multierror"
|
"github.com/hashicorp/go-multierror"
|
||||||
tfe "github.com/hashicorp/go-tfe"
|
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
|
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) {
|
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),
|
Id: fmt.Sprintf("%c%c [bold]Override", Arrow, Arrow),
|
||||||
Query: "\nDo you want to override the failed policy check?",
|
Query: "\nDo you want to override the failed policy check?",
|
||||||
Description: "Only 'override' will be accepted to override.",
|
Description: "Only 'override' will be accepted to override.",
|
||||||
|
@ -7,12 +7,12 @@ import (
|
|||||||
"github.com/hashicorp/hcl/v2/hclwrite"
|
"github.com/hashicorp/hcl/v2/hclwrite"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs"
|
"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/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
)
|
)
|
||||||
|
|
||||||
func allowedSourceType(source terraform.ValueSourceType) bool {
|
func allowedSourceType(source opentf.ValueSourceType) bool {
|
||||||
return source == terraform.ValueFromNamedFile || source == terraform.ValueFromCLIArg || source == terraform.ValueFromEnvVar
|
return source == opentf.ValueFromNamedFile || source == opentf.ValueFromCLIArg || source == opentf.ValueFromEnvVar
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParseCloudRunVariables accepts a mapping of unparsed values and a mapping of variable
|
// ParseCloudRunVariables accepts a mapping of unparsed values and a mapping of variable
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
"github.com/hashicorp/hcl/v2"
|
"github.com/hashicorp/hcl/v2"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs"
|
"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/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
"github.com/zclconf/go-cty/cty"
|
"github.com/zclconf/go-cty/cty"
|
||||||
)
|
)
|
||||||
@ -18,16 +18,16 @@ import (
|
|||||||
func TestParseCloudRunVariables(t *testing.T) {
|
func TestParseCloudRunVariables(t *testing.T) {
|
||||||
t.Run("populates variables from allowed sources", func(t *testing.T) {
|
t.Run("populates variables from allowed sources", func(t *testing.T) {
|
||||||
vv := map[string]backend.UnparsedVariableValue{
|
vv := map[string]backend.UnparsedVariableValue{
|
||||||
"undeclared": testUnparsedVariableValue{source: terraform.ValueFromCLIArg, value: cty.StringVal("0")},
|
"undeclared": testUnparsedVariableValue{source: opentf.ValueFromCLIArg, value: cty.StringVal("0")},
|
||||||
"declaredFromConfig": testUnparsedVariableValue{source: terraform.ValueFromConfig, value: cty.StringVal("1")},
|
"declaredFromConfig": testUnparsedVariableValue{source: opentf.ValueFromConfig, value: cty.StringVal("1")},
|
||||||
"declaredFromNamedFileMapString": testUnparsedVariableValue{source: terraform.ValueFromNamedFile, value: cty.MapVal(map[string]cty.Value{"foo": cty.StringVal("bar")})},
|
"declaredFromNamedFileMapString": testUnparsedVariableValue{source: opentf.ValueFromNamedFile, value: cty.MapVal(map[string]cty.Value{"foo": cty.StringVal("bar")})},
|
||||||
"declaredFromNamedFileBool": testUnparsedVariableValue{source: terraform.ValueFromNamedFile, value: cty.BoolVal(true)},
|
"declaredFromNamedFileBool": testUnparsedVariableValue{source: opentf.ValueFromNamedFile, value: cty.BoolVal(true)},
|
||||||
"declaredFromNamedFileNumber": testUnparsedVariableValue{source: terraform.ValueFromNamedFile, value: cty.NumberIntVal(2)},
|
"declaredFromNamedFileNumber": testUnparsedVariableValue{source: opentf.ValueFromNamedFile, value: cty.NumberIntVal(2)},
|
||||||
"declaredFromNamedFileListString": testUnparsedVariableValue{source: terraform.ValueFromNamedFile, value: cty.ListVal([]cty.Value{cty.StringVal("2a"), cty.StringVal("2b")})},
|
"declaredFromNamedFileListString": testUnparsedVariableValue{source: opentf.ValueFromNamedFile, value: cty.ListVal([]cty.Value{cty.StringVal("2a"), cty.StringVal("2b")})},
|
||||||
"declaredFromNamedFileNull": testUnparsedVariableValue{source: terraform.ValueFromNamedFile, value: cty.NullVal(cty.String)},
|
"declaredFromNamedFileNull": testUnparsedVariableValue{source: opentf.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)})})})},
|
"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: terraform.ValueFromCLIArg, value: cty.StringVal("3")},
|
"declaredFromCLIArg": testUnparsedVariableValue{source: opentf.ValueFromCLIArg, value: cty.StringVal("3")},
|
||||||
"declaredFromEnvVar": testUnparsedVariableValue{source: terraform.ValueFromEnvVar, value: cty.StringVal("4")},
|
"declaredFromEnvVar": testUnparsedVariableValue{source: opentf.ValueFromEnvVar, value: cty.StringVal("4")},
|
||||||
}
|
}
|
||||||
|
|
||||||
decls := map[string]*configs.Variable{
|
decls := map[string]*configs.Variable{
|
||||||
@ -169,12 +169,12 @@ func TestParseCloudRunVariables(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type testUnparsedVariableValue struct {
|
type testUnparsedVariableValue struct {
|
||||||
source terraform.ValueSourceType
|
source opentf.ValueSourceType
|
||||||
value cty.Value
|
value cty.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v testUnparsedVariableValue) ParseVariableValue(mode configs.VariableParsingMode) (*terraform.InputValue, tfdiags.Diagnostics) {
|
func (v testUnparsedVariableValue) ParseVariableValue(mode configs.VariableParsingMode) (*opentf.InputValue, tfdiags.Diagnostics) {
|
||||||
return &terraform.InputValue{
|
return &opentf.InputValue{
|
||||||
Value: v.value,
|
Value: v.value,
|
||||||
SourceType: v.source,
|
SourceType: v.source,
|
||||||
SourceRange: tfdiags.SourceRange{
|
SourceRange: tfdiags.SourceRange{
|
||||||
|
@ -31,7 +31,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/remote"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/remote"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
"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
|
// 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
|
// 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()
|
s.mu.Lock()
|
||||||
defer s.mu.Unlock()
|
defer s.mu.Unlock()
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
|
"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/internal/tfdiags"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/version"
|
"github.com/placeholderplaceholderplaceholder/opentf/version"
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ type mockInput struct {
|
|||||||
answers map[string]string
|
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]
|
v, ok := m.answers[opts.Id]
|
||||||
if !ok {
|
if !ok {
|
||||||
return "", fmt.Errorf("unexpected input request in test: %s", opts.Id)
|
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 {
|
type unparsedVariableValue struct {
|
||||||
value string
|
value string
|
||||||
source terraform.ValueSourceType
|
source opentf.ValueSourceType
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *unparsedVariableValue) ParseVariableValue(mode configs.VariableParsingMode) (*terraform.InputValue, tfdiags.Diagnostics) {
|
func (v *unparsedVariableValue) ParseVariableValue(mode configs.VariableParsingMode) (*opentf.InputValue, tfdiags.Diagnostics) {
|
||||||
return &terraform.InputValue{
|
return &opentf.InputValue{
|
||||||
Value: cty.StringVal(v.value),
|
Value: cty.StringVal(v.value),
|
||||||
SourceType: v.source,
|
SourceType: v.source,
|
||||||
}, tfdiags.Diagnostics{}
|
}, tfdiags.Diagnostics{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// testVariable returns a backend.UnparsedVariableValue used for testing.
|
// 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))
|
vars := make(map[string]backend.UnparsedVariableValue, len(vs))
|
||||||
for _, v := range vs {
|
for _, v := range vs {
|
||||||
vars[v] = &unparsedVariableValue{
|
vars[v] = &unparsedVariableValue{
|
||||||
|
@ -27,7 +27,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
"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/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -299,7 +299,7 @@ func TestApply_parallelism(t *testing.T) {
|
|||||||
providerFactories := map[addrs.Provider]providers.Factory{}
|
providerFactories := map[addrs.Provider]providers.Factory{}
|
||||||
for i := 0; i < 10; i++ {
|
for i := 0; i < 10; i++ {
|
||||||
name := fmt.Sprintf("test%d", i)
|
name := fmt.Sprintf("test%d", i)
|
||||||
provider := &terraform.MockProvider{}
|
provider := &opentf.MockProvider{}
|
||||||
provider.GetProviderSchemaResponse = &providers.GetProviderSchemaResponse{
|
provider.GetProviderSchemaResponse = &providers.GetProviderSchemaResponse{
|
||||||
ResourceTypes: map[string]providers.Schema{
|
ResourceTypes: map[string]providers.Schema{
|
||||||
name + "_instance": {Block: &configschema.Block{}},
|
name + "_instance": {Block: &configschema.Block{}},
|
||||||
@ -2160,7 +2160,7 @@ func applyFixtureSchema() *providers.GetProviderSchemaResponse {
|
|||||||
// GetSchemaResponse, PlanResourceChangeFn, and ApplyResourceChangeFn populated,
|
// GetSchemaResponse, PlanResourceChangeFn, and ApplyResourceChangeFn populated,
|
||||||
// with the plan/apply steps just passing through the data determined by
|
// with the plan/apply steps just passing through the data determined by
|
||||||
// Terraform Core.
|
// Terraform Core.
|
||||||
func applyFixtureProvider() *terraform.MockProvider {
|
func applyFixtureProvider() *opentf.MockProvider {
|
||||||
p := testProvider()
|
p := testProvider()
|
||||||
p.GetProviderSchemaResponse = applyFixtureSchema()
|
p.GetProviderSchemaResponse = applyFixtureSchema()
|
||||||
p.PlanResourceChangeFn = func(req providers.PlanResourceChangeRequest) providers.PlanResourceChangeResponse {
|
p.PlanResourceChangeFn = func(req providers.PlanResourceChangeRequest) providers.PlanResourceChangeResponse {
|
||||||
|
@ -50,7 +50,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/version"
|
"github.com/placeholderplaceholderplaceholder/opentf/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -523,8 +523,8 @@ func testStateOutput(t *testing.T, path string, expected string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func testProvider() *terraform.MockProvider {
|
func testProvider() *opentf.MockProvider {
|
||||||
p := new(terraform.MockProvider)
|
p := new(opentf.MockProvider)
|
||||||
p.PlanResourceChangeFn = func(req providers.PlanResourceChangeRequest) (resp providers.PlanResourceChangeResponse) {
|
p.PlanResourceChangeFn = func(req providers.PlanResourceChangeRequest) (resp providers.PlanResourceChangeResponse) {
|
||||||
resp.PlannedState = req.ProposedNewState
|
resp.PlannedState = req.ProposedNewState
|
||||||
return resp
|
return resp
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/arguments"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/arguments"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/repl"
|
"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/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
|
|
||||||
"github.com/mitchellh/cli"
|
"github.com/mitchellh/cli"
|
||||||
@ -121,7 +121,7 @@ func (c *ConsoleCommand) Run(args []string) int {
|
|||||||
ErrorWriter: os.Stderr,
|
ErrorWriter: os.Stderr,
|
||||||
}
|
}
|
||||||
|
|
||||||
evalOpts := &terraform.EvalOpts{}
|
evalOpts := &opentf.EvalOpts{}
|
||||||
if lr.PlanOpts != nil {
|
if lr.PlanOpts != nil {
|
||||||
// the LocalRun type is built primarily to support the main operations,
|
// the LocalRun type is built primarily to support the main operations,
|
||||||
// so the variable values end up in the "PlanOpts" even though we're
|
// so the variable values end up in the "PlanOpts" even though we're
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/dag"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/dag"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans/planfile"
|
"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"
|
"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
|
var graphDiags tfdiags.Diagnostics
|
||||||
switch graphTypeStr {
|
switch graphTypeStr {
|
||||||
case "plan":
|
case "plan":
|
||||||
@ -171,7 +171,7 @@ func (c *GraphCommand) Run(args []string) int {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
graphStr, err := terraform.GraphDot(g, &dag.DotOpts{
|
graphStr, err := opentf.GraphDot(g, &dag.DotOpts{
|
||||||
DrawCycles: drawCycles,
|
DrawCycles: drawCycles,
|
||||||
MaxDepth: moduleDepth,
|
MaxDepth: moduleDepth,
|
||||||
Verbose: verbose,
|
Verbose: verbose,
|
||||||
|
@ -19,7 +19,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/arguments"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/arguments"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs"
|
"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/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ func (c *ImportCommand) Run(args []string) int {
|
|||||||
c.showDiagnostics(diags)
|
c.showDiagnostics(diags)
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
opReq.Hooks = []terraform.Hook{c.uiHook()}
|
opReq.Hooks = []opentf.Hook{c.uiHook()}
|
||||||
{
|
{
|
||||||
var moreDiags tfdiags.Diagnostics
|
var moreDiags tfdiags.Diagnostics
|
||||||
opReq.Variables, moreDiags = c.collectVariableValues()
|
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
|
// 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
|
// API to import more than one resource at once. For now, we only allow
|
||||||
// one while we stabilize this feature.
|
// one while we stabilize this feature.
|
||||||
newState, importDiags := lr.Core.Import(lr.Config, lr.InputState, &terraform.ImportOpts{
|
newState, importDiags := lr.Core.Import(lr.Config, lr.InputState, &opentf.ImportOpts{
|
||||||
Targets: []*terraform.ImportTarget{
|
Targets: []*opentf.ImportTarget{
|
||||||
{
|
{
|
||||||
Addr: addr,
|
Addr: addr,
|
||||||
|
|
||||||
@ -256,7 +256,7 @@ func (c *ImportCommand) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get schemas, if possible, before writing state
|
// Get schemas, if possible, before writing state
|
||||||
var schemas *terraform.Schemas
|
var schemas *opentf.Schemas
|
||||||
if isCloudMode(b) {
|
if isCloudMode(b) {
|
||||||
var schemaDiags tfdiags.Diagnostics
|
var schemaDiags tfdiags.Diagnostics
|
||||||
schemas, schemaDiags = c.MaybeGetSchemas(newState, nil)
|
schemas, schemaDiags = c.MaybeGetSchemas(newState, nil)
|
||||||
|
@ -29,7 +29,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/getproviders"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/getproviders"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/providercache"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/providercache"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
tfversion "github.com/placeholderplaceholderplaceholder/opentf/version"
|
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
|
// the configuration declare that they don't support this Terraform
|
||||||
// version, so we can produce a version-related error message rather than
|
// version, so we can produce a version-related error message rather than
|
||||||
// potentially-confusing downstream errors.
|
// potentially-confusing downstream errors.
|
||||||
versionDiags := terraform.CheckCoreVersionRequirements(config)
|
versionDiags := opentf.CheckCoreVersionRequirements(config)
|
||||||
if versionDiags.HasErrors() {
|
if versionDiags.HasErrors() {
|
||||||
c.showDiagnostics(versionDiags)
|
c.showDiagnostics(versionDiags)
|
||||||
return 1
|
return 1
|
||||||
|
@ -15,7 +15,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/getproviders"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/getproviders"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Config represents the complete configuration source
|
// Config represents the complete configuration source
|
||||||
@ -120,7 +120,7 @@ type provisioner struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Marshal returns the json encoding of terraform configuration.
|
// 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
|
var output config
|
||||||
|
|
||||||
pcs := make(map[string]providerConfig)
|
pcs := make(map[string]providerConfig)
|
||||||
@ -147,7 +147,7 @@ func Marshal(c *configs.Config, schemas *terraform.Schemas) ([]byte, error) {
|
|||||||
|
|
||||||
func marshalProviderConfigs(
|
func marshalProviderConfigs(
|
||||||
c *configs.Config,
|
c *configs.Config,
|
||||||
schemas *terraform.Schemas,
|
schemas *opentf.Schemas,
|
||||||
m map[string]providerConfig,
|
m map[string]providerConfig,
|
||||||
) {
|
) {
|
||||||
if c == nil {
|
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 module module
|
||||||
var rs []resource
|
var rs []resource
|
||||||
|
|
||||||
@ -373,7 +373,7 @@ func marshalModule(c *configs.Config, schemas *terraform.Schemas, addr string) (
|
|||||||
return module, nil
|
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)
|
ret := make(map[string]moduleCall)
|
||||||
|
|
||||||
for name, mc := range c.Module.ModuleCalls {
|
for name, mc := range c.Module.ModuleCalls {
|
||||||
@ -384,7 +384,7 @@ func marshalModuleCalls(c *configs.Config, schemas *terraform.Schemas) map[strin
|
|||||||
return ret
|
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.
|
// It is possible to have a module call with a nil config.
|
||||||
if c == nil {
|
if c == nil {
|
||||||
return moduleCall{}
|
return moduleCall{}
|
||||||
@ -441,7 +441,7 @@ func marshalModuleCall(c *configs.Config, mc *configs.ModuleCall, schemas *terra
|
|||||||
return ret
|
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
|
var rs []resource
|
||||||
for _, v := range resources {
|
for _, v := range resources {
|
||||||
providerConfigKey := opaqueProviderKey(v.ProviderConfigAddr().StringCompact(), moduleAddr)
|
providerConfigKey := opaqueProviderKey(v.ProviderConfigAddr().StringCompact(), moduleAddr)
|
||||||
|
@ -24,7 +24,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRenderHuman_EmptyPlan(t *testing.T) {
|
func TestRenderHuman_EmptyPlan(t *testing.T) {
|
||||||
@ -6986,7 +6986,7 @@ func runTestCases(t *testing.T, testCases map[string]testCase) {
|
|||||||
RequiredReplace: tc.RequiredReplace,
|
RequiredReplace: tc.RequiredReplace,
|
||||||
}
|
}
|
||||||
|
|
||||||
tfschemas := &terraform.Schemas{
|
tfschemas := &opentf.Schemas{
|
||||||
Providers: map[addrs.Provider]providers.ProviderSchema{
|
Providers: map[addrs.Provider]providers.ProviderSchema{
|
||||||
src.ProviderAddr.Provider: {
|
src.ProviderAddr.Provider: {
|
||||||
ResourceTypes: map[string]providers.Schema{
|
ResourceTypes: map[string]providers.Schema{
|
||||||
|
@ -21,7 +21,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestState(t *testing.T) {
|
func TestState(t *testing.T) {
|
||||||
@ -29,12 +29,12 @@ func TestState(t *testing.T) {
|
|||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
State *states.State
|
State *states.State
|
||||||
Schemas *terraform.Schemas
|
Schemas *opentf.Schemas
|
||||||
Want string
|
Want string
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
State: &states.State{},
|
State: &states.State{},
|
||||||
Schemas: &terraform.Schemas{},
|
Schemas: &opentf.Schemas{},
|
||||||
Want: "The state file is empty. No resources are represented.\n",
|
Want: "The state file is empty. No resources are represented.\n",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -98,8 +98,8 @@ func TestState(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func testProvider() *terraform.MockProvider {
|
func testProvider() *opentf.MockProvider {
|
||||||
p := new(terraform.MockProvider)
|
p := new(opentf.MockProvider)
|
||||||
p.ReadResourceFn = func(req providers.ReadResourceRequest) providers.ReadResourceResponse {
|
p.ReadResourceFn = func(req providers.ReadResourceRequest) providers.ReadResourceResponse {
|
||||||
return providers.ReadResourceResponse{NewState: req.PriorState}
|
return providers.ReadResourceResponse{NewState: req.PriorState}
|
||||||
}
|
}
|
||||||
@ -153,9 +153,9 @@ func testProviderSchema() *providers.GetProviderSchemaResponse {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSchemas() *terraform.Schemas {
|
func testSchemas() *opentf.Schemas {
|
||||||
provider := testProvider()
|
provider := testProvider()
|
||||||
return &terraform.Schemas{
|
return &opentf.Schemas{
|
||||||
Providers: map[addrs.Provider]providers.ProviderSchema{
|
Providers: map[addrs.Provider]providers.ProviderSchema{
|
||||||
addrs.NewDefaultProvider("test"): provider.GetProviderSchema(),
|
addrs.NewDefaultProvider("test"): provider.GetProviderSchema(),
|
||||||
},
|
},
|
||||||
|
@ -21,7 +21,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/version"
|
"github.com/placeholderplaceholderplaceholder/opentf/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -171,7 +171,7 @@ type Variable struct {
|
|||||||
// the part of the plan required by the jsonformat.Plan renderer.
|
// the part of the plan required by the jsonformat.Plan renderer.
|
||||||
func MarshalForRenderer(
|
func MarshalForRenderer(
|
||||||
p *plans.Plan,
|
p *plans.Plan,
|
||||||
schemas *terraform.Schemas,
|
schemas *opentf.Schemas,
|
||||||
) (map[string]Change, []ResourceChange, []ResourceChange, []ResourceAttr, error) {
|
) (map[string]Change, []ResourceChange, []ResourceChange, []ResourceAttr, error) {
|
||||||
output := newPlan()
|
output := newPlan()
|
||||||
|
|
||||||
@ -218,7 +218,7 @@ func MarshalForLog(
|
|||||||
config *configs.Config,
|
config *configs.Config,
|
||||||
p *plans.Plan,
|
p *plans.Plan,
|
||||||
sf *statefile.File,
|
sf *statefile.File,
|
||||||
schemas *terraform.Schemas,
|
schemas *opentf.Schemas,
|
||||||
) (*Plan, error) {
|
) (*Plan, error) {
|
||||||
output := newPlan()
|
output := newPlan()
|
||||||
output.TerraformVersion = version.String()
|
output.TerraformVersion = version.String()
|
||||||
@ -302,7 +302,7 @@ func Marshal(
|
|||||||
config *configs.Config,
|
config *configs.Config,
|
||||||
p *plans.Plan,
|
p *plans.Plan,
|
||||||
sf *statefile.File,
|
sf *statefile.File,
|
||||||
schemas *terraform.Schemas,
|
schemas *opentf.Schemas,
|
||||||
) ([]byte, error) {
|
) ([]byte, error) {
|
||||||
output, err := MarshalForLog(config, p, sf, schemas)
|
output, err := MarshalForLog(config, p, sf, schemas)
|
||||||
if err != nil {
|
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
|
// This function is referenced directly from the structured renderer tests, to
|
||||||
// ensure parity between the renderers. It probably shouldn't be used anywhere
|
// ensure parity between the renderers. It probably shouldn't be used anywhere
|
||||||
// else.
|
// 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 ret []ResourceChange
|
||||||
|
|
||||||
var sortedResources []*plans.ResourceInstanceChangeSrc
|
var sortedResources []*plans.ResourceInstanceChangeSrc
|
||||||
@ -654,7 +654,7 @@ func MarshalOutputChanges(changes *plans.Changes) (map[string]Change, error) {
|
|||||||
return outputChanges, nil
|
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
|
// marshal the planned changes into a module
|
||||||
plan, err := marshalPlannedValues(changes, schemas)
|
plan, err := marshalPlannedValues(changes, schemas)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -16,7 +16,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"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
|
// 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
|
var ret Module
|
||||||
|
|
||||||
// build two maps:
|
// build two maps:
|
||||||
@ -166,7 +166,7 @@ func marshalPlannedValues(changes *plans.Changes, schemas *terraform.Schemas) (M
|
|||||||
}
|
}
|
||||||
|
|
||||||
// marshalPlanResources
|
// 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
|
var ret []Resource
|
||||||
|
|
||||||
for _, ri := range ris {
|
for _, ri := range ris {
|
||||||
@ -248,7 +248,7 @@ func marshalPlanResources(changes *plans.Changes, ris []addrs.AbsResourceInstanc
|
|||||||
// the full module tree.
|
// the full module tree.
|
||||||
func marshalPlanModules(
|
func marshalPlanModules(
|
||||||
changes *plans.Changes,
|
changes *plans.Changes,
|
||||||
schemas *terraform.Schemas,
|
schemas *opentf.Schemas,
|
||||||
childModules []addrs.ModuleInstance,
|
childModules []addrs.ModuleInstance,
|
||||||
moduleMap map[string][]addrs.ModuleInstance,
|
moduleMap map[string][]addrs.ModuleInstance,
|
||||||
moduleResourceMap map[string][]addrs.AbsResourceInstance,
|
moduleResourceMap map[string][]addrs.AbsResourceInstance,
|
||||||
|
@ -14,7 +14,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMarshalAttributeValues(t *testing.T) {
|
func TestMarshalAttributeValues(t *testing.T) {
|
||||||
@ -344,8 +344,8 @@ func TestMarshalPlanValuesNoopDeposed(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSchemas() *terraform.Schemas {
|
func testSchemas() *opentf.Schemas {
|
||||||
return &terraform.Schemas{
|
return &opentf.Schemas{
|
||||||
Providers: map[addrs.Provider]providers.ProviderSchema{
|
Providers: map[addrs.Provider]providers.ProviderSchema{
|
||||||
addrs.NewDefaultProvider("test"): providers.ProviderSchema{
|
addrs.NewDefaultProvider("test"): providers.ProviderSchema{
|
||||||
ResourceTypes: map[string]providers.Schema{
|
ResourceTypes: map[string]providers.Schema{
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
"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
|
// 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.
|
// schema into the public structured JSON versions.
|
||||||
//
|
//
|
||||||
// This is a format that can be read by the structured plan renderer.
|
// 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))
|
schemas := make(map[string]*Provider, len(s.Providers))
|
||||||
for k, v := range s.Providers {
|
for k, v := range s.Providers {
|
||||||
schemas[k.String()] = marshalProvider(v)
|
schemas[k.String()] = marshalProvider(v)
|
||||||
@ -47,7 +47,7 @@ func MarshalForRenderer(s *terraform.Schemas) map[string]*Provider {
|
|||||||
return schemas
|
return schemas
|
||||||
}
|
}
|
||||||
|
|
||||||
func Marshal(s *terraform.Schemas) ([]byte, error) {
|
func Marshal(s *opentf.Schemas) ([]byte, error) {
|
||||||
providers := newProviders()
|
providers := newProviders()
|
||||||
providers.Schemas = MarshalForRenderer(s)
|
providers.Schemas = MarshalForRenderer(s)
|
||||||
ret, err := json.Marshal(providers)
|
ret, err := json.Marshal(providers)
|
||||||
|
@ -16,7 +16,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/lang/marks"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/lang/marks"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -143,7 +143,7 @@ func newState() *State {
|
|||||||
|
|
||||||
// MarshalForRenderer returns the pre-json encoding changes of the state, in a
|
// MarshalForRenderer returns the pre-json encoding changes of the state, in a
|
||||||
// format available to the structured renderer.
|
// 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 {
|
if sf.State.Modules == nil {
|
||||||
// Empty state case.
|
// Empty state case.
|
||||||
return Module{}, nil, nil
|
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
|
// MarshalForLog returns the origin JSON compatible state, read for a logging
|
||||||
// package to marshal further.
|
// 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()
|
output := newState()
|
||||||
|
|
||||||
if sf == nil || sf.State.Empty() {
|
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.
|
// 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)
|
output, err := MarshalForLog(sf, schemas)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -200,7 +200,7 @@ func Marshal(sf *statefile.File, schemas *terraform.Schemas) ([]byte, error) {
|
|||||||
return ret, err
|
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 sv StateValues
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
@ -248,7 +248,7 @@ func MarshalOutputs(outputs map[string]*states.OutputValue) (map[string]Output,
|
|||||||
return ret, nil
|
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 ret Module
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
@ -295,7 +295,7 @@ func marshalRootModule(s *states.State, schemas *terraform.Schemas) (Module, err
|
|||||||
// out of terraform state.
|
// out of terraform state.
|
||||||
func marshalModules(
|
func marshalModules(
|
||||||
s *states.State,
|
s *states.State,
|
||||||
schemas *terraform.Schemas,
|
schemas *opentf.Schemas,
|
||||||
modules []addrs.ModuleInstance,
|
modules []addrs.ModuleInstance,
|
||||||
moduleMap map[string][]addrs.ModuleInstance,
|
moduleMap map[string][]addrs.ModuleInstance,
|
||||||
) ([]Module, error) {
|
) ([]Module, error) {
|
||||||
@ -333,7 +333,7 @@ func marshalModules(
|
|||||||
return ret, nil
|
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 ret []Resource
|
||||||
|
|
||||||
var sortedResources []*states.Resource
|
var sortedResources []*states.Resource
|
||||||
|
@ -16,7 +16,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/lang/marks"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/lang/marks"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMarshalOutputs(t *testing.T) {
|
func TestMarshalOutputs(t *testing.T) {
|
||||||
@ -183,7 +183,7 @@ func TestMarshalResources(t *testing.T) {
|
|||||||
deposedKey := states.NewDeposedKey()
|
deposedKey := states.NewDeposedKey()
|
||||||
tests := map[string]struct {
|
tests := map[string]struct {
|
||||||
Resources map[string]*states.Resource
|
Resources map[string]*states.Resource
|
||||||
Schemas *terraform.Schemas
|
Schemas *opentf.Schemas
|
||||||
Want []Resource
|
Want []Resource
|
||||||
Err bool
|
Err bool
|
||||||
}{
|
}{
|
||||||
@ -806,8 +806,8 @@ func TestMarshalModules_parent_no_resources(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSchemas() *terraform.Schemas {
|
func testSchemas() *opentf.Schemas {
|
||||||
return &terraform.Schemas{
|
return &opentf.Schemas{
|
||||||
Providers: map[addrs.Provider]providers.ProviderSchema{
|
Providers: map[addrs.Provider]providers.ProviderSchema{
|
||||||
addrs.NewDefaultProvider("test"): {
|
addrs.NewDefaultProvider("test"): {
|
||||||
ResourceTypes: map[string]providers.Schema{
|
ResourceTypes: map[string]providers.Schema{
|
||||||
|
@ -27,7 +27,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/cliconfig"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/cliconfig"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/httpclient"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/httpclient"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/logging"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/logging"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
|
|
||||||
uuid "github.com/hashicorp/go-uuid"
|
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("\n---------------------------------------------------------------------------------\n")
|
||||||
c.Ui.Output("OpenTF must temporarily use your password to request an API token.\nThis password will NOT be saved locally.\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",
|
Id: "username",
|
||||||
Query: fmt.Sprintf("Username for %s:", hostname.ForDisplay()),
|
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))
|
diags = diags.Append(fmt.Errorf("Failed to request username: %s", err))
|
||||||
return nil, diags
|
return nil, diags
|
||||||
}
|
}
|
||||||
password, err := c.UIInput().Input(context.Background(), &terraform.InputOpts{
|
password, err := c.UIInput().Input(context.Background(), &opentf.InputOpts{
|
||||||
Id: "password",
|
Id: "password",
|
||||||
Query: fmt.Sprintf("Password for %s:", hostname.ForDisplay()),
|
Query: fmt.Sprintf("Password for %s:", hostname.ForDisplay()),
|
||||||
Secret: true,
|
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",
|
Id: "token",
|
||||||
Query: fmt.Sprintf("Token for %s:", hostname.ForDisplay()),
|
Query: fmt.Sprintf("Token for %s:", hostname.ForDisplay()),
|
||||||
Secret: true,
|
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",
|
Id: "approve",
|
||||||
Query: "Do you want to proceed?",
|
Query: "Do you want to proceed?",
|
||||||
Description: `Only 'yes' will be accepted to confirm.`,
|
Description: `Only 'yes' will be accepted to confirm.`,
|
||||||
|
@ -38,7 +38,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/provisioners"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/provisioners"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
"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
|
// InputMode returns the type of input we should ask for in the form of
|
||||||
// terraform.InputMode which is passed directly to Context.Input.
|
// opentf.InputMode which is passed directly to Context.Input.
|
||||||
func (m *Meta) InputMode() terraform.InputMode {
|
func (m *Meta) InputMode() opentf.InputMode {
|
||||||
if test || !m.input {
|
if test || !m.input {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -348,14 +348,14 @@ func (m *Meta) InputMode() terraform.InputMode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var mode terraform.InputMode
|
var mode opentf.InputMode
|
||||||
mode |= terraform.InputModeProvider
|
mode |= opentf.InputModeProvider
|
||||||
|
|
||||||
return mode
|
return mode
|
||||||
}
|
}
|
||||||
|
|
||||||
// UIInput returns a UIInput object to be used for asking for input.
|
// 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{
|
return &UIInput{
|
||||||
Colorize: m.Colorize(),
|
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
|
// contextOpts returns the options to use to initialize a Terraform
|
||||||
// context with the settings from this Meta.
|
// 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()
|
workspace, err := m.Workspace()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var opts terraform.ContextOpts
|
var opts opentf.ContextOpts
|
||||||
|
|
||||||
opts.UIInput = m.UIInput()
|
opts.UIInput = m.UIInput()
|
||||||
opts.Parallelism = m.parallelism
|
opts.Parallelism = m.parallelism
|
||||||
@ -542,7 +542,7 @@ func (m *Meta) contextOpts() (*terraform.ContextOpts, error) {
|
|||||||
opts.Provisioners = m.provisionerFactories()
|
opts.Provisioners = m.provisionerFactories()
|
||||||
}
|
}
|
||||||
|
|
||||||
opts.Meta = &terraform.ContextMeta{
|
opts.Meta = &opentf.ContextMeta{
|
||||||
Env: workspace,
|
Env: workspace,
|
||||||
OriginalWorkingDir: m.WorkingDir.OriginalWorkingDir(),
|
OriginalWorkingDir: m.WorkingDir.OriginalWorkingDir(),
|
||||||
}
|
}
|
||||||
@ -651,7 +651,7 @@ func (m *Meta) uiHook() *views.UiHook {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// confirm asks a yes/no confirmation.
|
// 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() {
|
if !m.Input() {
|
||||||
return false, errors.New("input is disabled")
|
return false, errors.New("input is disabled")
|
||||||
}
|
}
|
||||||
@ -833,7 +833,7 @@ func (m *Meta) checkRequiredVersion() tfdiags.Diagnostics {
|
|||||||
return diags
|
return diags
|
||||||
}
|
}
|
||||||
|
|
||||||
versionDiags := terraform.CheckCoreVersionRequirements(config)
|
versionDiags := opentf.CheckCoreVersionRequirements(config)
|
||||||
if versionDiags.HasErrors() {
|
if versionDiags.HasErrors() {
|
||||||
diags = diags.Append(versionDiags)
|
diags = diags.Append(versionDiags)
|
||||||
return diags
|
return diags
|
||||||
@ -847,7 +847,7 @@ func (m *Meta) checkRequiredVersion() tfdiags.Diagnostics {
|
|||||||
// it could potentially return nil without errors. It is the
|
// it could potentially return nil without errors. It is the
|
||||||
// responsibility of the caller to handle the lack of schema
|
// responsibility of the caller to handle the lack of schema
|
||||||
// information accordingly
|
// 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
|
var diags tfdiags.Diagnostics
|
||||||
|
|
||||||
path, err := os.Getwd()
|
path, err := os.Getwd()
|
||||||
@ -870,7 +870,7 @@ func (c *Meta) MaybeGetSchemas(state *states.State, config *configs.Config) (*te
|
|||||||
diags = diags.Append(err)
|
diags = diags.Append(err)
|
||||||
return nil, diags
|
return nil, diags
|
||||||
}
|
}
|
||||||
tfCtx, ctxDiags := terraform.NewContext(opts)
|
tfCtx, ctxDiags := opentf.NewContext(opts)
|
||||||
diags = diags.Append(ctxDiags)
|
diags = diags.Append(ctxDiags)
|
||||||
if ctxDiags.HasErrors() {
|
if ctxDiags.HasErrors() {
|
||||||
return nil, diags
|
return nil, diags
|
||||||
|
@ -30,7 +30,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
"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/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
|
|
||||||
backendInit "github.com/placeholderplaceholderplaceholder/opentf/internal/backend/init"
|
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
|
// 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
|
// aren't any matching workspaces. Which might be normal and fine, so
|
||||||
// let's just ask:
|
// 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",
|
Id: "create-workspace",
|
||||||
Query: "\n[reset][bold][yellow]No workspaces found.[reset]",
|
Query: "\n[reset][bold][yellow]No workspaces found.[reset]",
|
||||||
Description: fmt.Sprintf(inputCloudInitCreateWorkspace, strings.Join(c.WorkspaceMapping.Tags, ", ")),
|
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.
|
// 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",
|
Id: "select-workspace",
|
||||||
Query: fmt.Sprintf(
|
Query: fmt.Sprintf(
|
||||||
"\n[reset][bold][yellow]The currently selected workspace (%s) does not exist.[reset]",
|
"\n[reset][bold][yellow]The currently selected workspace (%s) does not exist.[reset]",
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
)
|
)
|
||||||
|
|
||||||
type backendMigrateOpts struct {
|
type backendMigrateOpts struct {
|
||||||
@ -168,7 +168,7 @@ func (m *Meta) backendMigrateState_S_S(opts *backendMigrateOpts) error {
|
|||||||
if !migrate {
|
if !migrate {
|
||||||
var err error
|
var err error
|
||||||
// Ask the user if they want to migrate their existing remote state
|
// 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",
|
Id: "backend-migrate-multistate-to-multistate",
|
||||||
Query: fmt.Sprintf(
|
Query: fmt.Sprintf(
|
||||||
"Do you want to migrate all workspaces to %q?",
|
"Do you want to migrate all workspaces to %q?",
|
||||||
@ -228,7 +228,7 @@ func (m *Meta) backendMigrateState_S_s(opts *backendMigrateOpts) error {
|
|||||||
if !migrate {
|
if !migrate {
|
||||||
var err error
|
var err error
|
||||||
// Ask the user if they want to migrate their existing remote state
|
// 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",
|
Id: "backend-migrate-multistate-to-single",
|
||||||
Query: fmt.Sprintf(
|
Query: fmt.Sprintf(
|
||||||
"Destination state %q doesn't support workspaces.\n"+
|
"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) {
|
func (m *Meta) backendMigrateEmptyConfirm(source, destination statemgr.Full, opts *backendMigrateOpts) (bool, error) {
|
||||||
var inputOpts *terraform.InputOpts
|
var inputOpts *opentf.InputOpts
|
||||||
if opts.DestinationType == "cloud" {
|
if opts.DestinationType == "cloud" {
|
||||||
inputOpts = &terraform.InputOpts{
|
inputOpts = &opentf.InputOpts{
|
||||||
Id: "backend-migrate-copy-to-empty-cloud",
|
Id: "backend-migrate-copy-to-empty-cloud",
|
||||||
Query: "Do you want to copy existing state to Terraform Cloud?",
|
Query: "Do you want to copy existing state to Terraform Cloud?",
|
||||||
Description: fmt.Sprintf(strings.TrimSpace(inputBackendMigrateEmptyCloud), opts.SourceType),
|
Description: fmt.Sprintf(strings.TrimSpace(inputBackendMigrateEmptyCloud), opts.SourceType),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
inputOpts = &terraform.InputOpts{
|
inputOpts = &opentf.InputOpts{
|
||||||
Id: "backend-migrate-copy-to-empty",
|
Id: "backend-migrate-copy-to-empty",
|
||||||
Query: "Do you want to copy existing state to the new backend?",
|
Query: "Do you want to copy existing state to the new backend?",
|
||||||
Description: fmt.Sprintf(
|
Description: fmt.Sprintf(
|
||||||
@ -511,9 +511,9 @@ func (m *Meta) backendMigrateNonEmptyConfirm(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ask for confirmation
|
// Ask for confirmation
|
||||||
var inputOpts *terraform.InputOpts
|
var inputOpts *opentf.InputOpts
|
||||||
if opts.DestinationType == "cloud" {
|
if opts.DestinationType == "cloud" {
|
||||||
inputOpts = &terraform.InputOpts{
|
inputOpts = &opentf.InputOpts{
|
||||||
Id: "backend-migrate-to-tfc",
|
Id: "backend-migrate-to-tfc",
|
||||||
Query: "Do you want to copy existing state to Terraform Cloud?",
|
Query: "Do you want to copy existing state to Terraform Cloud?",
|
||||||
Description: fmt.Sprintf(
|
Description: fmt.Sprintf(
|
||||||
@ -521,7 +521,7 @@ func (m *Meta) backendMigrateNonEmptyConfirm(
|
|||||||
opts.SourceType, sourcePath, destinationPath),
|
opts.SourceType, sourcePath, destinationPath),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
inputOpts = &terraform.InputOpts{
|
inputOpts = &opentf.InputOpts{
|
||||||
Id: "backend-migrate-to-backend",
|
Id: "backend-migrate-to-backend",
|
||||||
Query: "Do you want to copy existing state to the new backend?",
|
Query: "Do you want to copy existing state to the new backend?",
|
||||||
Description: fmt.Sprintf(
|
Description: fmt.Sprintf(
|
||||||
@ -808,7 +808,7 @@ func (m *Meta) promptSingleToCloudSingleStateMigration(opts *backendMigrateOpts)
|
|||||||
migrate := opts.force
|
migrate := opts.force
|
||||||
if !migrate {
|
if !migrate {
|
||||||
var err error
|
var err error
|
||||||
migrate, err = m.confirm(&terraform.InputOpts{
|
migrate, err = m.confirm(&opentf.InputOpts{
|
||||||
Id: "backend-migrate-state-single-to-cloud-single",
|
Id: "backend-migrate-state-single-to-cloud-single",
|
||||||
Query: "Do you wish to proceed?",
|
Query: "Do you wish to proceed?",
|
||||||
Description: strings.TrimSpace(tfcInputBackendMigrateStateSingleToCloudSingle),
|
Description: strings.TrimSpace(tfcInputBackendMigrateStateSingleToCloudSingle),
|
||||||
@ -829,7 +829,7 @@ func (m *Meta) promptRemotePrefixToCloudTagsMigration(opts *backendMigrateOpts)
|
|||||||
migrate := opts.force
|
migrate := opts.force
|
||||||
if !migrate {
|
if !migrate {
|
||||||
var err error
|
var err error
|
||||||
migrate, err = m.confirm(&terraform.InputOpts{
|
migrate, err = m.confirm(&opentf.InputOpts{
|
||||||
Id: "backend-migrate-remote-multistate-to-cloud",
|
Id: "backend-migrate-remote-multistate-to-cloud",
|
||||||
Query: "Do you wish to proceed?",
|
Query: "Do you wish to proceed?",
|
||||||
Description: strings.TrimSpace(tfcInputBackendMigrateRemoteMultiToCloud),
|
Description: strings.TrimSpace(tfcInputBackendMigrateRemoteMultiToCloud),
|
||||||
@ -856,7 +856,7 @@ func (m *Meta) promptMultiToSingleCloudMigration(opts *backendMigrateOpts) error
|
|||||||
if !migrate {
|
if !migrate {
|
||||||
var err error
|
var err error
|
||||||
// Ask the user if they want to migrate their existing remote state
|
// 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",
|
Id: "backend-migrate-multistate-to-single",
|
||||||
Query: "Do you want to copy only your current workspace?",
|
Query: "Do you want to copy only your current workspace?",
|
||||||
Description: fmt.Sprintf(
|
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]`
|
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",
|
Id: "new-state-name",
|
||||||
Query: message,
|
Query: message,
|
||||||
Description: strings.TrimSpace(inputBackendNewWorkspaceName),
|
Description: strings.TrimSpace(inputBackendNewWorkspaceName),
|
||||||
@ -900,7 +900,7 @@ func (m *Meta) promptNewWorkspaceName(destinationType string) (string, error) {
|
|||||||
func (m *Meta) promptMultiStateMigrationPattern(sourceType 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
|
// 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.
|
// 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",
|
Id: "backend-migrate-multistate-to-tfc",
|
||||||
Query: fmt.Sprintf("[reset][bold][yellow]%s[reset]", "Would you like to rename your workspaces?"),
|
Query: fmt.Sprintf("[reset][bold][yellow]%s[reset]", "Would you like to rename your workspaces?"),
|
||||||
Description: fmt.Sprintf(strings.TrimSpace(tfcInputBackendMigrateMultiToMulti), sourceType),
|
Description: fmt.Sprintf(strings.TrimSpace(tfcInputBackendMigrateMultiToMulti), sourceType),
|
||||||
@ -918,7 +918,7 @@ func (m *Meta) promptMultiStateMigrationPattern(sourceType string) (string, erro
|
|||||||
return "*", nil
|
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",
|
Id: "backend-migrate-multistate-to-tfc-pattern",
|
||||||
Query: fmt.Sprintf("[reset][bold][yellow]%s[reset]", "How would you like to rename your workspaces?"),
|
Query: fmt.Sprintf("[reset][bold][yellow]%s[reset]", "How would you like to rename your workspaces?"),
|
||||||
Description: strings.TrimSpace(tfcInputBackendMigrateMultiToMultiPattern),
|
Description: strings.TrimSpace(tfcInputBackendMigrateMultiToMultiPattern),
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/initwd"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/initwd"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/registry"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/registry"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
"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]
|
attrS := schema.Attributes[name]
|
||||||
|
|
||||||
for {
|
for {
|
||||||
strVal, err := input.Input(context.Background(), &terraform.InputOpts{
|
strVal, err := input.Input(context.Background(), &opentf.InputOpts{
|
||||||
Id: name,
|
Id: name,
|
||||||
Query: name,
|
Query: name,
|
||||||
Description: attrS.Description,
|
Description: attrS.Description,
|
||||||
|
@ -17,7 +17,7 @@ import (
|
|||||||
"github.com/mitchellh/cli"
|
"github.com/mitchellh/cli"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend/local"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend/local"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMetaColorize(t *testing.T) {
|
func TestMetaColorize(t *testing.T) {
|
||||||
@ -90,7 +90,7 @@ func TestMetaInputMode(t *testing.T) {
|
|||||||
t.Fatalf("err: %s", err)
|
t.Fatalf("err: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if m.InputMode() != terraform.InputModeStd {
|
if m.InputMode() != opentf.InputModeStd {
|
||||||
t.Fatalf("bad: %#v", m.InputMode())
|
t.Fatalf("bad: %#v", m.InputMode())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -109,11 +109,11 @@ func TestMetaInputMode_envVar(t *testing.T) {
|
|||||||
t.Fatalf("err: %s", err)
|
t.Fatalf("err: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
off := terraform.InputMode(0)
|
off := opentf.InputMode(0)
|
||||||
on := terraform.InputModeStd
|
on := opentf.InputModeStd
|
||||||
cases := []struct {
|
cases := []struct {
|
||||||
EnvVar string
|
EnvVar string
|
||||||
Expected terraform.InputMode
|
Expected opentf.InputMode
|
||||||
}{
|
}{
|
||||||
{"false", off},
|
{"false", off},
|
||||||
{"0", off},
|
{"0", off},
|
||||||
|
@ -15,7 +15,7 @@ import (
|
|||||||
|
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs"
|
"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/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ func (m *Meta) collectVariableValues() (map[string]backend.UnparsedVariableValue
|
|||||||
ret[name] = unparsedVariableValueString{
|
ret[name] = unparsedVariableValueString{
|
||||||
str: rawVal,
|
str: rawVal,
|
||||||
name: name,
|
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
|
// (DefaultVarsFilename) along with the later-added search for all files
|
||||||
// ending in .auto.tfvars.
|
// ending in .auto.tfvars.
|
||||||
if _, err := os.Stat(DefaultVarsFilename); err == nil {
|
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)
|
diags = diags.Append(moreDiags)
|
||||||
}
|
}
|
||||||
const defaultVarsFilenameJSON = DefaultVarsFilename + ".json"
|
const defaultVarsFilenameJSON = DefaultVarsFilename + ".json"
|
||||||
if _, err := os.Stat(defaultVarsFilenameJSON); err == nil {
|
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)
|
diags = diags.Append(moreDiags)
|
||||||
}
|
}
|
||||||
if infos, err := ioutil.ReadDir("."); err == nil {
|
if infos, err := ioutil.ReadDir("."); err == nil {
|
||||||
@ -81,7 +81,7 @@ func (m *Meta) collectVariableValues() (map[string]backend.UnparsedVariableValue
|
|||||||
if !isAutoVarFile(name) {
|
if !isAutoVarFile(name) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
moreDiags := m.addVarsFromFile(name, terraform.ValueFromAutoFile, ret)
|
moreDiags := m.addVarsFromFile(name, opentf.ValueFromAutoFile, ret)
|
||||||
diags = diags.Append(moreDiags)
|
diags = diags.Append(moreDiags)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -117,11 +117,11 @@ func (m *Meta) collectVariableValues() (map[string]backend.UnparsedVariableValue
|
|||||||
ret[name] = unparsedVariableValueString{
|
ret[name] = unparsedVariableValueString{
|
||||||
str: rawVal,
|
str: rawVal,
|
||||||
name: name,
|
name: name,
|
||||||
sourceType: terraform.ValueFromCLIArg,
|
sourceType: opentf.ValueFromCLIArg,
|
||||||
}
|
}
|
||||||
|
|
||||||
case "-var-file":
|
case "-var-file":
|
||||||
moreDiags := m.addVarsFromFile(rawFlag.Value, terraform.ValueFromNamedFile, ret)
|
moreDiags := m.addVarsFromFile(rawFlag.Value, opentf.ValueFromNamedFile, ret)
|
||||||
diags = diags.Append(moreDiags)
|
diags = diags.Append(moreDiags)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -134,7 +134,7 @@ func (m *Meta) collectVariableValues() (map[string]backend.UnparsedVariableValue
|
|||||||
return ret, diags
|
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
|
var diags tfdiags.Diagnostics
|
||||||
|
|
||||||
src, err := ioutil.ReadFile(filename)
|
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.
|
// intended to deal with expressions inside "tfvars" files.
|
||||||
type unparsedVariableValueExpression struct {
|
type unparsedVariableValueExpression struct {
|
||||||
expr hcl.Expression
|
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
|
var diags tfdiags.Diagnostics
|
||||||
val, hclDiags := v.expr.Value(nil) // nil because no function calls or variable references are allowed here
|
val, hclDiags := v.expr.Value(nil) // nil because no function calls or variable references are allowed here
|
||||||
diags = diags.Append(hclDiags)
|
diags = diags.Append(hclDiags)
|
||||||
|
|
||||||
rng := tfdiags.SourceRangeFromHCL(v.expr.Range())
|
rng := tfdiags.SourceRangeFromHCL(v.expr.Range())
|
||||||
|
|
||||||
return &terraform.InputValue{
|
return &opentf.InputValue{
|
||||||
Value: val,
|
Value: val,
|
||||||
SourceType: v.sourceType,
|
SourceType: v.sourceType,
|
||||||
SourceRange: rng,
|
SourceRange: rng,
|
||||||
@ -253,16 +253,16 @@ func (v unparsedVariableValueExpression) ParseVariableValue(mode configs.Variabl
|
|||||||
type unparsedVariableValueString struct {
|
type unparsedVariableValueString struct {
|
||||||
str string
|
str string
|
||||||
name 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
|
var diags tfdiags.Diagnostics
|
||||||
|
|
||||||
val, hclDiags := mode.Parse(v.name, v.str)
|
val, hclDiags := mode.Parse(v.name, v.str)
|
||||||
diags = diags.Append(hclDiags)
|
diags = diags.Append(hclDiags)
|
||||||
|
|
||||||
return &terraform.InputValue{
|
return &opentf.InputValue{
|
||||||
Value: val,
|
Value: val,
|
||||||
SourceType: v.sourceType,
|
SourceType: v.sourceType,
|
||||||
}, diags
|
}, diags
|
||||||
|
@ -26,7 +26,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1436,7 +1436,7 @@ func TestPlan_parallelism(t *testing.T) {
|
|||||||
providerFactories := map[addrs.Provider]providers.Factory{}
|
providerFactories := map[addrs.Provider]providers.Factory{}
|
||||||
for i := 0; i < 10; i++ {
|
for i := 0; i < 10; i++ {
|
||||||
name := fmt.Sprintf("test%d", i)
|
name := fmt.Sprintf("test%d", i)
|
||||||
provider := &terraform.MockProvider{}
|
provider := &opentf.MockProvider{}
|
||||||
provider.GetProviderSchemaResponse = &providers.GetProviderSchemaResponse{
|
provider.GetProviderSchemaResponse = &providers.GetProviderSchemaResponse{
|
||||||
ResourceTypes: map[string]providers.Schema{
|
ResourceTypes: map[string]providers.Schema{
|
||||||
name + "_instance": {Block: &configschema.Block{}},
|
name + "_instance": {Block: &configschema.Block{}},
|
||||||
@ -1632,7 +1632,7 @@ func planFixtureSchema() *providers.GetProviderSchemaResponse {
|
|||||||
// operation with the configuration in testdata/plan. This mock has
|
// operation with the configuration in testdata/plan. This mock has
|
||||||
// GetSchemaResponse and PlanResourceChangeFn populated, with the plan
|
// GetSchemaResponse and PlanResourceChangeFn populated, with the plan
|
||||||
// step just passing through the new object proposed by Terraform Core.
|
// step just passing through the new object proposed by Terraform Core.
|
||||||
func planFixtureProvider() *terraform.MockProvider {
|
func planFixtureProvider() *opentf.MockProvider {
|
||||||
p := testProvider()
|
p := testProvider()
|
||||||
p.GetProviderSchemaResponse = planFixtureSchema()
|
p.GetProviderSchemaResponse = planFixtureSchema()
|
||||||
p.PlanResourceChangeFn = func(req providers.PlanResourceChangeRequest) providers.PlanResourceChangeResponse {
|
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
|
// operation with the configuration in testdata/plan-vars. This mock has
|
||||||
// GetSchemaResponse and PlanResourceChangeFn populated, with the plan
|
// GetSchemaResponse and PlanResourceChangeFn populated, with the plan
|
||||||
// step just passing through the new object proposed by Terraform Core.
|
// step just passing through the new object proposed by Terraform Core.
|
||||||
func planVarsFixtureProvider() *terraform.MockProvider {
|
func planVarsFixtureProvider() *opentf.MockProvider {
|
||||||
p := testProvider()
|
p := testProvider()
|
||||||
p.GetProviderSchemaResponse = planVarsFixtureSchema()
|
p.GetProviderSchemaResponse = planVarsFixtureSchema()
|
||||||
p.PlanResourceChangeFn = func(req providers.PlanResourceChangeRequest) providers.PlanResourceChangeResponse {
|
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
|
// planFixtureProvider returns a mock provider that is configured for basic
|
||||||
// operation with the configuration in testdata/plan. This mock has
|
// operation with the configuration in testdata/plan. This mock has
|
||||||
// GetSchemaResponse and PlanResourceChangeFn populated, returning 3 warnings.
|
// GetSchemaResponse and PlanResourceChangeFn populated, returning 3 warnings.
|
||||||
func planWarningsFixtureProvider() *terraform.MockProvider {
|
func planWarningsFixtureProvider() *opentf.MockProvider {
|
||||||
p := testProvider()
|
p := testProvider()
|
||||||
p.GetProviderSchemaResponse = planFixtureSchema()
|
p.GetProviderSchemaResponse = planFixtureSchema()
|
||||||
p.PlanResourceChangeFn = func(req providers.PlanResourceChangeRequest) providers.PlanResourceChangeResponse {
|
p.PlanResourceChangeFn = func(req providers.PlanResourceChangeRequest) providers.PlanResourceChangeResponse {
|
||||||
|
@ -15,7 +15,7 @@ import (
|
|||||||
"github.com/mitchellh/cli"
|
"github.com/mitchellh/cli"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
"github.com/zclconf/go-cty/cty"
|
"github.com/zclconf/go-cty/cty"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ type providerSchema struct {
|
|||||||
|
|
||||||
// testProvider returns a mock provider that is configured for basic
|
// testProvider returns a mock provider that is configured for basic
|
||||||
// operation with the configuration in testdata/providers-schema.
|
// operation with the configuration in testdata/providers-schema.
|
||||||
func providersSchemaFixtureProvider() *terraform.MockProvider {
|
func providersSchemaFixtureProvider() *opentf.MockProvider {
|
||||||
p := testProvider()
|
p := testProvider()
|
||||||
p.GetProviderSchemaResponse = providersSchemaFixtureSchema()
|
p.GetProviderSchemaResponse = providersSchemaFixtureSchema()
|
||||||
return p
|
return p
|
||||||
|
@ -20,7 +20,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans/planfile"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans/planfile"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
"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/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -107,13 +107,13 @@ func (c *ShowCommand) Synopsis() string {
|
|||||||
return "Show the current state or a saved plan"
|
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 diags, showDiags tfdiags.Diagnostics
|
||||||
var plan *plans.Plan
|
var plan *plans.Plan
|
||||||
var jsonPlan *cloudplan.RemotePlanJSON
|
var jsonPlan *cloudplan.RemotePlanJSON
|
||||||
var stateFile *statefile.File
|
var stateFile *statefile.File
|
||||||
var config *configs.Config
|
var config *configs.Config
|
||||||
var schemas *terraform.Schemas
|
var schemas *opentf.Schemas
|
||||||
|
|
||||||
// No plan file or state file argument provided,
|
// No plan file or state file argument provided,
|
||||||
// so get the latest state snapshot
|
// so get the latest state snapshot
|
||||||
|
@ -21,7 +21,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/version"
|
"github.com/placeholderplaceholderplaceholder/opentf/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1054,7 +1054,7 @@ func showFixtureSensitiveSchema() *providers.GetProviderSchemaResponse {
|
|||||||
// GetSchemaResponse, PlanResourceChangeFn, and ApplyResourceChangeFn populated,
|
// GetSchemaResponse, PlanResourceChangeFn, and ApplyResourceChangeFn populated,
|
||||||
// with the plan/apply steps just passing through the data determined by
|
// with the plan/apply steps just passing through the data determined by
|
||||||
// Terraform Core.
|
// Terraform Core.
|
||||||
func showFixtureProvider() *terraform.MockProvider {
|
func showFixtureProvider() *opentf.MockProvider {
|
||||||
p := testProvider()
|
p := testProvider()
|
||||||
p.GetProviderSchemaResponse = showFixtureSchema()
|
p.GetProviderSchemaResponse = showFixtureSchema()
|
||||||
p.ReadResourceFn = func(req providers.ReadResourceRequest) providers.ReadResourceResponse {
|
p.ReadResourceFn = func(req providers.ReadResourceRequest) providers.ReadResourceResponse {
|
||||||
@ -1117,7 +1117,7 @@ func showFixtureProvider() *terraform.MockProvider {
|
|||||||
// GetSchemaResponse, PlanResourceChangeFn, and ApplyResourceChangeFn populated,
|
// GetSchemaResponse, PlanResourceChangeFn, and ApplyResourceChangeFn populated,
|
||||||
// with the plan/apply steps just passing through the data determined by
|
// with the plan/apply steps just passing through the data determined by
|
||||||
// Terraform Core. It also has a sensitive attribute in the provider schema.
|
// Terraform Core. It also has a sensitive attribute in the provider schema.
|
||||||
func showFixtureSensitiveProvider() *terraform.MockProvider {
|
func showFixtureSensitiveProvider() *opentf.MockProvider {
|
||||||
p := testProvider()
|
p := testProvider()
|
||||||
p.GetProviderSchemaResponse = showFixtureSensitiveSchema()
|
p.GetProviderSchemaResponse = showFixtureSensitiveSchema()
|
||||||
p.PlanResourceChangeFn = func(req providers.PlanResourceChangeRequest) providers.PlanResourceChangeResponse {
|
p.PlanResourceChangeFn = func(req providers.PlanResourceChangeRequest) providers.PlanResourceChangeResponse {
|
||||||
|
@ -15,7 +15,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/clistate"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/clistate"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -398,7 +398,7 @@ func (c *StateMvCommand) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get schemas, if possible, before writing state
|
// Get schemas, if possible, before writing state
|
||||||
var schemas *terraform.Schemas
|
var schemas *opentf.Schemas
|
||||||
if isCloudMode(b) {
|
if isCloudMode(b) {
|
||||||
var schemaDiags tfdiags.Diagnostics
|
var schemaDiags tfdiags.Diagnostics
|
||||||
schemas, schemaDiags = c.MaybeGetSchemas(stateTo, nil)
|
schemas, schemaDiags = c.MaybeGetSchemas(stateTo, nil)
|
||||||
|
@ -16,7 +16,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statemgr"
|
"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/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ func (c *StatePushCommand) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get schemas, if possible, before writing state
|
// Get schemas, if possible, before writing state
|
||||||
var schemas *terraform.Schemas
|
var schemas *opentf.Schemas
|
||||||
var diags tfdiags.Diagnostics
|
var diags tfdiags.Diagnostics
|
||||||
if isCloudMode(b) {
|
if isCloudMode(b) {
|
||||||
schemas, diags = c.MaybeGetSchemas(srcStateFile.State, nil)
|
schemas, diags = c.MaybeGetSchemas(srcStateFile.State, nil)
|
||||||
|
@ -14,7 +14,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/clistate"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/clistate"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ func (c *StateReplaceProviderCommand) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get schemas, if possible, before writing state
|
// Get schemas, if possible, before writing state
|
||||||
var schemas *terraform.Schemas
|
var schemas *opentf.Schemas
|
||||||
if isCloudMode(b) {
|
if isCloudMode(b) {
|
||||||
var schemaDiags tfdiags.Diagnostics
|
var schemaDiags tfdiags.Diagnostics
|
||||||
schemas, schemaDiags = c.MaybeGetSchemas(state, nil)
|
schemas, schemaDiags = c.MaybeGetSchemas(state, nil)
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/arguments"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/arguments"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/clistate"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/clistate"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views"
|
"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"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ func (c *StateRmCommand) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get schemas, if possible, before writing state
|
// Get schemas, if possible, before writing state
|
||||||
var schemas *terraform.Schemas
|
var schemas *opentf.Schemas
|
||||||
if isCloudMode(b) {
|
if isCloudMode(b) {
|
||||||
var schemaDiags tfdiags.Diagnostics
|
var schemaDiags tfdiags.Diagnostics
|
||||||
schemas, schemaDiags = c.MaybeGetSchemas(state, nil)
|
schemas, schemaDiags = c.MaybeGetSchemas(state, nil)
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/clistate"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/clistate"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ func (c *TaintCommand) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get schemas, if possible, before writing state
|
// Get schemas, if possible, before writing state
|
||||||
var schemas *terraform.Schemas
|
var schemas *opentf.Schemas
|
||||||
if isCloudMode(b) {
|
if isCloudMode(b) {
|
||||||
var schemaDiags tfdiags.Diagnostics
|
var schemaDiags tfdiags.Diagnostics
|
||||||
schemas, schemaDiags = c.MaybeGetSchemas(state, nil)
|
schemas, schemaDiags = c.MaybeGetSchemas(state, nil)
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/moduletest"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/moduletest"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -308,7 +308,7 @@ type TestSuiteRunner struct {
|
|||||||
Config *configs.Config
|
Config *configs.Config
|
||||||
|
|
||||||
GlobalVariables map[string]backend.UnparsedVariableValue
|
GlobalVariables map[string]backend.UnparsedVariableValue
|
||||||
Opts *terraform.ContextOpts
|
Opts *opentf.ContextOpts
|
||||||
|
|
||||||
View views.Test
|
View views.Test
|
||||||
|
|
||||||
@ -615,7 +615,7 @@ func (runner *TestFileRunner) validate(config *configs.Config, run *moduletest.R
|
|||||||
|
|
||||||
var diags tfdiags.Diagnostics
|
var diags tfdiags.Diagnostics
|
||||||
|
|
||||||
tfCtx, ctxDiags := terraform.NewContext(runner.Suite.Opts)
|
tfCtx, ctxDiags := opentf.NewContext(runner.Suite.Opts)
|
||||||
diags = diags.Append(ctxDiags)
|
diags = diags.Append(ctxDiags)
|
||||||
if ctxDiags.HasErrors() {
|
if ctxDiags.HasErrors() {
|
||||||
return diags
|
return diags
|
||||||
@ -662,12 +662,12 @@ func (runner *TestFileRunner) destroy(config *configs.Config, state *states.Stat
|
|||||||
return state, diags
|
return state, diags
|
||||||
}
|
}
|
||||||
|
|
||||||
planOpts := &terraform.PlanOpts{
|
planOpts := &opentf.PlanOpts{
|
||||||
Mode: plans.DestroyMode,
|
Mode: plans.DestroyMode,
|
||||||
SetVariables: variables,
|
SetVariables: variables,
|
||||||
}
|
}
|
||||||
|
|
||||||
tfCtx, ctxDiags := terraform.NewContext(runner.Suite.Opts)
|
tfCtx, ctxDiags := opentf.NewContext(runner.Suite.Opts)
|
||||||
diags = diags.Append(ctxDiags)
|
diags = diags.Append(ctxDiags)
|
||||||
if ctxDiags.HasErrors() {
|
if ctxDiags.HasErrors() {
|
||||||
return state, diags
|
return state, diags
|
||||||
@ -703,7 +703,7 @@ func (runner *TestFileRunner) destroy(config *configs.Config, state *states.Stat
|
|||||||
return updated, diags
|
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)
|
log.Printf("[TRACE] TestFileRunner: called plan for %s/%s", file.Name, run.Name)
|
||||||
|
|
||||||
var diags tfdiags.Diagnostics
|
var diags tfdiags.Diagnostics
|
||||||
@ -724,7 +724,7 @@ func (runner *TestFileRunner) plan(config *configs.Config, state *states.State,
|
|||||||
return nil, nil, diags
|
return nil, nil, diags
|
||||||
}
|
}
|
||||||
|
|
||||||
planOpts := &terraform.PlanOpts{
|
planOpts := &opentf.PlanOpts{
|
||||||
Mode: func() plans.Mode {
|
Mode: func() plans.Mode {
|
||||||
switch run.Config.Options.Mode {
|
switch run.Config.Options.Mode {
|
||||||
case configs.RefreshOnlyTestMode:
|
case configs.RefreshOnlyTestMode:
|
||||||
@ -740,7 +740,7 @@ func (runner *TestFileRunner) plan(config *configs.Config, state *states.State,
|
|||||||
ExternalReferences: references,
|
ExternalReferences: references,
|
||||||
}
|
}
|
||||||
|
|
||||||
tfCtx, ctxDiags := terraform.NewContext(runner.Suite.Opts)
|
tfCtx, ctxDiags := opentf.NewContext(runner.Suite.Opts)
|
||||||
diags = diags.Append(ctxDiags)
|
diags = diags.Append(ctxDiags)
|
||||||
if ctxDiags.HasErrors() {
|
if ctxDiags.HasErrors() {
|
||||||
return nil, nil, diags
|
return nil, nil, diags
|
||||||
@ -770,7 +770,7 @@ func (runner *TestFileRunner) plan(config *configs.Config, state *states.State,
|
|||||||
return tfCtx, plan, diags
|
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)
|
log.Printf("[TRACE] TestFileRunner: called apply for %s/%s", file.Name, run.Name)
|
||||||
|
|
||||||
var diags tfdiags.Diagnostics
|
var diags tfdiags.Diagnostics
|
||||||
@ -794,7 +794,7 @@ func (runner *TestFileRunner) apply(plan *plans.Plan, state *states.State, confi
|
|||||||
created = append(created, change)
|
created = append(created, change)
|
||||||
}
|
}
|
||||||
|
|
||||||
tfCtx, ctxDiags := terraform.NewContext(runner.Suite.Opts)
|
tfCtx, ctxDiags := opentf.NewContext(runner.Suite.Opts)
|
||||||
diags = diags.Append(ctxDiags)
|
diags = diags.Append(ctxDiags)
|
||||||
if ctxDiags.HasErrors() {
|
if ctxDiags.HasErrors() {
|
||||||
return nil, state, diags
|
return nil, state, diags
|
||||||
@ -824,7 +824,7 @@ func (runner *TestFileRunner) apply(plan *plans.Plan, state *states.State, confi
|
|||||||
return tfCtx, updated, diags
|
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
|
var identifier string
|
||||||
if file == nil {
|
if file == nil {
|
||||||
identifier = "validate"
|
identifier = "validate"
|
||||||
@ -997,13 +997,13 @@ func (runner *TestFileRunner) Cleanup(file *moduletest.File) {
|
|||||||
|
|
||||||
// helper functions
|
// 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.
|
// variable values that are relevant to the config being tested.
|
||||||
//
|
//
|
||||||
// Crucially, it differs from prepareInputVariablesForAssertions in that it only
|
// Crucially, it differs from prepareInputVariablesForAssertions in that it only
|
||||||
// includes variables that are reference by the config and not everything that
|
// includes variables that are reference by the config and not everything that
|
||||||
// is defined within the test run block and test file.
|
// 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)
|
variables := make(map[string]backend.UnparsedVariableValue)
|
||||||
for name := range config.Module.Variables {
|
for name := range config.Module.Variables {
|
||||||
if run != nil {
|
if run != nil {
|
||||||
@ -1011,7 +1011,7 @@ func buildInputVariablesForTest(run *moduletest.Run, file *moduletest.File, conf
|
|||||||
// Local variables take precedence.
|
// Local variables take precedence.
|
||||||
variables[name] = unparsedVariableValueExpression{
|
variables[name] = unparsedVariableValueExpression{
|
||||||
expr: expr,
|
expr: expr,
|
||||||
sourceType: terraform.ValueFromConfig,
|
sourceType: opentf.ValueFromConfig,
|
||||||
}
|
}
|
||||||
continue
|
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.
|
// If it's not set locally, it maybe set for the entire file.
|
||||||
variables[name] = unparsedVariableValueExpression{
|
variables[name] = unparsedVariableValueExpression{
|
||||||
expr: expr,
|
expr: expr,
|
||||||
sourceType: terraform.ValueFromConfig,
|
sourceType: opentf.ValueFromConfig,
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -1043,7 +1043,7 @@ func buildInputVariablesForTest(run *moduletest.Run, file *moduletest.File, conf
|
|||||||
return backend.ParseVariableValues(variables, config.Module.Variables)
|
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
|
// that contains all the variables defined for a given run and file, alongside
|
||||||
// any unset variables that have defaults within the provided config.
|
// 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
|
// 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
|
// 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.
|
// 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)
|
variables := make(map[string]backend.UnparsedVariableValue)
|
||||||
|
|
||||||
if run != nil {
|
if run != nil {
|
||||||
for name, expr := range run.Config.Variables {
|
for name, expr := range run.Config.Variables {
|
||||||
variables[name] = unparsedVariableValueExpression{
|
variables[name] = unparsedVariableValueExpression{
|
||||||
expr: expr,
|
expr: expr,
|
||||||
sourceType: terraform.ValueFromConfig,
|
sourceType: opentf.ValueFromConfig,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1076,7 +1076,7 @@ func prepareInputVariablesForAssertions(config *configs.Config, run *moduletest.
|
|||||||
}
|
}
|
||||||
variables[name] = unparsedVariableValueExpression{
|
variables[name] = unparsedVariableValueExpression{
|
||||||
expr: expr,
|
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
|
// We've gathered all the values we have, let's convert them into
|
||||||
// terraform.InputValues so they can be passed into the Terraform graph.
|
// 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
|
var diags tfdiags.Diagnostics
|
||||||
for name, variable := range variables {
|
for name, variable := range variables {
|
||||||
value, valueDiags := variable.ParseVariableValue(configs.VariableParseLiteral)
|
value, valueDiags := variable.ParseVariableValue(configs.VariableParseLiteral)
|
||||||
@ -1114,9 +1114,9 @@ func prepareInputVariablesForAssertions(config *configs.Config, run *moduletest.
|
|||||||
}
|
}
|
||||||
|
|
||||||
if variable.Default != cty.NilVal {
|
if variable.Default != cty.NilVal {
|
||||||
inputs[name] = &terraform.InputValue{
|
inputs[name] = &opentf.InputValue{
|
||||||
Value: variable.Default,
|
Value: variable.Default,
|
||||||
SourceType: terraform.ValueFromConfig,
|
SourceType: opentf.ValueFromConfig,
|
||||||
SourceRange: tfdiags.SourceRangeFromHCL(variable.DeclRange),
|
SourceRange: tfdiags.SourceRangeFromHCL(variable.DeclRange),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
|
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs/configschema"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ var (
|
|||||||
// TestProvider is a wrapper around terraform.MockProvider that defines dynamic
|
// TestProvider is a wrapper around terraform.MockProvider that defines dynamic
|
||||||
// schemas, and keeps track of the resources and data sources that it contains.
|
// schemas, and keeps track of the resources and data sources that it contains.
|
||||||
type TestProvider struct {
|
type TestProvider struct {
|
||||||
Provider *terraform.MockProvider
|
Provider *opentf.MockProvider
|
||||||
|
|
||||||
data, resource cty.Value
|
data, resource cty.Value
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ func NewProvider(store *ResourceStore) *TestProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
provider := &TestProvider{
|
provider := &TestProvider{
|
||||||
Provider: new(terraform.MockProvider),
|
Provider: new(opentf.MockProvider),
|
||||||
Store: store,
|
Store: store,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ import (
|
|||||||
"github.com/bgentry/speakeasy"
|
"github.com/bgentry/speakeasy"
|
||||||
"github.com/mattn/go-isatty"
|
"github.com/mattn/go-isatty"
|
||||||
"github.com/mitchellh/colorstring"
|
"github.com/mitchellh/colorstring"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
)
|
)
|
||||||
|
|
||||||
var defaultInputReader io.Reader
|
var defaultInputReader io.Reader
|
||||||
@ -49,7 +49,7 @@ type UIInput struct {
|
|||||||
once sync.Once
|
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)
|
i.once.Do(i.init)
|
||||||
|
|
||||||
r := i.Reader
|
r := i.Reader
|
||||||
|
@ -12,11 +12,11 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestUIInput_impl(t *testing.T) {
|
func TestUIInput_impl(t *testing.T) {
|
||||||
var _ terraform.UIInput = new(UIInput)
|
var _ opentf.UIInput = new(UIInput)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestUIInputInput(t *testing.T) {
|
func TestUIInputInput(t *testing.T) {
|
||||||
@ -25,7 +25,7 @@ func TestUIInputInput(t *testing.T) {
|
|||||||
Writer: bytes.NewBuffer(nil),
|
Writer: bytes.NewBuffer(nil),
|
||||||
}
|
}
|
||||||
|
|
||||||
v, err := i.Input(context.Background(), &terraform.InputOpts{})
|
v, err := i.Input(context.Background(), &opentf.InputOpts{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
@ -52,7 +52,7 @@ func TestUIInputInput_canceled(t *testing.T) {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
// Get input until the context is canceled.
|
// 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 {
|
if err != context.Canceled {
|
||||||
t.Fatalf("expected a context.Canceled error, got: %v", err)
|
t.Fatalf("expected a context.Canceled error, got: %v", err)
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ func TestUIInputInput_canceled(t *testing.T) {
|
|||||||
w.Close()
|
w.Close()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
v, err = i.Input(context.Background(), &terraform.InputOpts{})
|
v, err = i.Input(context.Background(), &opentf.InputOpts{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
@ -91,7 +91,7 @@ func TestUIInputInput_spaces(t *testing.T) {
|
|||||||
Writer: bytes.NewBuffer(nil),
|
Writer: bytes.NewBuffer(nil),
|
||||||
}
|
}
|
||||||
|
|
||||||
v, err := i.Input(context.Background(), &terraform.InputOpts{})
|
v, err := i.Input(context.Background(), &opentf.InputOpts{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
@ -107,7 +107,7 @@ func TestUIInputInput_Error(t *testing.T) {
|
|||||||
Writer: bytes.NewBuffer(nil),
|
Writer: bytes.NewBuffer(nil),
|
||||||
}
|
}
|
||||||
|
|
||||||
v, err := i.Input(context.Background(), &terraform.InputOpts{})
|
v, err := i.Input(context.Background(), &opentf.InputOpts{})
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatalf("Error is not 'nil'")
|
t.Fatalf("Error is not 'nil'")
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
|
|
||||||
"github.com/mitchellh/cli"
|
"github.com/mitchellh/cli"
|
||||||
|
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
"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" +
|
"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."
|
"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",
|
Id: "force-unlock",
|
||||||
Query: "Do you really want to force-unlock?",
|
Query: "Do you really want to force-unlock?",
|
||||||
Description: desc,
|
Description: desc,
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/clistate"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/clistate"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ func (c *UntaintCommand) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get schemas, if possible, before writing state
|
// Get schemas, if possible, before writing state
|
||||||
var schemas *terraform.Schemas
|
var schemas *opentf.Schemas
|
||||||
if isCloudMode(b) {
|
if isCloudMode(b) {
|
||||||
var schemaDiags tfdiags.Diagnostics
|
var schemaDiags tfdiags.Diagnostics
|
||||||
schemas, schemaDiags = c.MaybeGetSchemas(state, nil)
|
schemas, schemaDiags = c.MaybeGetSchemas(state, nil)
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/arguments"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/arguments"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs"
|
"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/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ func (c *ValidateCommand) validate(dir, testDir string, noTests bool) tfdiags.Di
|
|||||||
return diags
|
return diags
|
||||||
}
|
}
|
||||||
|
|
||||||
tfCtx, ctxDiags := terraform.NewContext(opts)
|
tfCtx, ctxDiags := opentf.NewContext(opts)
|
||||||
diags = diags.Append(ctxDiags)
|
diags = diags.Append(ctxDiags)
|
||||||
if ctxDiags.HasErrors() {
|
if ctxDiags.HasErrors() {
|
||||||
return diags
|
return diags
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/format"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/format"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views/json"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views/json"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ type Apply interface {
|
|||||||
Outputs(outputValues map[string]*states.OutputValue)
|
Outputs(outputValues map[string]*states.OutputValue)
|
||||||
|
|
||||||
Operation() Operation
|
Operation() Operation
|
||||||
Hooks() []terraform.Hook
|
Hooks() []opentf.Hook
|
||||||
|
|
||||||
Diagnostics(diags tfdiags.Diagnostics)
|
Diagnostics(diags tfdiags.Diagnostics)
|
||||||
HelpPrompt()
|
HelpPrompt()
|
||||||
@ -99,8 +99,8 @@ func (v *ApplyHuman) Operation() Operation {
|
|||||||
return NewOperation(arguments.ViewHuman, v.inAutomation, v.view)
|
return NewOperation(arguments.ViewHuman, v.inAutomation, v.view)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *ApplyHuman) Hooks() []terraform.Hook {
|
func (v *ApplyHuman) Hooks() []opentf.Hook {
|
||||||
return []terraform.Hook{
|
return []opentf.Hook{
|
||||||
v.countHook,
|
v.countHook,
|
||||||
NewUiHook(v.view),
|
NewUiHook(v.view),
|
||||||
}
|
}
|
||||||
@ -159,8 +159,8 @@ func (v *ApplyJSON) Operation() Operation {
|
|||||||
return &OperationJSON{view: v.view}
|
return &OperationJSON{view: v.view}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *ApplyJSON) Hooks() []terraform.Hook {
|
func (v *ApplyJSON) Hooks() []opentf.Hook {
|
||||||
return []terraform.Hook{
|
return []opentf.Hook{
|
||||||
v.countHook,
|
v.countHook,
|
||||||
newJSONHook(v.view),
|
newJSONHook(v.view),
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/addrs"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/addrs"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"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
|
// countHook is a hook that counts the number of resources
|
||||||
@ -30,10 +30,10 @@ type countHook struct {
|
|||||||
pending map[string]plans.Action
|
pending map[string]plans.Action
|
||||||
|
|
||||||
sync.Mutex
|
sync.Mutex
|
||||||
terraform.NilHook
|
opentf.NilHook
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ terraform.Hook = (*countHook)(nil)
|
var _ opentf.Hook = (*countHook)(nil)
|
||||||
|
|
||||||
func (h *countHook) Reset() {
|
func (h *countHook) Reset() {
|
||||||
h.Lock()
|
h.Lock()
|
||||||
@ -46,7 +46,7 @@ func (h *countHook) Reset() {
|
|||||||
h.Imported = 0
|
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()
|
h.Lock()
|
||||||
defer h.Unlock()
|
defer h.Unlock()
|
||||||
|
|
||||||
@ -56,10 +56,10 @@ func (h *countHook) PreApply(addr addrs.AbsResourceInstance, gen states.Generati
|
|||||||
|
|
||||||
h.pending[addr.String()] = action
|
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()
|
h.Lock()
|
||||||
defer h.Unlock()
|
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()
|
h.Lock()
|
||||||
defer h.Unlock()
|
defer h.Unlock()
|
||||||
|
|
||||||
// We don't count anything for data resources
|
// We don't count anything for data resources
|
||||||
if addr.Resource.Resource.Mode == addrs.DataResourceMode {
|
if addr.Resource.Resource.Mode == addrs.DataResourceMode {
|
||||||
return terraform.HookActionContinue, nil
|
return opentf.HookActionContinue, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
switch action {
|
switch action {
|
||||||
@ -107,13 +107,13 @@ func (h *countHook) PostDiff(addr addrs.AbsResourceInstance, gen states.Generati
|
|||||||
h.ToChange += 1
|
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()
|
h.Lock()
|
||||||
defer h.Unlock()
|
defer h.Unlock()
|
||||||
|
|
||||||
h.Imported++
|
h.Imported++
|
||||||
return terraform.HookActionContinue, nil
|
return opentf.HookActionContinue, nil
|
||||||
}
|
}
|
||||||
|
@ -12,13 +12,13 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/addrs"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/addrs"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"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"
|
legacy "github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/opentf"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCountHook_impl(t *testing.T) {
|
func TestCountHook_impl(t *testing.T) {
|
||||||
var _ terraform.Hook = new(countHook)
|
var _ opentf.Hook = new(countHook)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCountHookPostDiff_DestroyDeposed(t *testing.T) {
|
func TestCountHookPostDiff_DestroyDeposed(t *testing.T) {
|
||||||
|
@ -17,7 +17,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views/json"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views/json"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"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
|
// How long to wait between sending heartbeat/progress messages
|
||||||
@ -33,7 +33,7 @@ func newJSONHook(view *JSONView) *jsonHook {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type jsonHook struct {
|
type jsonHook struct {
|
||||||
terraform.NilHook
|
opentf.NilHook
|
||||||
|
|
||||||
view *JSONView
|
view *JSONView
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ type jsonHook struct {
|
|||||||
timeAfter func(time.Duration) <-chan time.Time
|
timeAfter func(time.Duration) <-chan time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ terraform.Hook = (*jsonHook)(nil)
|
var _ opentf.Hook = (*jsonHook)(nil)
|
||||||
|
|
||||||
type applyProgress struct {
|
type applyProgress struct {
|
||||||
addr addrs.AbsResourceInstance
|
addr addrs.AbsResourceInstance
|
||||||
@ -62,7 +62,7 @@ type applyProgress struct {
|
|||||||
heartbeatDone chan 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 {
|
if action != plans.NoOp {
|
||||||
idKey, idValue := format.ObjectValueIDOrName(priorState)
|
idKey, idValue := format.ObjectValueIDOrName(priorState)
|
||||||
h.view.Hook(json.NewApplyStart(addr, action, idKey, idValue))
|
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 {
|
if action != plans.NoOp {
|
||||||
go h.applyingHeartbeat(progress)
|
go h.applyingHeartbeat(progress)
|
||||||
}
|
}
|
||||||
return terraform.HookActionContinue, nil
|
return opentf.HookActionContinue, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *jsonHook) applyingHeartbeat(progress applyProgress) {
|
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()
|
key := addr.String()
|
||||||
h.applyingLock.Lock()
|
h.applyingLock.Lock()
|
||||||
progress := h.applying[key]
|
progress := h.applying[key]
|
||||||
@ -110,7 +110,7 @@ func (h *jsonHook) PostApply(addr addrs.AbsResourceInstance, gen states.Generati
|
|||||||
h.applyingLock.Unlock()
|
h.applyingLock.Unlock()
|
||||||
|
|
||||||
if progress.action == plans.NoOp {
|
if progress.action == plans.NoOp {
|
||||||
return terraform.HookActionContinue, nil
|
return opentf.HookActionContinue, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
elapsed := h.timeNow().Round(time.Second).Sub(progress.start)
|
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)
|
idKey, idValue := format.ObjectValueID(newState)
|
||||||
h.view.Hook(json.NewApplyComplete(addr, progress.action, idKey, idValue, elapsed))
|
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))
|
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 {
|
if err != nil {
|
||||||
// Errors are collected and displayed post-apply, so no need to
|
// Errors are collected and displayed post-apply, so no need to
|
||||||
// re-render them here. Instead just signal that this provisioner step
|
// re-render them here. Instead just signal that this provisioner step
|
||||||
@ -141,7 +141,7 @@ func (h *jsonHook) PostProvisionInstanceStep(addr addrs.AbsResourceInstance, typ
|
|||||||
} else {
|
} else {
|
||||||
h.view.Hook(json.NewProvisionComplete(addr, typeName))
|
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) {
|
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)
|
idKey, idValue := format.ObjectValueID(priorState)
|
||||||
h.view.Hook(json.NewRefreshStart(addr, idKey, idValue))
|
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)
|
idKey, idValue := format.ObjectValueID(newState)
|
||||||
h.view.Hook(json.NewRefreshComplete(addr, idKey, idValue))
|
h.view.Hook(json.NewRefreshComplete(addr, idKey, idValue))
|
||||||
return terraform.HookActionContinue, nil
|
return opentf.HookActionContinue, nil
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
"github.com/zclconf/go-cty/cty"
|
"github.com/zclconf/go-cty/cty"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -329,13 +329,13 @@ func TestJSONHook_refresh(t *testing.T) {
|
|||||||
testJSONViewOutputEquals(t, done(t).Stdout(), want)
|
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()
|
t.Helper()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if action != terraform.HookActionContinue {
|
if action != opentf.HookActionContinue {
|
||||||
t.Fatalf("Expected hook to continue, given: %#v", action)
|
t.Fatalf("Expected hook to continue, given: %#v", action)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
)
|
)
|
||||||
|
|
||||||
const defaultPeriodicUiTimer = 10 * time.Second
|
const defaultPeriodicUiTimer = 10 * time.Second
|
||||||
@ -34,7 +34,7 @@ func NewUiHook(view *View) *UiHook {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type UiHook struct {
|
type UiHook struct {
|
||||||
terraform.NilHook
|
opentf.NilHook
|
||||||
|
|
||||||
view *View
|
view *View
|
||||||
viewLock sync.Mutex
|
viewLock sync.Mutex
|
||||||
@ -45,7 +45,7 @@ type UiHook struct {
|
|||||||
resourcesLock sync.Mutex
|
resourcesLock sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ terraform.Hook = (*UiHook)(nil)
|
var _ opentf.Hook = (*UiHook)(nil)
|
||||||
|
|
||||||
// uiResourceState tracks the state of a single resource
|
// uiResourceState tracks the state of a single resource
|
||||||
type uiResourceState struct {
|
type uiResourceState struct {
|
||||||
@ -71,7 +71,7 @@ const (
|
|||||||
uiResourceNoOp
|
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()
|
dispAddr := addr.String()
|
||||||
if gen != states.CurrentGen {
|
if gen != states.CurrentGen {
|
||||||
dispAddr = fmt.Sprintf("%s (deposed object %s)", dispAddr, gen)
|
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
|
// 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.
|
// 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))
|
h.println(fmt.Sprintf("(Unknown action %s for %s)", action, dispAddr))
|
||||||
return terraform.HookActionContinue, nil
|
return opentf.HookActionContinue, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var stateIdSuffix string
|
var stateIdSuffix string
|
||||||
@ -141,7 +141,7 @@ func (h *UiHook) PreApply(addr addrs.AbsResourceInstance, gen states.Generation,
|
|||||||
go h.stillApplying(uiState)
|
go h.stillApplying(uiState)
|
||||||
}
|
}
|
||||||
|
|
||||||
return terraform.HookActionContinue, nil
|
return opentf.HookActionContinue, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *UiHook) stillApplying(state uiResourceState) {
|
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()
|
id := addr.String()
|
||||||
|
|
||||||
h.resourcesLock.Lock()
|
h.resourcesLock.Lock()
|
||||||
@ -213,14 +213,14 @@ func (h *UiHook) PostApply(addr addrs.AbsResourceInstance, gen states.Generation
|
|||||||
msg = "Read complete"
|
msg = "Read complete"
|
||||||
case uiResourceNoOp:
|
case uiResourceNoOp:
|
||||||
// We don't make any announcements about no-op changes
|
// We don't make any announcements about no-op changes
|
||||||
return terraform.HookActionContinue, nil
|
return opentf.HookActionContinue, nil
|
||||||
case uiResourceUnknown:
|
case uiResourceUnknown:
|
||||||
return terraform.HookActionContinue, nil
|
return opentf.HookActionContinue, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if applyerr != nil {
|
if applyerr != nil {
|
||||||
// Errors are collected and printed in ApplyCommand, no need to duplicate
|
// Errors are collected and printed in ApplyCommand, no need to duplicate
|
||||||
return terraform.HookActionContinue, nil
|
return opentf.HookActionContinue, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
addrStr := addr.String()
|
addrStr := addr.String()
|
||||||
@ -234,15 +234,15 @@ func (h *UiHook) PostApply(addr addrs.AbsResourceInstance, gen states.Generation
|
|||||||
|
|
||||||
h.println(colorized)
|
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.println(fmt.Sprintf(
|
||||||
h.view.colorize.Color("[reset][bold]%s: Provisioning with '%s'...[reset]"),
|
h.view.colorize.Color("[reset][bold]%s: Provisioning with '%s'...[reset]"),
|
||||||
addr, typeName,
|
addr, typeName,
|
||||||
))
|
))
|
||||||
return terraform.HookActionContinue, nil
|
return opentf.HookActionContinue, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *UiHook) ProvisionOutput(addr addrs.AbsResourceInstance, typeName string, msg string) {
|
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()))
|
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
|
var stateIdSuffix string
|
||||||
if k, v := format.ObjectValueID(priorState); k != "" && v != "" {
|
if k, v := format.ObjectValueID(priorState); k != "" && v != "" {
|
||||||
stateIdSuffix = fmt.Sprintf(" [%s=%s]", 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.println(fmt.Sprintf(
|
||||||
h.view.colorize.Color("[reset][bold]%s: Refreshing state...%s"),
|
h.view.colorize.Color("[reset][bold]%s: Refreshing state...%s"),
|
||||||
addrStr, stateIdSuffix))
|
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.println(fmt.Sprintf(
|
||||||
h.view.colorize.Color("[reset][bold]%s: Importing from ID %q..."),
|
h.view.colorize.Color("[reset][bold]%s: Importing from ID %q..."),
|
||||||
addr, importID,
|
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.println(fmt.Sprintf(
|
||||||
h.view.colorize.Color("[reset][bold][green]%s: Import prepared!"),
|
h.view.colorize.Color("[reset][bold][green]%s: Import prepared!"),
|
||||||
addr,
|
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.println(fmt.Sprintf(
|
||||||
h.view.colorize.Color("[reset][bold]%s: Preparing import... [id=%s]"),
|
h.view.colorize.Color("[reset][bold]%s: Preparing import... [id=%s]"),
|
||||||
addr, importID,
|
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.println(fmt.Sprintf(
|
||||||
h.view.colorize.Color("[reset][bold]%s: Importing... [id=%s]"),
|
h.view.colorize.Color("[reset][bold]%s: Importing... [id=%s]"),
|
||||||
addr, importing.ID,
|
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.println(fmt.Sprintf(
|
||||||
h.view.colorize.Color("[reset][bold]%s: Import complete [id=%s]"),
|
h.view.colorize.Color("[reset][bold]%s: Import complete [id=%s]"),
|
||||||
addr, importing.ID,
|
addr, importing.ID,
|
||||||
))
|
))
|
||||||
|
|
||||||
return terraform.HookActionContinue, nil
|
return opentf.HookActionContinue, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wrap calls to the view so that concurrent calls do not interleave println.
|
// Wrap calls to the view so that concurrent calls do not interleave println.
|
||||||
|
@ -19,7 +19,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
|
"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
|
// Test the PreApply hook for creating a new resource
|
||||||
@ -55,7 +55,7 @@ func TestUiHookPreApply_create(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if action != terraform.HookActionContinue {
|
if action != opentf.HookActionContinue {
|
||||||
t.Fatalf("Expected hook to continue, given: %#v", action)
|
t.Fatalf("Expected hook to continue, given: %#v", action)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ func TestUiHookPreApply_periodicTimer(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if action != terraform.HookActionContinue {
|
if action != opentf.HookActionContinue {
|
||||||
t.Fatalf("Expected hook to continue, given: %#v", action)
|
t.Fatalf("Expected hook to continue, given: %#v", action)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ func TestUiHookPreApply_destroy(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if action != terraform.HookActionContinue {
|
if action != opentf.HookActionContinue {
|
||||||
t.Fatalf("Expected hook to continue, given: %#v", action)
|
t.Fatalf("Expected hook to continue, given: %#v", action)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,7 +228,7 @@ func TestUiHookPostApply_colorInterpolation(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if action != terraform.HookActionContinue {
|
if action != opentf.HookActionContinue {
|
||||||
t.Fatalf("Expected hook to continue, given: %#v", action)
|
t.Fatalf("Expected hook to continue, given: %#v", action)
|
||||||
}
|
}
|
||||||
result := done(t)
|
result := done(t)
|
||||||
@ -281,7 +281,7 @@ func TestUiHookPostApply_emptyState(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if action != terraform.HookActionContinue {
|
if action != opentf.HookActionContinue {
|
||||||
t.Fatalf("Expected hook to continue, given: %#v", action)
|
t.Fatalf("Expected hook to continue, given: %#v", action)
|
||||||
}
|
}
|
||||||
result := done(t)
|
result := done(t)
|
||||||
@ -314,7 +314,7 @@ func TestPreProvisionInstanceStep(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if action != terraform.HookActionContinue {
|
if action != opentf.HookActionContinue {
|
||||||
t.Fatalf("Expected hook to continue, given: %#v", action)
|
t.Fatalf("Expected hook to continue, given: %#v", action)
|
||||||
}
|
}
|
||||||
result := done(t)
|
result := done(t)
|
||||||
@ -430,7 +430,7 @@ func TestPreRefresh(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if action != terraform.HookActionContinue {
|
if action != opentf.HookActionContinue {
|
||||||
t.Fatalf("Expected hook to continue, given: %#v", action)
|
t.Fatalf("Expected hook to continue, given: %#v", action)
|
||||||
}
|
}
|
||||||
result := done(t)
|
result := done(t)
|
||||||
@ -462,7 +462,7 @@ func TestPreRefresh_noID(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if action != terraform.HookActionContinue {
|
if action != opentf.HookActionContinue {
|
||||||
t.Fatalf("Expected hook to continue, given: %#v", action)
|
t.Fatalf("Expected hook to continue, given: %#v", action)
|
||||||
}
|
}
|
||||||
result := done(t)
|
result := done(t)
|
||||||
@ -489,7 +489,7 @@ func TestPreImportState(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if action != terraform.HookActionContinue {
|
if action != opentf.HookActionContinue {
|
||||||
t.Fatalf("Expected hook to continue, given: %#v", action)
|
t.Fatalf("Expected hook to continue, given: %#v", action)
|
||||||
}
|
}
|
||||||
result := done(t)
|
result := done(t)
|
||||||
@ -537,7 +537,7 @@ func TestPostImportState(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if action != terraform.HookActionContinue {
|
if action != opentf.HookActionContinue {
|
||||||
t.Fatalf("Expected hook to continue, given: %#v", action)
|
t.Fatalf("Expected hook to continue, given: %#v", action)
|
||||||
}
|
}
|
||||||
result := done(t)
|
result := done(t)
|
||||||
|
@ -17,7 +17,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views/json"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views/json"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
|
"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/internal/tfdiags"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ type Operation interface {
|
|||||||
EmergencyDumpState(stateFile *statefile.File) error
|
EmergencyDumpState(stateFile *statefile.File) error
|
||||||
|
|
||||||
PlannedChange(change *plans.ResourceInstanceChangeSrc)
|
PlannedChange(change *plans.ResourceInstanceChangeSrc)
|
||||||
Plan(plan *plans.Plan, schemas *terraform.Schemas)
|
Plan(plan *plans.Plan, schemas *opentf.Schemas)
|
||||||
PlanNextStep(planPath string, genConfigPath string)
|
PlanNextStep(planPath string, genConfigPath string)
|
||||||
|
|
||||||
Diagnostics(diags tfdiags.Diagnostics)
|
Diagnostics(diags tfdiags.Diagnostics)
|
||||||
@ -91,7 +91,7 @@ func (v *OperationHuman) EmergencyDumpState(stateFile *statefile.File) error {
|
|||||||
return nil
|
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)
|
outputs, changed, drift, attrs, err := jsonplan.MarshalForRenderer(plan, schemas)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
v.view.streams.Eprintf("Failed to marshal plan to json: %s", err)
|
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
|
// Log a change summary and a series of "planned" messages for the changes in
|
||||||
// the plan.
|
// 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 {
|
for _, dr := range plan.DriftedResources {
|
||||||
// In refresh-only mode, we output all resources marked as drifted,
|
// In refresh-only mode, we output all resources marked as drifted,
|
||||||
// including those which have moved without other changes. In other plan
|
// including those which have moved without other changes. In other plan
|
||||||
|
@ -16,7 +16,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
"github.com/zclconf/go-cty/cty"
|
"github.com/zclconf/go-cty/cty"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -81,11 +81,11 @@ func TestOperation_emergencyDumpState(t *testing.T) {
|
|||||||
func TestOperation_planNoChanges(t *testing.T) {
|
func TestOperation_planNoChanges(t *testing.T) {
|
||||||
|
|
||||||
tests := map[string]struct {
|
tests := map[string]struct {
|
||||||
plan func(schemas *terraform.Schemas) *plans.Plan
|
plan func(schemas *opentf.Schemas) *plans.Plan
|
||||||
wantText string
|
wantText string
|
||||||
}{
|
}{
|
||||||
"nothing at all in normal mode": {
|
"nothing at all in normal mode": {
|
||||||
func(schemas *terraform.Schemas) *plans.Plan {
|
func(schemas *opentf.Schemas) *plans.Plan {
|
||||||
return &plans.Plan{
|
return &plans.Plan{
|
||||||
UIMode: plans.NormalMode,
|
UIMode: plans.NormalMode,
|
||||||
Changes: plans.NewChanges(),
|
Changes: plans.NewChanges(),
|
||||||
@ -94,7 +94,7 @@ func TestOperation_planNoChanges(t *testing.T) {
|
|||||||
"no differences, so no changes are needed.",
|
"no differences, so no changes are needed.",
|
||||||
},
|
},
|
||||||
"nothing at all in refresh-only mode": {
|
"nothing at all in refresh-only mode": {
|
||||||
func(schemas *terraform.Schemas) *plans.Plan {
|
func(schemas *opentf.Schemas) *plans.Plan {
|
||||||
return &plans.Plan{
|
return &plans.Plan{
|
||||||
UIMode: plans.RefreshOnlyMode,
|
UIMode: plans.RefreshOnlyMode,
|
||||||
Changes: plans.NewChanges(),
|
Changes: plans.NewChanges(),
|
||||||
@ -103,7 +103,7 @@ func TestOperation_planNoChanges(t *testing.T) {
|
|||||||
"OpenTF has checked that the real remote objects still match",
|
"OpenTF has checked that the real remote objects still match",
|
||||||
},
|
},
|
||||||
"nothing at all in destroy mode": {
|
"nothing at all in destroy mode": {
|
||||||
func(schemas *terraform.Schemas) *plans.Plan {
|
func(schemas *opentf.Schemas) *plans.Plan {
|
||||||
return &plans.Plan{
|
return &plans.Plan{
|
||||||
UIMode: plans.DestroyMode,
|
UIMode: plans.DestroyMode,
|
||||||
Changes: plans.NewChanges(),
|
Changes: plans.NewChanges(),
|
||||||
@ -112,7 +112,7 @@ func TestOperation_planNoChanges(t *testing.T) {
|
|||||||
"No objects need to be destroyed.",
|
"No objects need to be destroyed.",
|
||||||
},
|
},
|
||||||
"no drift detected in normal noop": {
|
"no drift detected in normal noop": {
|
||||||
func(schemas *terraform.Schemas) *plans.Plan {
|
func(schemas *opentf.Schemas) *plans.Plan {
|
||||||
addr := addrs.Resource{
|
addr := addrs.Resource{
|
||||||
Mode: addrs.ManagedResourceMode,
|
Mode: addrs.ManagedResourceMode,
|
||||||
Type: "test_resource",
|
Type: "test_resource",
|
||||||
@ -153,7 +153,7 @@ func TestOperation_planNoChanges(t *testing.T) {
|
|||||||
"No changes",
|
"No changes",
|
||||||
},
|
},
|
||||||
"drift detected in normal mode": {
|
"drift detected in normal mode": {
|
||||||
func(schemas *terraform.Schemas) *plans.Plan {
|
func(schemas *opentf.Schemas) *plans.Plan {
|
||||||
addr := addrs.Resource{
|
addr := addrs.Resource{
|
||||||
Mode: addrs.ManagedResourceMode,
|
Mode: addrs.ManagedResourceMode,
|
||||||
Type: "test_resource",
|
Type: "test_resource",
|
||||||
@ -200,7 +200,7 @@ func TestOperation_planNoChanges(t *testing.T) {
|
|||||||
"Objects have changed outside of OpenTF",
|
"Objects have changed outside of OpenTF",
|
||||||
},
|
},
|
||||||
"drift detected in refresh-only mode": {
|
"drift detected in refresh-only mode": {
|
||||||
func(schemas *terraform.Schemas) *plans.Plan {
|
func(schemas *opentf.Schemas) *plans.Plan {
|
||||||
addr := addrs.Resource{
|
addr := addrs.Resource{
|
||||||
Mode: addrs.ManagedResourceMode,
|
Mode: addrs.ManagedResourceMode,
|
||||||
Type: "test_resource",
|
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",
|
"If you were expecting these changes then you can apply this plan",
|
||||||
},
|
},
|
||||||
"move-only changes in refresh-only mode": {
|
"move-only changes in refresh-only mode": {
|
||||||
func(schemas *terraform.Schemas) *plans.Plan {
|
func(schemas *opentf.Schemas) *plans.Plan {
|
||||||
addr := addrs.Resource{
|
addr := addrs.Resource{
|
||||||
Mode: addrs.ManagedResourceMode,
|
Mode: addrs.ManagedResourceMode,
|
||||||
Type: "test_resource",
|
Type: "test_resource",
|
||||||
@ -290,7 +290,7 @@ func TestOperation_planNoChanges(t *testing.T) {
|
|||||||
"test_resource.anywhere has moved to test_resource.somewhere",
|
"test_resource.anywhere has moved to test_resource.somewhere",
|
||||||
},
|
},
|
||||||
"drift detected in destroy mode": {
|
"drift detected in destroy mode": {
|
||||||
func(schemas *terraform.Schemas) *plans.Plan {
|
func(schemas *opentf.Schemas) *plans.Plan {
|
||||||
return &plans.Plan{
|
return &plans.Plan{
|
||||||
UIMode: plans.DestroyMode,
|
UIMode: plans.DestroyMode,
|
||||||
Changes: plans.NewChanges(),
|
Changes: plans.NewChanges(),
|
||||||
|
@ -7,14 +7,14 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/arguments"
|
"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"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
)
|
)
|
||||||
|
|
||||||
// The Plan view is used for the plan command.
|
// The Plan view is used for the plan command.
|
||||||
type Plan interface {
|
type Plan interface {
|
||||||
Operation() Operation
|
Operation() Operation
|
||||||
Hooks() []terraform.Hook
|
Hooks() []opentf.Hook
|
||||||
|
|
||||||
Diagnostics(diags tfdiags.Diagnostics)
|
Diagnostics(diags tfdiags.Diagnostics)
|
||||||
HelpPrompt()
|
HelpPrompt()
|
||||||
@ -51,8 +51,8 @@ func (v *PlanHuman) Operation() Operation {
|
|||||||
return NewOperation(arguments.ViewHuman, v.inAutomation, v.view)
|
return NewOperation(arguments.ViewHuman, v.inAutomation, v.view)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *PlanHuman) Hooks() []terraform.Hook {
|
func (v *PlanHuman) Hooks() []opentf.Hook {
|
||||||
return []terraform.Hook{
|
return []opentf.Hook{
|
||||||
NewUiHook(v.view),
|
NewUiHook(v.view),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -77,8 +77,8 @@ func (v *PlanJSON) Operation() Operation {
|
|||||||
return &OperationJSON{view: v.view}
|
return &OperationJSON{view: v.view}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *PlanJSON) Hooks() []terraform.Hook {
|
func (v *PlanJSON) Hooks() []opentf.Hook {
|
||||||
return []terraform.Hook{
|
return []opentf.Hook{
|
||||||
newJSONHook(v.view),
|
newJSONHook(v.view),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/providers"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
"github.com/zclconf/go-cty/cty"
|
"github.com/zclconf/go-cty/cty"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -130,17 +130,17 @@ func testPlanWithDatasource(t *testing.T) *plans.Plan {
|
|||||||
return plan
|
return plan
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSchemas() *terraform.Schemas {
|
func testSchemas() *opentf.Schemas {
|
||||||
provider := testProvider()
|
provider := testProvider()
|
||||||
return &terraform.Schemas{
|
return &opentf.Schemas{
|
||||||
Providers: map[addrs.Provider]providers.ProviderSchema{
|
Providers: map[addrs.Provider]providers.ProviderSchema{
|
||||||
addrs.NewDefaultProvider("test"): provider.GetProviderSchema(),
|
addrs.NewDefaultProvider("test"): provider.GetProviderSchema(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func testProvider() *terraform.MockProvider {
|
func testProvider() *opentf.MockProvider {
|
||||||
p := new(terraform.MockProvider)
|
p := new(opentf.MockProvider)
|
||||||
p.ReadResourceFn = func(req providers.ReadResourceRequest) providers.ReadResourceResponse {
|
p.ReadResourceFn = func(req providers.ReadResourceRequest) providers.ReadResourceResponse {
|
||||||
return providers.ReadResourceResponse{NewState: req.PriorState}
|
return providers.ReadResourceResponse{NewState: req.PriorState}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/arguments"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/arguments"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views/json"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/command/views/json"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/tfdiags"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ type Refresh interface {
|
|||||||
Outputs(outputValues map[string]*states.OutputValue)
|
Outputs(outputValues map[string]*states.OutputValue)
|
||||||
|
|
||||||
Operation() Operation
|
Operation() Operation
|
||||||
Hooks() []terraform.Hook
|
Hooks() []opentf.Hook
|
||||||
|
|
||||||
Diagnostics(diags tfdiags.Diagnostics)
|
Diagnostics(diags tfdiags.Diagnostics)
|
||||||
HelpPrompt()
|
HelpPrompt()
|
||||||
@ -65,8 +65,8 @@ func (v *RefreshHuman) Operation() Operation {
|
|||||||
return NewOperation(arguments.ViewHuman, v.inAutomation, v.view)
|
return NewOperation(arguments.ViewHuman, v.inAutomation, v.view)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *RefreshHuman) Hooks() []terraform.Hook {
|
func (v *RefreshHuman) Hooks() []opentf.Hook {
|
||||||
return []terraform.Hook{
|
return []opentf.Hook{
|
||||||
v.countHook,
|
v.countHook,
|
||||||
NewUiHook(v.view),
|
NewUiHook(v.view),
|
||||||
}
|
}
|
||||||
@ -101,8 +101,8 @@ func (v *RefreshJSON) Operation() Operation {
|
|||||||
return &OperationJSON{view: v.view}
|
return &OperationJSON{view: v.view}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *RefreshJSON) Hooks() []terraform.Hook {
|
func (v *RefreshJSON) Hooks() []opentf.Hook {
|
||||||
return []terraform.Hook{
|
return []opentf.Hook{
|
||||||
newJSONHook(v.view),
|
newJSONHook(v.view),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,13 +17,13 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/configs"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
|
"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/internal/tfdiags"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Show interface {
|
type Show interface {
|
||||||
// Display renders the plan, if it is available. If plan is nil, it renders the statefile.
|
// 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 renders early diagnostics, resulting from argument parsing.
|
||||||
Diagnostics(diags tfdiags.Diagnostics)
|
Diagnostics(diags tfdiags.Diagnostics)
|
||||||
@ -46,7 +46,7 @@ type ShowHuman struct {
|
|||||||
|
|
||||||
var _ Show = (*ShowHuman)(nil)
|
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{
|
renderer := jsonformat.Renderer{
|
||||||
Colorize: v.view.colorize,
|
Colorize: v.view.colorize,
|
||||||
Streams: v.view.streams,
|
Streams: v.view.streams,
|
||||||
@ -131,7 +131,7 @@ type ShowJSON struct {
|
|||||||
|
|
||||||
var _ Show = (*ShowJSON)(nil)
|
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
|
// Prefer to display a pre-built JSON plan, if we got one; then, fall back
|
||||||
// to building one ourselves.
|
// to building one ourselves.
|
||||||
if planJSON != nil {
|
if planJSON != nil {
|
||||||
|
@ -19,7 +19,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/terminal"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/terraform"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
|
||||||
|
|
||||||
"github.com/zclconf/go-cty/cty"
|
"github.com/zclconf/go-cty/cty"
|
||||||
)
|
)
|
||||||
@ -34,7 +34,7 @@ func TestShowHuman(t *testing.T) {
|
|||||||
plan *plans.Plan
|
plan *plans.Plan
|
||||||
jsonPlan *cloudplan.RemotePlanJSON
|
jsonPlan *cloudplan.RemotePlanJSON
|
||||||
stateFile *statefile.File
|
stateFile *statefile.File
|
||||||
schemas *terraform.Schemas
|
schemas *opentf.Schemas
|
||||||
wantExact bool
|
wantExact bool
|
||||||
wantString string
|
wantString string
|
||||||
}{
|
}{
|
||||||
@ -179,7 +179,7 @@ func TestShowJSON(t *testing.T) {
|
|||||||
view.Configure(&arguments.View{NoColor: true})
|
view.Configure(&arguments.View{NoColor: true})
|
||||||
v := NewShow(arguments.ViewJSON, view)
|
v := NewShow(arguments.ViewJSON, view)
|
||||||
|
|
||||||
schemas := &terraform.Schemas{
|
schemas := &opentf.Schemas{
|
||||||
Providers: map[addrs.Provider]providers.ProviderSchema{
|
Providers: map[addrs.Provider]providers.ProviderSchema{
|
||||||
addrs.NewDefaultProvider("test"): {
|
addrs.NewDefaultProvider("test"): {
|
||||||
ResourceTypes: map[string]providers.Schema{
|
ResourceTypes: map[string]providers.Schema{
|
||||||
|
@ -18,7 +18,7 @@ import (
|
|||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/plans"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/states"
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/states/statefile"
|
"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/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
|
// 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.
|
// or the state depending on the type of run we did.
|
||||||
|
|
||||||
schemas := &terraform.Schemas{
|
schemas := &opentf.Schemas{
|
||||||
Providers: run.Verbose.Providers,
|
Providers: run.Verbose.Providers,
|
||||||
Provisioners: run.Verbose.Provisioners,
|
Provisioners: run.Verbose.Provisioners,
|
||||||
}
|
}
|
||||||
@ -402,7 +402,7 @@ func (t *TestJSON) Run(run *moduletest.Run, file *moduletest.File) {
|
|||||||
|
|
||||||
if run.Verbose != nil {
|
if run.Verbose != nil {
|
||||||
|
|
||||||
schemas := &terraform.Schemas{
|
schemas := &opentf.Schemas{
|
||||||
Providers: run.Verbose.Providers,
|
Providers: run.Verbose.Providers,
|
||||||
Provisioners: run.Verbose.Provisioners,
|
Provisioners: run.Verbose.Provisioners,
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) HashiCorp, Inc.
|
// Copyright (c) HashiCorp, Inc.
|
||||||
// SPDX-License-Identifier: MPL-2.0
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
package terraform
|
package opentf
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) HashiCorp, Inc.
|
// Copyright (c) HashiCorp, Inc.
|
||||||
// SPDX-License-Identifier: MPL-2.0
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
package terraform
|
package opentf
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) HashiCorp, Inc.
|
// Copyright (c) HashiCorp, Inc.
|
||||||
// SPDX-License-Identifier: MPL-2.0
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
package terraform
|
package opentf
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) HashiCorp, Inc.
|
// Copyright (c) HashiCorp, Inc.
|
||||||
// SPDX-License-Identifier: MPL-2.0
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
package terraform
|
package opentf
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) HashiCorp, Inc.
|
// Copyright (c) HashiCorp, Inc.
|
||||||
// SPDX-License-Identifier: MPL-2.0
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
package terraform
|
package opentf
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) HashiCorp, Inc.
|
// Copyright (c) HashiCorp, Inc.
|
||||||
// SPDX-License-Identifier: MPL-2.0
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
package terraform
|
package opentf
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) HashiCorp, Inc.
|
// Copyright (c) HashiCorp, Inc.
|
||||||
// SPDX-License-Identifier: MPL-2.0
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
package terraform
|
package opentf
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) HashiCorp, Inc.
|
// Copyright (c) HashiCorp, Inc.
|
||||||
// SPDX-License-Identifier: MPL-2.0
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
package terraform
|
package opentf
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) HashiCorp, Inc.
|
// Copyright (c) HashiCorp, Inc.
|
||||||
// SPDX-License-Identifier: MPL-2.0
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
package terraform
|
package opentf
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) HashiCorp, Inc.
|
// Copyright (c) HashiCorp, Inc.
|
||||||
// SPDX-License-Identifier: MPL-2.0
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
package terraform
|
package opentf
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) HashiCorp, Inc.
|
// Copyright (c) HashiCorp, Inc.
|
||||||
// SPDX-License-Identifier: MPL-2.0
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
package terraform
|
package opentf
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) HashiCorp, Inc.
|
// Copyright (c) HashiCorp, Inc.
|
||||||
// SPDX-License-Identifier: MPL-2.0
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
package terraform
|
package opentf
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"reflect"
|
"reflect"
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) HashiCorp, Inc.
|
// Copyright (c) HashiCorp, Inc.
|
||||||
// SPDX-License-Identifier: MPL-2.0
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
package terraform
|
package opentf
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
@ -96,7 +96,7 @@ type PlanOpts struct {
|
|||||||
//
|
//
|
||||||
// The given planning options allow control of various other details of the
|
// The given planning options allow control of various other details of the
|
||||||
// planning process that are not represented directly in the configuration.
|
// 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.
|
// special options.
|
||||||
//
|
//
|
||||||
// If the returned diagnostics contains no errors then the returned plan is
|
// 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
Loading…
Reference in New Issue
Block a user