diff --git a/variables/complex_types/README.md b/variables/complex_types/README.md new file mode 100644 index 00000000..41978d7f --- /dev/null +++ b/variables/complex_types/README.md @@ -0,0 +1,7 @@ +# Complex Types + +A complex type is a type that groups multiple values into a single value. Complex types are represented by type constructors, but several of them also have shorthand keyword versions. + +There are two categories of complex types: collection types (for grouping similar values), and structural types (for grouping potentially dissimilar values). + +https://www.terraform.io/docs/language/expressions/type-constraints.html#complex-types diff --git a/variables/complex_types/main.tf b/variables/complex_types/main.tf new file mode 100644 index 00000000..0306d699 --- /dev/null +++ b/variables/complex_types/main.tf @@ -0,0 +1,16 @@ +variable "structural-type" { + type = object({ + object = object({ + string = string + number = number + bool = bool + }), + list = list(any), + map = map(string), + set = set(number) + }) +} + +output "structural-type" { + value = var.structural-type +}