1
0
Fork 0
terraform-training/project2/base.tf

48 lines
666 B
Terraform
Raw Normal View History

2020-05-12 12:17:38 +02:00
terraform {
experiments = [
variable_validation
]
}
variable "a" {
validation {
condition = can(regex("foo|aze|qsd", var.a))
error_message = "Valid values are foo, aze, qsd."
}
}
2020-05-12 10:36:59 +02:00
variable "b" {
default = "test"
}
2020-05-12 11:36:42 +02:00
variable "c" {
type = list
default = ["foo", "bar", "baz"]
}
2020-05-12 11:49:29 +02:00
variable "d" {
type = map
default = {
"foo" = "bar"
"aze" = "rty"
"qsd" = "fgh"
}
}
2020-05-12 10:36:59 +02:00
output "ov1" {
value = "${var.a}"
}
output "ov2" {
value = "${var.b}"
}
2020-05-12 11:36:42 +02:00
output "ov3" {
value = "${var.c[2]}"
}
2020-05-12 11:49:29 +02:00
output "ov4" {
2020-05-12 12:17:38 +02:00
value = "${var.d}"
}
output "ov4_foo" {
2020-05-12 11:49:29 +02:00
value = "${var.d.foo}"
}
2020-05-12 12:17:38 +02:00
output "ov4_lookup" {
value = "${lookup(var.d, var.a)}"
}