-
Notifications
You must be signed in to change notification settings - Fork 3
/
function.tf
45 lines (37 loc) · 1.16 KB
/
function.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// output "function" {
// value = "${function-name(" ")}"
// }
//file function:
output "printfile_function" {
value = file("${path.module}/README.md")
}
//lookup function:
output "lookup_function" {
value = lookup("${var.map-var}", "age", "key not found")
}
//Merging multiple strings into a single string
output "string_merger" {
value = join(",", ["CLoudb", "DevOps", "Azure", "AWS", "GCP"]) //string elements given in a list
}
//Converting a map into a list
output "map_into_list" {
value = values( //values function gives a list of values while key function returns a list of keys
{
a = 10,
b = 12,
c = 13
}
)
}
//Merge Mutiple map into one map
output "multi_map_merge" {
value = merge({ env = "dev", project = "cbx" }, { billing = "abc@gmail.com", location = "us-east-1" })
}
//separate the scheme from the given url
output "separate_scheme_and_authority" {
value = regex("^(?:(?P<scheme>[^:/?#]+):)?(?://(?P<authority>[^/?#]*))?", "https://cignoclouds.com")
}
//Join two lists into a single using concat function
output "joining_two_lists" {
value = concat(["1", "2", "3", "4", "5", "6", "7", "8"], ["a", "b", "c", "d", "e", "f"])
}