Skip to content

Commit a00ef87

Browse files
committed
RED: add test case for function calls
1 parent 7686cce commit a00ef87

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

provisioner/terraform/tfparse/tfparse_test.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,35 @@ func Test_WorkspaceTagDefaultsFromFile(t *testing.T) {
299299
// TODO: this error isn't great, but it has the desired effect.
300300
expectError: `There is no variable named "foo_bar"`,
301301
},
302+
{
303+
name: "main.tf with functions in workspace tags",
304+
files: map[string]string{
305+
"main.tf": `
306+
provider "foo" {}
307+
resource "foo_bar" "baz" {
308+
name = "foobar"
309+
}
310+
variable "region" {
311+
type = string
312+
default = "region.us"
313+
}
314+
data "coder_parameter" "az" {
315+
name = "az"
316+
type = "string"
317+
default = "az.a"
318+
}
319+
data "coder_workspace_tags" "tags" {
320+
tags = {
321+
"platform" = "kubernetes",
322+
"cluster" = "${"devel"}${"opers"}"
323+
"region" = try(split(".", var.region)[1], "placeholder")
324+
"az" = try(split(".", data.coder_parameter.az.value)[1], "placeholder")
325+
}
326+
}`,
327+
},
328+
expectTags: map[string]string{"platform": "kubernetes", "cluster": "developers", "region": "us", "az": "a"},
329+
expectError: ``,
330+
},
302331
} {
303332
tc := tc
304333
t.Run(tc.name+"/tar", func(t *testing.T) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy