opentofu/internal/terraform/node_external_reference.go
Liam Cervante 3732bffe13
[Testing Framework] Adds TestContext for evaluating test assertions (#33326)
* Add test structure to views package for rendering test output

* Add test file HCL configuration and parser functionality

* Adds a TestContext structure for evaluating assertions against the state and plan
2023-06-26 17:42:53 +02:00

32 lines
1005 B
Go

package terraform
import "github.com/hashicorp/terraform/internal/addrs"
// nodeExternalReference allows external callers (such as the testing framework)
// to provide the list of references they are making into the graph. This
// ensures that Terraform will not remove any nodes from the graph that might
// not be referenced from within a module but are referenced by the currently
// executing test file.
//
// This should only be added to the graph if we are executing the
// `terraform test` command.
type nodeExternalReference struct {
ExternalReferences []*addrs.Reference
}
var (
_ GraphNodeReferencer = (*nodeExternalReference)(nil)
)
// GraphNodeModulePath
func (n *nodeExternalReference) ModulePath() addrs.Module {
// The external references are always made from test files, which currently
// execute as if they are in the root module.
return addrs.RootModule
}
// GraphNodeReferencer
func (n *nodeExternalReference) References() []*addrs.Reference {
return n.ExternalReferences
}