how can I assign static ip address (from my VPC) to google_sql_database_instance?
tf docco: Private Ip Instance offers google_service_networking_connection usage, but that doesn’t allow to assign definite ip address to the instance but the range
so, can I somehow get a definite static ip address (perhaps reserved from my VPC addresses with google_compute_address) assigned to google_sql_database_instance?
However, if it’s an option I recommend not worrying about what the IP is and just tying it to a private Cloud DNS record instead. That feels less brittle to me.
resource "google_dns_record_set" "sql_dns" {
name = "sql.fqdn.com"
project = var.project_id
managed_zone = var.private_dns_zone_name
type = "A"
ttl = 300
rrdatas = [google_sql_database_instance.main.ip_address[0].ip_address]
}