我一直在关注Terraform文档。在遇到导入import
网络之前,Google VPC
(导入VM等)没有问题。
我创建了一个模块:
resource "google_compute_network" "vpn-site" {
project = "project1"
name = "vpn-site"
}
我创建了一个main.tf
的elswhere:
...
module "vpn-site" {
source = "../../../vpn-site"
}
...
我还尝试过不使用模块,而是从单个main.tf
文件中导入该模块。我得到的响应是这样的:
import module.vpn-site.google_compute_network.vpn-site result: vpn-site: import module.vpn-site.google_compute_network.vpn-site (id: vpn-site): Terraform detected a resource with this ID doesn't
exist. Please verify the ID is correct. You cannot import non-existent
resources using Terraform import.
但是该网络存在-我正在使用它:)(出于明显的原因,我更改了名称)。难道我做错了什么? https://www.terraform.io/docs/providers/google/r/compute_network.html
K。