-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsecurity_groups.tf
54 lines (49 loc) · 1.81 KB
/
security_groups.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
##############################################################################
# Create a map of VPE security groups
##############################################################################
module "vpe_security_group_map" {
source = "github.com/Cloud-Schematics/list-to-map"
list = [
for network in var.vpcs_create_endpoint_gateway_on_vpe_tier :
{
network = network
tier = "vpe"
name = "${network}-vpe"
}
]
}
##############################################################################
##############################################################################
# Create a Security Group for each VSI deployment
##############################################################################
module "security_groups" {
source = "github.com/Cloud-Schematics/vpc-security-group-module"
for_each = merge(module.vsi_deployment_map.value, module.vpe_security_group_map.value)
prefix = var.prefix
tags = var.tags
vpc_id = module.icse_vpc_network.vpc_networks[each.value.network].id
security_groups = [
{
name = "${each.value.name}-sg"
rules = flatten([
[
for cidr in var.quickstart_security_group_inbound_allow_list :
{
name = "${each.value.name}-sg-allow-in-${index(var.quickstart_security_group_inbound_allow_list, cidr) + 1}"
direction = "inbound"
remote = cidr
}
],
[
for cidr in var.quickstart_security_group_outbound_allow_list :
{
name = "${each.value.name}-sg-allow-out-${index(var.quickstart_security_group_outbound_allow_list, cidr) + 1}"
direction = "outbound"
remote = cidr
}
]
])
}
]
}
##############################################################################