Description
In alicloud_db_instance.security_ips, 0.0.0.0/0 puts every IPv4 source on the allow-list. RDS for MySQL treats 0.0.0.0 on its own as invalid.
Potential impact
With a public endpoint and a network path, unintended clients can attempt connections. Database authentication and privileges still govern data access.
Remediation
Replace unrestricted or invalid entries with the client IPs or CIDRs you need. For clients behind NAT, use the translated source IP. Check the allow-list’s network type and access granted by either the list or security groups. Use an internal endpoint when public access is unnecessary.
Examples
Adding a private range alongside 0.0.0.0/0 leaves all IPv4 sources on the first list. The second allows one address. Supply the actual addresses and supported engine, class and storage settings, and review connect_timeout. Inspect the plan, then test encrypted application and admin connections and verify that unapproved sources are denied.
Allowing all IPv4 addresses
resource "alicloud_db_instance" "default" {
engine = "MySQL"
engine_version = var.engine_version
instance_type = var.instance_type
instance_storage = var.instance_storage
security_ips = ["0.0.0.0/0", "10.23.12.0/24"]
parameters {
name = "connect_timeout"
value = "50"
}
}
Allowing only a required client
resource "alicloud_db_instance" "default" {
engine = "MySQL"
engine_version = var.engine_version
instance_type = var.instance_type
instance_storage = var.instance_storage
security_ips = ["10.23.12.24"]
parameters {
name = "connect_timeout"
value = "50"
}
}