-
Notifications
You must be signed in to change notification settings - Fork 0
/
outputs.tf
70 lines (61 loc) · 2.4 KB
/
outputs.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
##############################################################################
# VSI Outputs
##############################################################################
output "ids" {
description = "The IDs of the VSI"
value = [
for virtual_server in ibm_is_instance.vsi :
virtual_server.id
]
}
output "vsi_security_group" {
description = "Security group for the VSI"
value = var.security_group == null ? null : ibm_is_security_group.security_group[var.security_group.name]
}
output "list" {
description = "A list of VSI with name, id, zone, and primary ipv4 address"
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
}
]
}
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
]
}
##############################################################################
##############################################################################
# Load Balancer Outputs
##############################################################################
output "lb_hostnames" {
description = "Hostnames for the Load Balancer created"
value = [
for load_balancer in ibm_is_lb.lb :
load_balancer.hostname
]
}
output "lb_security_groups" {
description = "Load Balancer security groups"
value = {
for load_balancer in var.load_balancers :
(load_balancer.name) => ibm_is_security_group.security_group[load_balancer.security_group.name] if load_balancer.security_group != null
}
}
##############################################################################