|
| 1 | +module "sg" { |
| 2 | + source = "../../" |
| 3 | + |
| 4 | + create = var.create |
| 5 | + name = var.name |
| 6 | + use_name_prefix = var.use_name_prefix |
| 7 | + description = var.description |
| 8 | + vpc_id = var.vpc_id |
| 9 | + revoke_rules_on_delete = var.revoke_rules_on_delete |
| 10 | + tags = var.tags |
| 11 | + |
| 12 | + ########## |
| 13 | + # Ingress |
| 14 | + ########## |
| 15 | + # Rules by names - open for default CIDR |
| 16 | + ingress_rules = sort(compact(distinct(concat(var.auto_ingress_rules, var.ingress_rules, [""])))) |
| 17 | + |
| 18 | + # Open for self |
| 19 | + ingress_with_self = concat(var.auto_ingress_with_self, var.ingress_with_self) |
| 20 | + |
| 21 | + # Open to IPv4 cidr blocks |
| 22 | + ingress_with_cidr_blocks = var.ingress_with_cidr_blocks |
| 23 | + |
| 24 | + # Open to IPv6 cidr blocks |
| 25 | + ingress_with_ipv6_cidr_blocks = var.ingress_with_ipv6_cidr_blocks |
| 26 | + |
| 27 | + # Open for security group id |
| 28 | + ingress_with_source_security_group_id = var.ingress_with_source_security_group_id |
| 29 | + |
| 30 | + # Default ingress CIDR blocks |
| 31 | + ingress_cidr_blocks = var.ingress_cidr_blocks |
| 32 | + ingress_ipv6_cidr_blocks = var.ingress_ipv6_cidr_blocks |
| 33 | + |
| 34 | + # Default prefix list ids |
| 35 | + ingress_prefix_list_ids = var.ingress_prefix_list_ids |
| 36 | + |
| 37 | + ################### |
| 38 | + # Computed Ingress |
| 39 | + ################### |
| 40 | + # Rules by names - open for default CIDR |
| 41 | + computed_ingress_rules = sort(compact(distinct(concat(var.auto_computed_ingress_rules, var.computed_ingress_rules, [""])))) |
| 42 | + |
| 43 | + # Open for self |
| 44 | + computed_ingress_with_self = concat(var.auto_computed_ingress_with_self, var.computed_ingress_with_self) |
| 45 | + |
| 46 | + # Open to IPv4 cidr blocks |
| 47 | + computed_ingress_with_cidr_blocks = var.computed_ingress_with_cidr_blocks |
| 48 | + |
| 49 | + # Open to IPv6 cidr blocks |
| 50 | + computed_ingress_with_ipv6_cidr_blocks = var.computed_ingress_with_ipv6_cidr_blocks |
| 51 | + |
| 52 | + # Open for security group id |
| 53 | + computed_ingress_with_source_security_group_id = var.computed_ingress_with_source_security_group_id |
| 54 | + |
| 55 | + ############################# |
| 56 | + # Number of computed ingress |
| 57 | + ############################# |
| 58 | + number_of_computed_ingress_rules = var.auto_number_of_computed_ingress_rules + var.number_of_computed_ingress_rules |
| 59 | + number_of_computed_ingress_with_self = var.auto_number_of_computed_ingress_with_self + var.number_of_computed_ingress_with_self |
| 60 | + number_of_computed_ingress_with_cidr_blocks = var.number_of_computed_ingress_with_cidr_blocks |
| 61 | + number_of_computed_ingress_with_ipv6_cidr_blocks = var.number_of_computed_ingress_with_ipv6_cidr_blocks |
| 62 | + number_of_computed_ingress_with_source_security_group_id = var.number_of_computed_ingress_with_source_security_group_id |
| 63 | + |
| 64 | + ######### |
| 65 | + # Egress |
| 66 | + ######### |
| 67 | + # Rules by names - open for default CIDR |
| 68 | + egress_rules = sort(compact(distinct(concat(var.auto_egress_rules, var.egress_rules, [""])))) |
| 69 | + |
| 70 | + # Open for self |
| 71 | + egress_with_self = concat(var.auto_egress_with_self, var.egress_with_self) |
| 72 | + |
| 73 | + # Open to IPv4 cidr blocks |
| 74 | + egress_with_cidr_blocks = var.egress_with_cidr_blocks |
| 75 | + |
| 76 | + # Open to IPv6 cidr blocks |
| 77 | + egress_with_ipv6_cidr_blocks = var.egress_with_ipv6_cidr_blocks |
| 78 | + |
| 79 | + # Open for security group id |
| 80 | + egress_with_source_security_group_id = var.egress_with_source_security_group_id |
| 81 | + |
| 82 | + # Default egress CIDR blocks |
| 83 | + egress_cidr_blocks = var.egress_cidr_blocks |
| 84 | + egress_ipv6_cidr_blocks = var.egress_ipv6_cidr_blocks |
| 85 | + |
| 86 | + # Default prefix list ids |
| 87 | + egress_prefix_list_ids = var.egress_prefix_list_ids |
| 88 | + |
| 89 | + ################## |
| 90 | + # Computed Egress |
| 91 | + ################## |
| 92 | + # Rules by names - open for default CIDR |
| 93 | + computed_egress_rules = sort(compact(distinct(concat(var.auto_computed_egress_rules, var.computed_egress_rules, [""])))) |
| 94 | + |
| 95 | + # Open for self |
| 96 | + computed_egress_with_self = concat(var.auto_computed_egress_with_self, var.computed_egress_with_self) |
| 97 | + |
| 98 | + # Open to IPv4 cidr blocks |
| 99 | + computed_egress_with_cidr_blocks = var.computed_egress_with_cidr_blocks |
| 100 | + |
| 101 | + # Open to IPv6 cidr blocks |
| 102 | + computed_egress_with_ipv6_cidr_blocks = var.computed_egress_with_ipv6_cidr_blocks |
| 103 | + |
| 104 | + # Open for security group id |
| 105 | + computed_egress_with_source_security_group_id = var.computed_egress_with_source_security_group_id |
| 106 | + |
| 107 | + ############################# |
| 108 | + # Number of computed egress |
| 109 | + ############################# |
| 110 | + number_of_computed_egress_rules = var.auto_number_of_computed_egress_rules + var.number_of_computed_egress_rules |
| 111 | + number_of_computed_egress_with_self = var.auto_number_of_computed_egress_with_self + var.number_of_computed_egress_with_self |
| 112 | + number_of_computed_egress_with_cidr_blocks = var.number_of_computed_egress_with_cidr_blocks |
| 113 | + number_of_computed_egress_with_ipv6_cidr_blocks = var.number_of_computed_egress_with_ipv6_cidr_blocks |
| 114 | + number_of_computed_egress_with_source_security_group_id = var.number_of_computed_egress_with_source_security_group_id |
| 115 | +} |
0 commit comments