From 7e6635f535fd4af7dd51eeb05dbf839d79380488 Mon Sep 17 00:00:00 2001 From: Julio Diez Date: Thu, 9 Mar 2023 11:56:42 +0100 Subject: [PATCH] Alphabetical order and better naming --- modules/ncc-spoke-ra/main.tf | 12 +++++++----- modules/ncc-spoke-ra/variables.tf | 6 +++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/modules/ncc-spoke-ra/main.tf b/modules/ncc-spoke-ra/main.tf index eead0c7d5..894abd72e 100644 --- a/modules/ncc-spoke-ra/main.tf +++ b/modules/ncc-spoke-ra/main.tf @@ -17,9 +17,11 @@ locals { spoke_vms = [ for ras in var.router_appliances : { - ip = ras.ip - vm = ras.vm - vm_name = element(split("/", ras.vm), length(split("/", ras.vm)) - 1) + ip = ras.internal_ip + vm = ras.vm_self_link + vm_name = element( + split("/", ras.vm_self_link), length(split("/", ras.vm_self_link)) - 1 + ) } ] } @@ -40,8 +42,8 @@ resource "google_network_connectivity_spoke" "spoke-ra" { dynamic "instances" { for_each = var.router_appliances content { - virtual_machine = instances.value["vm"] - ip_address = instances.value["ip"] + ip_address = instances.value["internal_ip"] + virtual_machine = instances.value["vm_self_link"] } } site_to_site_data_transfer = var.data_transfer diff --git a/modules/ncc-spoke-ra/variables.tf b/modules/ncc-spoke-ra/variables.tf index bfdc688a1..3b7a81d56 100644 --- a/modules/ncc-spoke-ra/variables.tf +++ b/modules/ncc-spoke-ra/variables.tf @@ -24,8 +24,8 @@ variable "hub" { description = "The name of the NCC hub to create or use." type = object({ create = optional(bool, false) - name = string description = optional(string) + name = string }) } @@ -47,8 +47,8 @@ variable "region" { variable "router_appliances" { description = "List of router appliances this spoke is associated with." type = list(object({ - vm = string # URI - ip = string + internal_ip = string + vm_self_link = string })) }