Skip to content

Commit a104f32

Browse files
committed
update documentation
1 parent c8f74da commit a104f32

2 files changed

Lines changed: 52 additions & 6 deletions

File tree

docs/modules/reference/pages/blocks/variable.adoc

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,75 @@ You must specify the variable `name` as the block label.
1919
|type
2020
|type
2121
|Yes
22-
|The type of the variable. (e.g., `string`, `number`, `boolean`).
22+
|The type of the variable. (e.g., `string`, `boolean`, `list(T)`).
2323
|===
2424

25+
== Supported Types
26+
27+
- `+string+`
28+
- `+number+`
29+
- `+boolean+`
30+
- `+any+`
31+
- `+list(T)+`
32+
- `+set(T)+`
33+
- `+map(T)+`
34+
- `+object({ K = T })+`
35+
- `+tuple([ T... ])+`
36+
2537
Example:
2638

2739
[source,hcl]
2840
----
2941
variable "mystringvar" {
3042
type = string
3143
}
32-
----
3344
34-
[source,hcl]
35-
----
3645
variable "mynumvar" {
3746
type = number
3847
}
48+
49+
variable "mylistvar" {
50+
type = list(string)
51+
default = ["foo"]
52+
}
53+
54+
variable "mymapvar" {
55+
type = map(number)
56+
default = { a = 1 }
57+
}
58+
59+
variable "myobjvar" {
60+
type = object({ hostname = string, port = number })
61+
}
62+
63+
variable "mytuplevar" {
64+
type = tuple([string, number])
65+
default = ["a", 1]
66+
}
67+
68+
variable "mynestedvar" {
69+
type = list(map(object({title = string, greetings = list(string) })))
70+
default = [
71+
{
72+
"Fred" = {
73+
title = "Mr",
74+
greetings = ["hello", "sup"]
75+
}
76+
},
77+
{
78+
"World" = {
79+
title = "The",
80+
greetings = ["hello", "hey"]
81+
}
82+
}
83+
]
84+
}
3985
----
4086

4187
Outside of templates, variables can be referenced using the `var.myvar` syntax.
4288
Inside templates, variables can be referenced using `${var.myvar}`.
4389

44-
Example:
90+
Examples:
4591

4692
[source,hcl]
4793
----

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"devDependencies": {
2+
"dependencies": {
33
"antora": "3.1.10"
44
}
55
}

0 commit comments

Comments
 (0)