terraform: import module works!
This commit is contained in:
parent
3b85544016
commit
0a7f48ab8e
|
@ -108,7 +108,7 @@ func TestContextImport_module(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
actual := strings.TrimSpace(state.String())
|
actual := strings.TrimSpace(state.String())
|
||||||
expected := strings.TrimSpace(testImportRefreshStr)
|
expected := strings.TrimSpace(testImportModuleStr)
|
||||||
if actual != expected {
|
if actual != expected {
|
||||||
t.Fatalf("bad: \n%s", actual)
|
t.Fatalf("bad: \n%s", actual)
|
||||||
}
|
}
|
||||||
|
@ -120,6 +120,14 @@ aws_instance.foo:
|
||||||
provider = aws
|
provider = aws
|
||||||
`
|
`
|
||||||
|
|
||||||
|
const testImportModuleStr = `
|
||||||
|
<no state>
|
||||||
|
module.foo:
|
||||||
|
aws_instance.foo:
|
||||||
|
ID = foo
|
||||||
|
provider = aws
|
||||||
|
`
|
||||||
|
|
||||||
const testImportRefreshStr = `
|
const testImportRefreshStr = `
|
||||||
aws_instance.foo:
|
aws_instance.foo:
|
||||||
ID = foo
|
ID = foo
|
||||||
|
|
|
@ -51,7 +51,7 @@ func (n *graphNodeImportState) ProvidedBy() []string {
|
||||||
|
|
||||||
// GraphNodeSubPath
|
// GraphNodeSubPath
|
||||||
func (n *graphNodeImportState) Path() []string {
|
func (n *graphNodeImportState) Path() []string {
|
||||||
return n.Addr.Path
|
return normalizeModulePath(n.Addr.Path)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GraphNodeEvalable impl.
|
// GraphNodeEvalable impl.
|
||||||
|
@ -59,7 +59,7 @@ func (n *graphNodeImportState) EvalTree() EvalNode {
|
||||||
var provider ResourceProvider
|
var provider ResourceProvider
|
||||||
info := &InstanceInfo{
|
info := &InstanceInfo{
|
||||||
Id: n.ID,
|
Id: n.ID,
|
||||||
ModulePath: n.Addr.Path,
|
ModulePath: n.Path(),
|
||||||
Type: n.Addr.Type,
|
Type: n.Addr.Type,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,6 +126,10 @@ func (n *graphNodeImportStateSub) Name() string {
|
||||||
return fmt.Sprintf("import %s result: %s", n.Target, n.State.ID)
|
return fmt.Sprintf("import %s result: %s", n.Target, n.State.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (n *graphNodeImportStateSub) Path() []string {
|
||||||
|
return n.Path_
|
||||||
|
}
|
||||||
|
|
||||||
// GraphNodeEvalable impl.
|
// GraphNodeEvalable impl.
|
||||||
func (n *graphNodeImportStateSub) EvalTree() EvalNode {
|
func (n *graphNodeImportStateSub) EvalTree() EvalNode {
|
||||||
// If the Ephemeral type isn't set, then it is an error
|
// If the Ephemeral type isn't set, then it is an error
|
||||||
|
|
Loading…
Reference in New Issue