Documentation ¶
Overview ¶
Package modulecontent provides a simple interface to extract the partial content from a Terraform module.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var AppFs = afero.Afero{ Fs: afero.NewOsFs(), }
AppFs is the virtual filesystem we use to that we can mock testing with the real Terraform evaluator, bypassing the tflint test runner.
Functions ¶
func FetchAttributes ¶
func FetchAttributes(f BlockFetcher, runner tflint.Runner) (*terraform.Evaluator, []*hclext.Attribute, hcl.Diagnostics)
FetchResources fetches the attributes of given resource type and the attribute if they exist.
func FetchBlocks ¶
func FetchBlocks(f BlockFetcher, runner tflint.Runner) (*terraform.Evaluator, []*hclext.Block, hcl.Diagnostics)
FetchBlocks returns a slice of resources with the given resource type and the attribute if they exist.
Types ¶
type BlockFetcher ¶
type BlockFetcher interface { BlockType() string // The type of block to fetch, e.g. `resource`. LabelOne() string // The value of the first label of the block to fetch, e.g. `azapi_resource`. LabelNames() []string // The labels of the block to fetch, e.g. `["type", "name"]` for Terraform resources. Attributes() []string // The attributes to fetch from the block. }
BlockFetcher is an interface that permits partial content to be evaluated within a Terraform module. If a tflint rule satisfies this interface it can use the FetchResources and FetchAttributes functions to retrieve the resources and attributes of a given resource type.