Description
Alibaba Cloud provider 1.293.0 rejects address at the top level of alicloud_db_instance. Use security_ips to restrict source addresses on the MySQL instance.
Potential impact
An unsupported attribute prevents Terraform validation. An overly broad effective IP allow-list can let unwanted clients with a network path attempt to log in.
Remediation
Remove the top-level address, set security_ips to required client IPs or the smallest required CIDRs, and run terraform validate. In a PostgreSQL pg_hba_conf.address rule, 0.0.0.0/0 covers all IPv4 sources for the named users and databases. Check its authentication method as well.
Examples
The second MySQL excerpt allows one address, 10.23.12.24/32. Supply the real client IP, virtual switch and an engine, instance class and storage size supported in the Region. If a public endpoint is unnecessary, establish the internal route first. Test both allowed and denied connections after the change.
Unsupported attribute
resource "alicloud_db_instance" "example" {
engine = "MySQL"
engine_version = var.engine_version
instance_type = var.instance_type
instance_storage = var.instance_storage
instance_charge_type = "Postpaid"
instance_name = var.name
vswitch_id = alicloud_vswitch.example.id
monitoring_period = "60"
address = "0.0.0.0/0"
}
Supported IP allow-list
resource "alicloud_db_instance" "example" {
engine = "MySQL"
engine_version = var.engine_version
instance_type = var.instance_type
instance_storage = var.instance_storage
instance_charge_type = "Postpaid"
instance_name = var.name
vswitch_id = alicloud_vswitch.example.id
monitoring_period = "60"
security_ips = ["10.23.12.24/32"]
}