1

我正在尝试获取我的 cloudsql 实例在我的 vpn 上使用可路由的私有 IP 地址范围:https ://cloud.google.com/sql/docs/postgres/configure-private-ip#vpn

我需要运行这个命令:

gcloud compute routers update my-router \
    --advertisement-mode custom \
    --set-advertisement-groups all_subnets \
    --set-advertisement-ranges 1.2.3.4,6.7.0.0/16

我能找到的最接近的资源是 google_compute_router_peer 但我已经有一个 peer 配置了默认的 Advertisement_mode 和 aws VPN 端点

我可以为同一个路由器设置多个 google_compute_router_peers 并使用不同的advertise_modes 对等点吗?

resource "google_compute_router_peer" "peer" {
  name                      = "my-router-peer"
  router                    = "my-router"

  // I already have a peer configured for the same router, peer ip address, asn, etc. 
  // Its configured with as DEFAULT advertise mode and is used to create a VPN with AWS VPN gateways
  advertise_mode            = "custom"
  advertised_groups         = [all_subnets]
 
  advertised_ip_ranges {
    range = ["1.2.3.4"]
  }
  advertised_ip_ranges {
    range = ["6.7.0.0/16"]
  }

  peer_ip_address           = "169.254.1.2"
  peer_asn                  = 65513
  advertised_route_priority = 100
  interface                 = "interface-1"
}

仅供参考,我知道我可以使用 local-exec 来运行任意命令——我当然想避免这种情况。

4

0 回答 0