我有一个自定义 VPC - 配置了 vpc 对等互连和所有。现在,我想在该 VPC 下使用地形部署一个 cloudsql 实例,该 VPC 仅具有私有 IP。任何人都可以对此有任何建议。
我不太了解 Terraform,但在 terraform 的文档中:
https://www.terraform.io/docs/providers/google/r/sql_database_instance.html
在"VPC"上搜索,它有以下代码片段:
provider = google-beta
name = "private-network"
}
resource "google_compute_global_address" "private_ip_address" {
provider = google-beta
name = "private-ip-address"
purpose = "VPC_PEERING"
address_type = "INTERNAL"
prefix_length = 16
network = google_compute_network.private_network.self_link
}
resource "google_service_networking_connection" "private_vpc_connection" {
provider = google-beta
network = google_compute_network.private_network.self_link
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.private_ip_address.name]
}
我相信这就是您需要的配置位?