8000 feat(provisioner/terraform/tfparse): implement WorkspaceTagDefaultsFromFile by johnstcn · Pull Request #15236 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

feat(provisioner/terraform/tfparse): implement WorkspaceTagDefaultsFromFile #15236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Nov 14, 2024
Merged
Prev Previous commit
Next Next commit
RED: add test case for function calls
  • Loading branch information
johnstcn committed Nov 11, 2024
commit 37ec3e0957f4cab2bfc5fc209745db6653d4a00a
29 changes: 29 additions & 0 deletions provisioner/terraform/tfparse/tfparse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,35 @@ func Test_WorkspaceTagDefaultsFromFile(t *testing.T) {
// TODO: this error isn't great, but it has the desired effect.
expectError: `There is no variable named "foo_bar"`,
},
{
name: "main.tf with functions in workspace tags",
files: map[string]string{
"main.tf": `
provider "foo" {}
resource "foo_bar" "baz" {
name = "foobar"
}
variable "region" {
type = string
default = "region.us"
}
data "coder_parameter" "az" {
name = "az"
type = "string"
default = "az.a"
}
data "coder_workspace_tags" "tags" {
tags = {
"platform" = "kubernetes",
"cluster" = "${"devel"}${"opers"}"
"region" = try(split(".", var.region)[1], "placeholder")
"az" = try(split(".", data.coder_parameter.az.value)[1], "placeholder")
}
}`,
},
expectTags: map[string]string{"platform": "kubernetes", "cluster": "developers", "region": "us", "az": "a"},
expectError: ``,
},
} {
tc := tc
t.Run(tc.name+"/tar", func(t *testing.T) {
Expand Down
0