terraform - 如何在 Terraform 配置中使用共享 VPC GCP?
问题描述
我在 GCP 中配置了共享 VPC,我想知道如何在我的 terrafrom 中使用它。
在使用共享 VPC 之前,我的 terraform network_interface 部分如下:
network_interface {
network = "default"
address = "10.128.0.5"
access_config {
//nat_ip = "xxx.xxx.xxx.xx"
}
}
我想知道是否有人可以指导我。
非常感谢。
谢谢!
-劳伦特
解决方案
我没有尝试使用 terraform,但我很确定您可以按照示例使用共享 VPC:https ://github.com/terraform-providers/terraform-provider-google/tree/master/examples/shared-vpc
您的网络接口应如下所示:
network_interface {
network = "${google_compute_network.shared_network.self_link}"
access_config {
nat_ip = "..."
}
}
您需要使用固定的内部 IP(通过字段地址)还是可以使用自动受影响的地址?如果不能,则必须将地址图保存在某处,以确保不会影响已受影响的地址。
NAT IP 应该不会引起问题,但您知道...最好的答案是尝试一下;)
推荐阅读
- python-3.x - 当我尝试获取方法时,为什么我得到''staticmethod' object is not callable'?
- java - 如何解决 Files.createDirectories 的 NoSuchFileException
- python - 在 Python 中调用 Fortran 子例程返回“NoneType”
- javascript - Ajax用响应替换html,但在加载css,js后加载内容
- runtime-error - 生成构建时出现错误,“在'@angular/forms'中找不到“导出'ɵba'(导入为'i10')
- xml - 用 Go 解析 XML 文件有一个奇怪的行为
- reactjs - Graphql 轮询 - 如何使用先前请求的结果?
- javascript - 动态颜色映射
- database - ReactiveMongoRepository 不保存我的数据
- focus - How to Set Automatic active = true in TextEditBox using brightscript?