Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix outputs for v0.5.0 of equinix-labs/fabric-connection/equinix #13

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
locals {
gcp_compute_router_name = coalesce(var.gcp_compute_router_name, lower(format("router-%s", random_string.this.result)))
gcp_compute_router_id = var.gcp_compute_create_router ? google_compute_router.this[0].id : data.google_compute_router.this[0].id
gcp_compute_router_name = lower(format("router-%s", random_string.this.result))
gcp_compute_router_id = var.gcp_compute_create_router ? google_compute_router.this[0].id : var.gcp_compute_router_id
gcp_region = coalesce(var.gcp_region, data.google_client_config.this.region)
gcp_project = coalesce(var.gcp_project, data.google_client_config.this.project)
gcp_network = data.google_compute_network.this.id
gcp_network = var.gcp_compute_network_id
gcp_bgp_addresses = try(jsondecode(data.local_file.this[0].content), null)
gcp_bgp_addresses_file_path = "${path.module}/gcp_peering_addresses.json"
}

data "google_client_config" "this" {}

data "google_compute_network" "this" {
name = var.gcp_compute_network_name
}

data "google_compute_router" "this" {
count = var.gcp_compute_create_router ? 0 : 1

name = local.gcp_compute_router_name
network = local.gcp_network
}

resource "google_compute_router" "this" {
count = var.gcp_compute_create_router ? 1 : 0

Expand Down
2 changes: 1 addition & 1 deletion outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ output "gcp_cloud_router_id" {

output "gcp_cloud_router_name" {
description = "Google Cloud Router Name."
value = var.gcp_compute_create_router ? google_compute_router.this[0].name : data.google_compute_router.this[0].name
value = var.gcp_compute_create_router ? google_compute_router.this[0].name : ""
}

output "gcp_cloud_router_ip_address" {
Expand Down
10 changes: 5 additions & 5 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ variable "gcp_project" {
default = ""
}

variable "gcp_compute_network_name" {
variable "gcp_compute_network_id" {
type = string
description = "The name of an existing Google Cloud VPC network. If unspecified, default regional network will be used."
default = "default"
description = "The ID of an existing Google Cloud VPC network. If unspecified, default regional network will be used."
default = ""
}

variable "gcp_compute_create_router" {
Expand All @@ -152,9 +152,9 @@ variable "gcp_compute_create_router" {
default = true
}

variable "gcp_compute_router_name" {
variable "gcp_compute_router_id" {
type = string
description = "The name for Google Cloud router. If unspecified, it will be auto-generated. Required if 'gcp_compute_create_router' is false."
description = "The ID for Google Cloud router. If unspecified, it will be auto-generated. Required if 'gcp_compute_create_router' is false."
default = ""
}

Expand Down