terraform: providers in flattened graphs should depend on the parent

This commit is contained in:
Mitchell Hashimoto 2015-05-01 16:41:49 -07:00
parent c207beda36
commit 7fd432b076
1 changed files with 19 additions and 3 deletions

View File

@ -102,10 +102,26 @@ func (n *GraphNodeConfigProviderFlat) DependableName() []string {
}
func (n *GraphNodeConfigProviderFlat) DependentOn() []string {
prefix := modulePrefixStr(n.PathValue)
return modulePrefixList(
prefixed := modulePrefixList(
n.GraphNodeConfigProvider.DependentOn(),
prefix)
modulePrefixStr(n.PathValue))
result := make([]string, len(prefixed), len(prefixed)+1)
copy(result, prefixed)
// If we're in a module, then depend on our parent's provider
if len(n.PathValue) > 1 {
prefix := modulePrefixStr(n.PathValue[:len(n.PathValue)-1])
if prefix != "" {
prefix += "."
}
result = append(result, fmt.Sprintf(
"%s%s",
prefix, n.GraphNodeConfigProvider.Name()))
}
return result
}
func (n *GraphNodeConfigProviderFlat) ProviderName() string {