-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdata.tf
More file actions
29 lines (24 loc) · 1014 Bytes
/
data.tf
File metadata and controls
29 lines (24 loc) · 1014 Bytes
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
# ============================================================
# Data Sources
# Resolve resource group, cluster, VPC, and optional transit gateway
# ============================================================
data "ibm_resource_groups" "all" {}
data "ibm_resource_group" "resource_group" {
name = var.ibmcloud_resource_group != "" ? var.ibmcloud_resource_group : [
for rg in data.ibm_resource_groups.all.resource_groups :
rg.name if rg.is_default == true
][0]
}
# Look up the existing OpenShift cluster
data "ibm_container_vpc_cluster" "cluster" {
name = var.roks_cluster_name_or_id
resource_group_id = data.ibm_resource_group.resource_group.id
}
# Resolve a subnet from the first worker pool zone to learn the VPC
data "ibm_is_subnet" "cluster_subnet" {
identifier = data.ibm_container_vpc_cluster.cluster.worker_pools[0].zones[0].subnets[0].id
}
# Learn the cluster VPC from the subnet
data "ibm_is_vpc" "cluster_vpc" {
identifier = data.ibm_is_subnet.cluster_subnet.vpc
}