track destroy references for data sources too

Since data source destruction is only state removal, and other resources
cannot depend on them creating any physical resources, the destroy
dependencies were not tracked in the state. It turns out that there is a
special case which requires this; running terraform destroy where the
provider depends on a data source. In that case the resources using that
provider need to record their indirect dependence on the data source, so
that they can be deleted before the data source is removed from the
state.
This commit is contained in:
James Bardin 2020-07-15 19:24:37 -04:00
parent c0dbc95236
commit ebe31acc48
1 changed files with 0 additions and 10 deletions

View File

@ -214,11 +214,6 @@ func (t AttachDependenciesTransformer) Transform(g *Graph) error {
}
selfAddr := attacher.ResourceAddr()
// Data sources don't need to track destroy dependencies
if selfAddr.Resource.Mode == addrs.DataResourceMode {
continue
}
ans, err := g.Ancestors(v)
if err != nil {
return err
@ -240,11 +235,6 @@ func (t AttachDependenciesTransformer) Transform(g *Graph) error {
continue
}
// Data sources don't need to track destroy dependencies
if addr.Resource.Mode == addrs.DataResourceMode {
continue
}
if addr.Equal(selfAddr) {
continue
}