terraform: hook up the proxies
This commit is contained in:
parent
7d28e980a5
commit
e544e1d401
|
@ -94,6 +94,11 @@ func (n *GraphNodeConfigOutput) EvalTree() EvalNode {
|
|||
}
|
||||
}
|
||||
|
||||
// GraphNodeProxy impl.
|
||||
func (n *GraphNodeConfigOutput) Proxy() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// GraphNodeConfigProvider represents a configured provider within the
|
||||
// configuration graph. These are only immediately in the graph when an
|
||||
// explicit `provider` configuration block is in the configuration.
|
||||
|
|
|
@ -283,6 +283,15 @@ func (n *graphNodeModuleFlatWrap) DependentOn() []string {
|
|||
return result
|
||||
}
|
||||
|
||||
func (n *graphNodeModuleFlatWrap) Proxy() bool {
|
||||
pn, ok := n.graphNodeModuleWrappable.(GraphNodeProxy)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
|
||||
return pn.Proxy()
|
||||
}
|
||||
|
||||
func (n *graphNodeModuleFlatWrap) prefixList(result []string, prefix string) {
|
||||
for i, v := range result {
|
||||
result[i] = fmt.Sprintf("%s.%s", prefix, v)
|
||||
|
|
|
@ -13,6 +13,7 @@ func TestGraphNodeConfigOutput_impl(t *testing.T) {
|
|||
var _ dag.NamedVertex = new(GraphNodeConfigOutput)
|
||||
var _ graphNodeConfig = new(GraphNodeConfigOutput)
|
||||
var _ GraphNodeOutput = new(GraphNodeConfigOutput)
|
||||
var _ GraphNodeProxy = new(GraphNodeConfigOutput)
|
||||
}
|
||||
|
||||
func TestGraphNodeConfigProvider_impl(t *testing.T) {
|
||||
|
@ -113,4 +114,5 @@ func TestGraphNodeConfigVariable_impl(t *testing.T) {
|
|||
var _ dag.NamedVertex = new(GraphNodeConfigVariable)
|
||||
var _ graphNodeConfig = new(GraphNodeConfigVariable)
|
||||
var _ GraphNodeVariable = new(GraphNodeConfigVariable)
|
||||
var _ GraphNodeProxy = new(GraphNodeConfigVariable)
|
||||
}
|
||||
|
|
|
@ -61,3 +61,8 @@ func (n *GraphNodeConfigVariable) VariableName() string {
|
|||
func (n *GraphNodeConfigVariable) SetVariableValue(v *config.RawConfig) {
|
||||
n.Value = v
|
||||
}
|
||||
|
||||
// GraphNodeProxy impl.
|
||||
func (n *GraphNodeConfigVariable) Proxy() bool {
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -35,6 +35,37 @@ func TestFlattenTransformer(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestFlattenTransformer_withProxy(t *testing.T) {
|
||||
mod := testModule(t, "transform-flatten")
|
||||
|
||||
var b BasicGraphBuilder
|
||||
b = BasicGraphBuilder{
|
||||
Steps: []GraphTransformer{
|
||||
&ConfigTransformer{Module: mod},
|
||||
&VertexTransformer{
|
||||
Transforms: []GraphVertexTransformer{
|
||||
&ExpandTransform{
|
||||
Builder: &b,
|
||||
},
|
||||
},
|
||||
},
|
||||
&FlattenTransformer{},
|
||||
&ProxyTransformer{},
|
||||
},
|
||||
}
|
||||
|
||||
g, err := b.Build(rootModulePath)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
||||
actual := strings.TrimSpace(g.String())
|
||||
expected := strings.TrimSpace(testTransformFlattenProxyStr)
|
||||
if actual != expected {
|
||||
t.Fatalf("bad:\n\n%s", actual)
|
||||
}
|
||||
}
|
||||
|
||||
const testTransformFlattenStr = `
|
||||
aws_instance.parent
|
||||
aws_instance.parent-output
|
||||
|
@ -46,3 +77,17 @@ module.child.output.output
|
|||
module.child.var.var
|
||||
aws_instance.parent
|
||||
`
|
||||
|
||||
const testTransformFlattenProxyStr = `
|
||||
aws_instance.parent
|
||||
aws_instance.parent-output
|
||||
module.child.aws_instance.child
|
||||
module.child.output.output
|
||||
module.child.aws_instance.child
|
||||
aws_instance.parent
|
||||
module.child.var.var
|
||||
module.child.output.output
|
||||
module.child.aws_instance.child
|
||||
module.child.var.var
|
||||
aws_instance.parent
|
||||
`
|
||||
|
|
Loading…
Reference in New Issue