Description
If the template omits security_group, check which security group and rules apply to the deployed instance.
Potential impact
Broad rules can expose management or internal services. Missing rules can interrupt the application.
Remediation
Set security_group on nifcloud_instance to the group name. Limit its sources, destinations and ports, and retain the host firewall and service authentication. After applying, test that approved clients can connect and others are blocked.
Examples
Both excerpts keep net-COMMON_GLOBAL. Supply the referenced image and the app group with its rules.
Before
hcl
resource "nifcloud_instance" "app_server" {
image_id = data.nifcloud_image.ubuntu.id
network_interface {
network_id = "net-COMMON_GLOBAL"
}
}
After
hcl
resource "nifcloud_instance" "app_server" {
image_id = data.nifcloud_image.ubuntu.id
security_group = nifcloud_security_group.app.group_name
network_interface {
network_id = "net-COMMON_GLOBAL"
}
}