github.com/opentofu/opentofu@v1.7.1/internal/tofu/transform_expand.go (about)

     1  // Copyright (c) The OpenTofu Authors
     2  // SPDX-License-Identifier: MPL-2.0
     3  // Copyright (c) 2023 HashiCorp, Inc.
     4  // SPDX-License-Identifier: MPL-2.0
     5  
     6  package tofu
     7  
     8  // GraphNodeDynamicExpandable is an interface that nodes can implement
     9  // to signal that they can be expanded at eval-time (hence dynamic).
    10  // These nodes are given the eval context and are expected to return
    11  // a new subgraph.
    12  type GraphNodeDynamicExpandable interface {
    13  	// DynamicExpand returns a new graph which will be treated as the dynamic
    14  	// subgraph of the receiving node.
    15  	//
    16  	// The second return value is of type error for historical reasons;
    17  	// it's valid (and most ideal) for DynamicExpand to return the result
    18  	// of calling ErrWithWarnings on a tfdiags.Diagnostics value instead,
    19  	// in which case the caller will unwrap it and gather the individual
    20  	// diagnostics.
    21  	DynamicExpand(EvalContext) (*Graph, error)
    22  }