tfhcl

package
v0.44.0 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2022 License: MPL-2.0, MPL-2.0, MPL-2.0 Imports: 8 Imported by: 0

README

Forked hcl/ext/dynblock package

This package is a fork of github.com/hashicorp/hcl/ext/dynblock. TFLint maintains its own dynblock implementation to support not only dynamic blocks, but also count/for_each meta-arguments in the HCL layer.

Documentation

Overview

Package tfhcl is a fork of hcl/ext/dynblock. Like dynblock, it supports dynamic block expansion, but also resource expansion via count/for_each meta-arguments. This package is defined separately from hclext because meta-arguments are a Terraform concern.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Expand

func Expand(body hcl.Body, ctx *hcl.EvalContext) hcl.Body

Expand "dynamic" blocks and count/for_for_each meta-arguments resources in the given body, returning a new body that has those blocks expanded.

The given EvalContext is used when evaluating attributes within the given body. If the body has a dynamic block or an expandable resource, its contents are evaluated immediately.

Expand returns no diagnostics because no blocks are actually expanded until a call to Content or PartialContent on the returned body, which will then expand only the blocks selected by the schema.

func ExpandVariablesHCLExt

func ExpandVariablesHCLExt(body hcl.Body, schema *hclext.BodySchema) []hcl.Traversal

ExpandVariablesHCLExt is a wrapper around dynblock.WalkVariables that uses the given hclext.BodySchema to automatically drive the recursive walk through nested blocks in the given body.

Note that it's a wrapper around ExpandVariables, not WalkExpandVariables. This package evaluates expressions immediately on expansion, so we always need all variables to expand. It also implicitly walks count/for_each to support expansion by meta-arguments.

func MakeCountIteration

func MakeCountIteration(index cty.Value) *metaArgIteration

func MakeForEachIteration

func MakeForEachIteration(key, value cty.Value) *metaArgIteration

Types

This section is empty.

Jump to

Keyboard shortcuts

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