core: Attach schemas to nodes created by ResourceCountTransformer
Previously we were only doing this in the case where count wasn't set at all.
This commit is contained in:
parent
f9fef56167
commit
b1ed146931
|
@ -182,7 +182,7 @@ func (n *NodeAbstractResource) References() []*addrs.Reference {
|
|||
if n.Schema == nil {
|
||||
// Should never happens, but we'll log if it does so that we can
|
||||
// see this easily when debugging.
|
||||
log.Printf("[WARN] no schema is attached to %s, so references cannot be detected", n.Name())
|
||||
log.Printf("[WARN] no schema is attached to %s, so config references cannot be detected", n.Name())
|
||||
}
|
||||
|
||||
refs, _ := lang.ReferencesInExpr(c.Count)
|
||||
|
@ -220,6 +220,13 @@ func (n *NodeAbstractResourceInstance) References() []*addrs.Reference {
|
|||
// embedded abstract resource, which knows how to extract dependencies
|
||||
// from configuration.
|
||||
if n.Config != nil {
|
||||
if n.Schema == nil {
|
||||
// We'll produce a log message about this out here so that
|
||||
// we can include the full instance address, since the equivalent
|
||||
// message in NodeAbstractResource.References cannot see it.
|
||||
log.Printf("[WARN] no schema is attached to %s, so config references cannot be detected", n.Name())
|
||||
return nil
|
||||
}
|
||||
return n.NodeAbstractResource.References()
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ func (t *ResourceCountTransformer) Transform(g *Graph) error {
|
|||
addr := t.Addr.Instance(key)
|
||||
|
||||
abstract := NewNodeAbstractResourceInstance(addr)
|
||||
abstract.Schema = t.Schema
|
||||
var node dag.Vertex = abstract
|
||||
if f := t.Concrete; f != nil {
|
||||
node = f(abstract)
|
||||
|
|
Loading…
Reference in New Issue