Hi
Is there anyway to lookup a list variable from a map or achieve the same end in another programmatic way?
I am building AWS ec2 instances with ‘vcp_security_groups_ids’ which will only except lists.
I have two list vars and want to select either of the whole lists based on a parameter. the below gives an idea of what I am trying to achieve but I can’t use lists in a map either as a var or entered as a list of values.
variable “sg1” {
type=“list”
default = [“sg-12345”,“sg-12346”]
}
variable “sg2” {
type=“list”
default = [“sg-22345”,“sg-22346”]
}
variable “sg” {
type=“map”
default{
1 = “{$var.sg1}”
2 = “{$var.sg1}”
}}
vcp_security_groups_ids = “${lookup(var.sg,var.example)}”
Thanks
Steve