mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-28 01:41:48 -06:00
terraform: basic test passing
This commit is contained in:
parent
8bb8637f24
commit
59e498dba8
@ -5,7 +5,7 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestContextImport(t *testing.T) {
|
||||
func TestContextImport_basic(t *testing.T) {
|
||||
p := testProvider("aws")
|
||||
ctx := testContext2(t, &ContextOpts{
|
||||
Providers: map[string]ResourceProviderFactory{
|
||||
@ -13,6 +13,13 @@ func TestContextImport(t *testing.T) {
|
||||
},
|
||||
})
|
||||
|
||||
p.ImportStateReturn = []*InstanceState{
|
||||
&InstanceState{
|
||||
ID: "foo",
|
||||
Ephemeral: EphemeralState{Type: "aws_instance"},
|
||||
},
|
||||
}
|
||||
|
||||
state, err := ctx.Import(&ImportOpts{
|
||||
Targets: []*ImportTarget{
|
||||
&ImportTarget{
|
||||
@ -32,4 +39,8 @@ func TestContextImport(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
const testImportStr = ``
|
||||
const testImportStr = `
|
||||
aws_instance.foo:
|
||||
ID = foo
|
||||
provider = aws
|
||||
`
|
||||
|
@ -47,6 +47,7 @@ func (n *EvalRefresh) Eval(ctx EvalContext) (interface{}, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
log.Printf("STATE: %#v", state)
|
||||
if n.Output != nil {
|
||||
*n.Output = state
|
||||
}
|
||||
|
@ -97,7 +97,9 @@ func (n *graphNodeImportState) DynamicExpand(ctx EvalContext) (*Graph, error) {
|
||||
// is safe.
|
||||
for _, state := range n.states {
|
||||
g.Add(&graphNodeImportStateSub{
|
||||
State: state,
|
||||
Target: n.Addr,
|
||||
Path_: n.Path(),
|
||||
State: state,
|
||||
})
|
||||
}
|
||||
|
||||
@ -163,6 +165,7 @@ func (n *graphNodeImportStateSub) EvalTree() EvalNode {
|
||||
Provider: &provider,
|
||||
State: &state,
|
||||
Info: info,
|
||||
Output: &state,
|
||||
},
|
||||
&EvalWriteState{
|
||||
Name: key.String(),
|
||||
|
Loading…
Reference in New Issue
Block a user