From 7a31164a6b7253341a1059b78ef5898311f01bf7 Mon Sep 17 00:00:00 2001 From: Adam Geiger Date: Fri, 12 Aug 2022 16:06:35 -0400 Subject: [PATCH] feat: additional output for vsi with fips (#52) * feat: Additional output for vsi with fips * Fix tflint error Co-authored-by: Adam Geiger --- README.md | 1 + outputs.tf | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/README.md b/README.md index f5e05d42..a1a5486f 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,7 @@ No modules. | Name | Description | |------|-------------| +| [fip\_list](#output\_fip\_list) | A list of VSI with name, id, zone, and primary ipv4 address, and floating IP. This list only contains instances with a floating IP attached. | | [ids](#output\_ids) | The IDs of the VSI | | [lb\_hostnames](#output\_lb\_hostnames) | Hostnames for the Load Balancer created | | [lb\_security\_groups](#output\_lb\_security\_groups) | Load Balancer security groups | diff --git a/outputs.tf b/outputs.tf index 46e78642..b509912e 100644 --- a/outputs.tf +++ b/outputs.tf @@ -25,10 +25,26 @@ output "list" { zone = virtual_server.zone ipv4_address = virtual_server.primary_network_interface[0].primary_ipv4_address floating_ip = var.enable_floating_ip ? ibm_is_floating_ip.vsi_fip[virtual_server.name].address : null + vpc_id = var.vpc_id } ] } +output "fip_list" { + description = "A list of VSI with name, id, zone, and primary ipv4 address, and floating IP. This list only contains instances with a floating IP attached." + value = [ + for virtual_server in ibm_is_instance.vsi : + { + name = virtual_server.name + id = virtual_server.id + zone = virtual_server.zone + ipv4_address = virtual_server.primary_network_interface[0].primary_ipv4_address + floating_ip = var.enable_floating_ip ? ibm_is_floating_ip.vsi_fip[virtual_server.name].address : null + vpc_id = var.vpc_id + } if var.enable_floating_ip == true + ] +} + ############################################################################## ##############################################################################