Documentation ¶
Overview ¶
Package lang is a fork of Terraform's internal/lang package.
This package provides helpers that interprets the Terraform Language's semantics in more detail than the HCL Language.
For example, ReferencesInExpr returns a set of references, such as input variables and resources, rather than just a set of hcl.Traversal, filtering out invalid references.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func References ¶
References finds all of the references in the given set of traversals, returning diagnostics if any of the traversals cannot be interpreted as a reference.
This function does not do any de-duplication of references, since references have source location information embedded in them and so any invalid references that are duplicated should have errors reported for each occurence.
If the returned diagnostics contains errors then the result may be incomplete or invalid. Otherwise, the returned slice has one reference per given traversal, though it is not guaranteed that the references will appear in the same order as the given traversals.
func ReferencesInExpr ¶
ReferencesInExpr is a helper wrapper around References that first searches the given expression for traversals, before converting those traversals to references.
This function is almost identical to the Terraform internal API of the same name, except that it does not return diagnostics if it contains an invalid reference. This is because expressions with invalid traversals as references, such as `ignore_changes`, may be parsed. Developers should take advantage of the possible incomplete results returned by this function.
Low-level APIs such as addrs.ParseRef are recommended if the expression is guaranteed not to contain invalid traversals, and analysis should stop in that case.
Types ¶
This section is empty.