-
Notifications
You must be signed in to change notification settings - Fork 2
/
outputs.tf
26 lines (22 loc) · 1.25 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
locals {
# we need to get the name from the cluster id to create an implicit dependency
# on the actual created cluster.
# Just using the name here will not create this dependency as the name is known
# in the planning phase of terraform.
# node pools are created using the name only (no self_link, no id is working)
name_from_id = try(element(reverse(split("/", google_container_cluster.cluster[0].id)), 0), null)
}
# ----------------------------------------------------------------------------------------------------------------------
# OUTPUT CALCULATED VARIABLES (prefer full objects)
# ----------------------------------------------------------------------------------------------------------------------
output "name" {
description = "The name of the created cluster."
value = local.name_from_id
}
# ----------------------------------------------------------------------------------------------------------------------
# OUTPUT ALL RESOURCES AS FULL OBJECTS
# ---------------------------------------------------------------------------------------------------------------------
output "cluster" {
description = "All attributes of the created `google_container_cluster` resource."
value = try(google_container_cluster.cluster[0], null)
}