ucloud/terraform-provider-ucloud

foreach not supported by resource ucloud_security_group.

hanyouqing opened this issue · 0 comments

I have my own security group rule defined as a map in variables file, just like:

xxx_sg_rules = {
    beijing = [
      {
        "priority"    = "medium"
        "type"        = "ingress"
        "ip_protocol" = "icmp"
        "port_range"  = "1-65535"
        "source"      = "0.0.0.0/0"
        "policy"      = "accept"
        "description" = "ICMP"
      },
     {
     ........
     }
...

i'm trying to define rules in ucloud_security_group like:

foreach rule in xxx_sg_rules.beijing:
rules {
 port_range = rule.port_range
 .....
}

and got some errors, it seems like ucloud doesn't support foreach and for yet.

I'm using count as an alternative for now, if someone else has the same problem with me could have a try. (As ucloud_instance doesn't support bind mutiple security_group, this solution doesn't work, see #76)