modulecontent

package
v0.0.0-...-d97564e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package modulecontent provides a simple interface to extract the partial content from a Terraform module.

Index

Constants

This section is empty.

Variables

View Source
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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL