2023-04-26 18:00:32 +00:00
|
|
|
resource "root" "range:index:Root" {}
|
|
|
|
|
|
|
|
// creating resources by iterating a property of type array(string) of another resource
|
|
|
|
resource "fromListOfStrings" "range:index:Example" {
|
|
|
|
options {
|
|
|
|
range = root.arrayOfString
|
2023-04-21 10:18:23 +00:00
|
|
|
}
|
2023-04-26 18:00:32 +00:00
|
|
|
|
|
|
|
someString = range.value
|
2023-04-21 10:18:23 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 18:00:32 +00:00
|
|
|
// creating resources by iterating a property of type map(string) of another resource
|
|
|
|
resource "fromMapOfStrings" "range:index:Example" {
|
2023-04-21 10:18:23 +00:00
|
|
|
options {
|
2023-04-26 18:00:32 +00:00
|
|
|
range = root.mapOfString
|
2023-04-21 10:18:23 +00:00
|
|
|
}
|
2023-04-26 18:00:32 +00:00
|
|
|
|
|
|
|
someString = "${range.key} ${range.value}"
|
|
|
|
}
|
|
|
|
|
|
|
|
// computed range list expression to create instances of range:index:Example resource
|
|
|
|
resource "fromComputedListOfStrings" "range:index:Example" {
|
|
|
|
options {
|
|
|
|
range = [
|
|
|
|
root.mapOfString["hello"],
|
|
|
|
root.mapOfString["world"]
|
|
|
|
]
|
2023-04-21 10:18:23 +00:00
|
|
|
}
|
2023-04-26 18:00:32 +00:00
|
|
|
|
|
|
|
someString = "${range.key} ${range.value}"
|
|
|
|
}
|
|
|
|
|
|
|
|
// computed range for expression to create instances of range:index:Example resource
|
|
|
|
resource "fromComputedForExpression" "range:index:Example" {
|
|
|
|
options {
|
|
|
|
range = [for value in root.arrayOfString : root.mapOfString[value]]
|
|
|
|
}
|
|
|
|
|
|
|
|
someString = "${range.key} ${range.value}"
|
2023-04-21 10:18:23 +00:00
|
|
|
}
|