diff --git a/gcp/compute_engine/compute.tf b/gcp/compute_engine/compute.tf index a2266b8..379f3ab 100644 --- a/gcp/compute_engine/compute.tf +++ b/gcp/compute_engine/compute.tf @@ -13,6 +13,7 @@ resource "google_compute_instance" "default" { } network_interface { + network = data.google_compute_network.default.id subnetwork = data.google_compute_subnetwork.default.id access_config { network_tier = "PREMIUM" diff --git a/gcp/compute_engine/data.tf b/gcp/compute_engine/data.tf index 2259972..99b6299 100644 --- a/gcp/compute_engine/data.tf +++ b/gcp/compute_engine/data.tf @@ -1,3 +1,7 @@ data "google_compute_subnetwork" "default" { - name = var.compute_subnetwork_name + name = var.google_compute_subnetwork +} + +data "google_compute_network" "default" { + name = var.google_compute_network } diff --git a/gcp/compute_engine/variables.tf b/gcp/compute_engine/variables.tf index d4105da..5fd127b 100644 --- a/gcp/compute_engine/variables.tf +++ b/gcp/compute_engine/variables.tf @@ -13,9 +13,14 @@ variable "instance_termination_action" { default = "STOP" } -variable "compute_subnetwork_name" { - type = string - default = "default" +variable "google_compute_subnetwork" { + type = string + # default = "default" +} + +variable "google_compute_network" { + type = string + # default = "default" } variable "instance_name" {