github.com/muratcelep/terraform@v1.1.0-beta2-not-internal-4/not-internal/lang/data.go (about) 1 package lang 2 3 import ( 4 "github.com/muratcelep/terraform/not-internal/addrs" 5 "github.com/muratcelep/terraform/not-internal/tfdiags" 6 "github.com/zclconf/go-cty/cty" 7 ) 8 9 // Data is an interface whose implementations can provide cty.Value 10 // representations of objects identified by referenceable addresses from 11 // the addrs package. 12 // 13 // This interface will grow each time a new type of reference is added, and so 14 // implementations outside of the Terraform codebases are not advised. 15 // 16 // Each method returns a suitable value and optionally some diagnostics. If the 17 // returned diagnostics contains errors then the type of the returned value is 18 // used to construct an unknown value of the same type which is then used in 19 // place of the requested object so that type checking can still proceed. In 20 // cases where it's not possible to even determine a suitable result type, 21 // cty.DynamicVal is returned along with errors describing the problem. 22 type Data interface { 23 StaticValidateReferences(refs []*addrs.Reference, self addrs.Referenceable) tfdiags.Diagnostics 24 25 GetCountAttr(addrs.CountAttr, tfdiags.SourceRange) (cty.Value, tfdiags.Diagnostics) 26 GetForEachAttr(addrs.ForEachAttr, tfdiags.SourceRange) (cty.Value, tfdiags.Diagnostics) 27 GetResource(addrs.Resource, tfdiags.SourceRange) (cty.Value, tfdiags.Diagnostics) 28 GetLocalValue(addrs.LocalValue, tfdiags.SourceRange) (cty.Value, tfdiags.Diagnostics) 29 GetModule(addrs.ModuleCall, tfdiags.SourceRange) (cty.Value, tfdiags.Diagnostics) 30 GetPathAttr(addrs.PathAttr, tfdiags.SourceRange) (cty.Value, tfdiags.Diagnostics) 31 GetTerraformAttr(addrs.TerraformAttr, tfdiags.SourceRange) (cty.Value, tfdiags.Diagnostics) 32 GetInputVariable(addrs.InputVariable, tfdiags.SourceRange) (cty.Value, tfdiags.Diagnostics) 33 }