MCPcopy
hub / github.com/hashicorp/hcl / Expand

Function Expand

ext/dynblock/public.go:45–54  ·  view source on GitHub ↗

Expand "dynamic" blocks in the given body, returning a new body that has those blocks expanded. The given EvalContext is used when evaluating "for_each" and "labels" attributes within dynamic blocks, allowing those expressions access to variables and functions beyond the iterator variable created b

(body hcl.Body, ctx *hcl.EvalContext, opts ...ExpandOption)

Source from the content-addressed store, hash-verified

43// }
44// }
45func Expand(body hcl.Body, ctx *hcl.EvalContext, opts ...ExpandOption) hcl.Body {
46 ret := &expandBody{
47 original: body,
48 forEachCtx: ctx,
49 }
50 for _, opt := range opts {
51 opt.applyExpandOption(ret)
52 }
53 return ret
54}

Callers 7

TestTerraformLikeFunction · 0.92
TestExpandFunction · 0.85
TestExpandUnknownBodiesFunction · 0.85
TestExpandMarkedForEachFunction · 0.85
expandChildMethod · 0.85

Calls 1

applyExpandOptionMethod · 0.65

Tested by 6

TestTerraformLikeFunction · 0.74
TestExpandFunction · 0.68
TestExpandUnknownBodiesFunction · 0.68
TestExpandMarkedForEachFunction · 0.68