Skip to content

Commit 9214bd4

Browse files
committed
clarify lack of function support
1 parent a00ef87 commit 9214bd4

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

provisioner/terraform/tfparse/tfextract.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,11 @@ func buildEvalContext(varDefaults map[string]string, paramDefaults map[string]st
341341

342342
evalCtx := &hcl.EvalContext{
343343
Variables: map[string]cty.Value{},
344+
// NOTE: we do not currently support function execution here.
345+
// The default function map for Terraform is not exposed, so we would essentially
346+
// have to re-implement or copy the entire map or a subset thereof.
347+
// ref: https://github.com/hashicorp/terraform/blob/e044e569c5bc81f82e9a4d7891f37c6fbb0a8a10/internal/lang/functions.go#L54
348+
Functions: nil,
344349
}
345350
if len(varDefaultsM) != 0 {
346351
evalCtx.Variables["var"] = cty.MapVal(varDefaultsM)

provisioner/terraform/tfparse/tfparse_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,8 @@ func Test_WorkspaceTagDefaultsFromFile(t *testing.T) {
325325
}
326326
}`,
327327
},
328-
expectTags: map[string]string{"platform": "kubernetes", "cluster": "developers", "region": "us", "az": "a"},
329-
expectError: ``,
328+
expectTags: nil,
329+
expectError: `Function calls not allowed; Functions may not be called here.`,
330330
},
331331
} {
332332
tc := tc

0 commit comments

Comments
 (0)