Description
If the router’s security_group is omitted, check its actual security group and routes. Together they determine which traffic can pass between the attached networks.
Potential impact
Broad rules can open unwanted paths. Removing a required rule can interrupt services that use the router.
Remediation
Set security_group on nifcloud_router to the group name. Allow only the required directions, addresses, protocols and ports. After applying, test that traffic passes on approved paths and is blocked on others.
Examples
Both excerpts attach to net-COMMON_GLOBAL. Define the router group, its rules and the routes separately.
Before
hcl
resource "nifcloud_router" "edge_router" {
network_interface {
network_id = "net-COMMON_GLOBAL"
}
}
After
hcl
resource "nifcloud_router" "edge_router" {
security_group = nifcloud_security_group.router.group_name
network_interface {
network_id = "net-COMMON_GLOBAL"
}
}