mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-16 11:42:58 -06:00
009a136fa2
create interfaces that nodes can implement to declare whether they expand into instances of some sort, using the instances.Expander, and/or whether use the instances.Expander to find instances. included is a rough transformer implementation to remove these nodes from the apply graph.
20 lines
776 B
Go
20 lines
776 B
Go
package terraform
|
|
|
|
import "github.com/hashicorp/terraform/addrs"
|
|
|
|
// instanceExpander is implemented by nodes that causes instances to be
|
|
// registered in the instances.Expander.
|
|
// This is used to determine during apply whether a node is required to be in
|
|
// the graph, by checking if it has any requiresInstanceExpansion dependents.
|
|
// This prevents unnecessary nodes from being evaluated, and if the module is
|
|
// being removed, we may not be able to evaluate the expansion at all.
|
|
type instanceExpander interface {
|
|
expandsInstances() addrs.Module
|
|
}
|
|
|
|
// requiresInstanceExpansion is implemented by nodes that require their address
|
|
// be previously registered in the instances.Expander in order to evaluate.
|
|
type requiresInstanceExpansion interface {
|
|
requiresExpansion()
|
|
}
|