1

我有一个自定义的 vpc - 配置了 vpc 对等互连和所有。现在我想在只有私有 ip 的 vpc 下使用 terraform 部署一个 cloudsql 实例。任何人都可以对此提出任何建议。

4

1 回答 1

0

我不太了解 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]
}

我相信这是您需要的配置位?

于 2020-02-13T17:22:44.863 回答