feat(provisioner/terraform/tfparse): add support for built-in Terraform functions (#16183)

Relates to https://github.com/coder/coder/issues/15977

Adds support for some functions in `tfparse` (only functions that do not
reference local files).
NOTE: for now, I'm importing trivy-iac. If we prefer to avoid a little
dependency, I can do a little copying instead.
This commit is contained in:
Cian Johnston
2025-01-20 11:03:57 +00:00
committed by GitHub
parent 7bef4dfda6
commit 4ba0b39f03
6 changed files with 222 additions and 5 deletions

View File

@ -489,11 +489,11 @@ func TestPostTemplateVersionsByOrganization(t *testing.T) {
"foo": "bar",
"a": var.a,
"b": data.coder_parameter.b.value,
"test": try(null_resource.test.name, "whatever"),
"test": pathexpand("~/file.txt"),
}
}`,
},
expectError: `Function calls not allowed; Functions may not be called here.`,
expectError: `function "pathexpand" may not be used here`,
},
// We will allow coder_workspace_tags to set the scope on a template version import job
// BUT the user ID will be ultimately determined by the API key in the scope.