2018-04-04 03:11:28 +02:00
|
|
|
package lang
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/hashicorp/terraform/addrs"
|
|
|
|
"github.com/hashicorp/terraform/tfdiags"
|
|
|
|
"github.com/zclconf/go-cty/cty"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Data is an interface whose implementations can provide cty.Value
|
|
|
|
// representations of objects identified by referenceable addresses from
|
|
|
|
// the addrs package.
|
|
|
|
//
|
|
|
|
// This interface will grow each time a new type of reference is added, and so
|
|
|
|
// implementations outside of the Terraform codebases are not advised.
|
|
|
|
//
|
|
|
|
// Each method returns a suitable value and optionally some diagnostics. If the
|
|
|
|
// returned diagnostics contains errors then the type of the returned value is
|
|
|
|
// used to construct an unknown value of the same type which is then used in
|
|
|
|
// place of the requested object so that type checking can still proceed. In
|
|
|
|
// cases where it's not possible to even determine a suitable result type,
|
|
|
|
// cty.DynamicVal is returned along with errors describing the problem.
|
|
|
|
type Data interface {
|
2018-11-21 02:25:05 +01:00
|
|
|
StaticValidateReferences(refs []*addrs.Reference, self addrs.Referenceable) tfdiags.Diagnostics
|
|
|
|
|
2018-04-04 03:11:28 +02:00
|
|
|
GetCountAttr(addrs.CountAttr, tfdiags.SourceRange) (cty.Value, tfdiags.Diagnostics)
|
2019-06-12 17:07:32 +02:00
|
|
|
GetForEachAttr(addrs.ForEachAttr, tfdiags.SourceRange) (cty.Value, tfdiags.Diagnostics)
|
2019-08-24 01:20:47 +02:00
|
|
|
GetResource(addrs.Resource, tfdiags.SourceRange) (cty.Value, tfdiags.Diagnostics)
|
2018-04-04 03:11:28 +02:00
|
|
|
GetLocalValue(addrs.LocalValue, tfdiags.SourceRange) (cty.Value, tfdiags.Diagnostics)
|
2020-04-12 16:43:41 +02:00
|
|
|
GetModule(addrs.ModuleCall, tfdiags.SourceRange) (cty.Value, tfdiags.Diagnostics)
|
2018-04-04 03:11:28 +02:00
|
|
|
GetPathAttr(addrs.PathAttr, tfdiags.SourceRange) (cty.Value, tfdiags.Diagnostics)
|
|
|
|
GetTerraformAttr(addrs.TerraformAttr, tfdiags.SourceRange) (cty.Value, tfdiags.Diagnostics)
|
|
|
|
GetInputVariable(addrs.InputVariable, tfdiags.SourceRange) (cty.Value, tfdiags.Diagnostics)
|
|
|
|
}
|