From f7cb3fe8f9353bc6ef776b991368151c3d15260e Mon Sep 17 00:00:00 2001 From: Jericho Rivera Date: Mon, 29 Jul 2024 14:20:30 +0800 Subject: [PATCH] Updates to compute_network parameters --- gcp/compute_engine/compute.tf | 1 + gcp/compute_engine/data.tf | 6 +++++- gcp/compute_engine/variables.tf | 11 ++++++++--- 3 files changed, 14 insertions(+), 4 deletions(-) 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" {