github.com/hashicorp/terraform-plugin-sdk@v1.17.2/internal/lang/scope.go (about)

     1  package lang
     2  
     3  import (
     4  	"sync"
     5  
     6  	"github.com/zclconf/go-cty/cty/function"
     7  
     8  	"github.com/hashicorp/terraform-plugin-sdk/internal/addrs"
     9  )
    10  
    11  // Scope is the main type in this package, allowing dynamic evaluation of
    12  // blocks and expressions based on some contextual information that informs
    13  // which variables and functions will be available.
    14  type Scope struct {
    15  	// Data is used to resolve references in expressions.
    16  	Data Data
    17  
    18  	// SelfAddr is the address that the "self" object should be an alias of,
    19  	// or nil if the "self" object should not be available at all.
    20  	SelfAddr addrs.Referenceable
    21  
    22  	// BaseDir is the base directory used by any interpolation functions that
    23  	// accept filesystem paths as arguments.
    24  	BaseDir string
    25  
    26  	// PureOnly can be set to true to request that any non-pure functions
    27  	// produce unknown value results rather than actually executing. This is
    28  	// important during a plan phase to avoid generating results that could
    29  	// then differ during apply.
    30  	PureOnly bool
    31  
    32  	funcs     map[string]function.Function
    33  	funcsLock sync.Mutex
    34  }