1
0

feat: added ipv6 support to egress sg rule

This commit is contained in:
xpk
2026-02-19 18:12:58 +08:00
parent fd8d141662
commit d10189df7a
+2 -1
View File
@@ -32,7 +32,8 @@ resource "aws_vpc_security_group_egress_rule" "egress-rules" {
ip_protocol = split(",", each.value)[0]
from_port = split(",", each.value)[1]
to_port = split(",", each.value)[2]
cidr_ipv4 = substr(split(",", each.value)[3], 2, 1) != "-" ? split(",", each.value)[3] : null
cidr_ipv4 = can(regex("^([0-9]+\\.){3}[0-9]+\\/[0-9]+$", split(",", each.value)[3])) ? split(",", each.value)[3] : null # substr(split(",", each.value)[3], 2, 1) != "-" ? split(",", each.value)[3] : null
cidr_ipv6 = strcontains(split(",", each.value)[3], "::") ? split(",", each.value)[3] : null
referenced_security_group_id = substr(split(",", each.value)[3], 0, 2) == "sg" ? split(",", each.value)[3] : null
prefix_list_id = substr(split(",", each.value)[3], 0, 2) == "pl" ? split(",", each.value)[3] : null
description = split(",", each.value)[4]