Skip to content

Commit e9fd608

Browse files
committed
chore!: use map over list for template tf_vars & provisioner_tags
1 parent 9321b39 commit e9fd608

File tree

5 files changed

+811
-302
lines changed

5 files changed

+811
-302
lines changed

examples/provider/provider.tf

+3-4
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,9 @@ resource "coderd_template" "example" {
3838
versions = [{
3939
directory = "./example-template"
4040
active = true
41-
tf_vars = [{
42-
name = "image_id"
43-
value = "ami-12345678"
44-
}]
41+
tf_vars = {
42+
"image_id" = "ami-12345678"
43+
}
4544
# Version names can be randomly generated if null/omitted
4645
}]
4746
acl = {

integration/template-test/main.tf

+6-12
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,16 @@ resource "coderd_template" "sample" {
4343
{
4444
directory = "./example-template-2"
4545
active = true
46-
tf_vars = [
47-
{
48-
name = "name"
49-
value = "world"
50-
},
51-
]
46+
tf_vars = {
47+
name = "world"
48+
}
5249
},
5350
{
5451
directory = "./example-template-2"
5552
active = false
56-
tf_vars = [
57-
{
58-
name = "name"
59-
value = "ethan"
60-
},
61-
]
53+
tf_vars = {
54+
name = "ethan"
55+
}
6256
}
6357
]
6458
}

internal/provider/template_data_source_test.go

+2-5
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,8 @@ func TestAccTemplateDataSource(t *testing.T) {
3434
Name: types.StringValue("main"),
3535
Message: types.StringValue("Initial commit"),
3636
Directory: types.StringValue("../../integration/template-test/example-template/"),
37-
TerraformVariables: []Variable{
38-
{
39-
Name: types.StringValue("name"),
40-
Value: types.StringValue("world"),
41-
},
37+
TerraformVariables: map[string]string{
38+
"name": "world",
4239
},
4340
},
4441
})

0 commit comments

Comments
 (0)