Remove data source from net-vpc module (#2216)
* remove data source from net-vpc module * fix test inventories * remove data source, fix fast inventories
This commit is contained in:
committed by
GitHub
parent
a74a106f8b
commit
198d90c6fc
@@ -17,8 +17,24 @@
|
||||
locals {
|
||||
network = (
|
||||
var.vpc_create
|
||||
? try(google_compute_network.network.0, null)
|
||||
: try(data.google_compute_network.network.0, null)
|
||||
? {
|
||||
id = try(google_compute_network.network.0.id, null)
|
||||
name = try(google_compute_network.network.0.name, null)
|
||||
self_link = try(google_compute_network.network.0.self_link, null)
|
||||
}
|
||||
: {
|
||||
id = format(
|
||||
"projects/%s/global/networks/%s",
|
||||
var.project_id,
|
||||
var.name
|
||||
)
|
||||
name = var.name
|
||||
self_link = format(
|
||||
"https://www.googleapis.com/compute/v1/projects/%s/global/networks/%s",
|
||||
var.project_id,
|
||||
var.name
|
||||
)
|
||||
}
|
||||
)
|
||||
peer_network = (
|
||||
var.peering_config == null
|
||||
@@ -27,12 +43,6 @@ locals {
|
||||
)
|
||||
}
|
||||
|
||||
data "google_compute_network" "network" {
|
||||
count = var.vpc_create ? 0 : 1
|
||||
project = var.project_id
|
||||
name = var.name
|
||||
}
|
||||
|
||||
resource "google_compute_network" "network" {
|
||||
count = var.vpc_create ? 1 : 0
|
||||
project = var.project_id
|
||||
|
||||
Reference in New Issue
Block a user