-
Notifications
You must be signed in to change notification settings - Fork 9
/
datasources.tf
125 lines (101 loc) · 3.31 KB
/
datasources.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
data "ibm_resource_group" "rg" {
name = var.resource_group
}
data "ibm_is_region" "region" {
name = local.region_name
}
data "ibm_is_zone" "zone" {
name = var.zone
region = data.ibm_is_region.region.name
}
data "ibm_is_vpc" "existing_vpc" {
// Lookup for this VPC resource only if var.vpc_name is not empty
count = var.vpc_name != "" ? 1 : 0
name = var.vpc_name
}
data "ibm_is_vpc" "vpc" {
name = local.vpc_name
// Depends on creation of new VPC or look up of existing VPC based on value of var.vpc_name,
depends_on = [module.vpc, data.ibm_is_vpc.existing_vpc]
}
data "ibm_is_instance_profile" "management_host" {
name = var.management_node_instance_type
}
data "ibm_is_instance_profile" "worker" {
name = var.worker_node_instance_type
}
data "ibm_is_instance_profile" "storage" {
name = var.storage_node_instance_type
}
data "ibm_is_dedicated_host_profiles" "worker" {
count = var.dedicated_host_enabled ? 1 : 0
}
data "ibm_is_image" "image" {
name = var.image_name
count = local.image_mapping_entry_found ? 0 : 1
}
#data "template_file" "storage_user_data" {
# template = local.storage_template_file
# vars = {
# rc_cidr_block = var.cluster_subnet_id != "" ? data.ibm_is_subnet.existing_subnet[0].ipv4_cidr_block : module.subnet[0].ipv4_cidr_block
# }
#}
data "ibm_is_subnet" "existing_subnet" {
// Lookup for this Subnet resources only if var.cluster_subnet_id is not empty
count = var.cluster_subnet_id != "" ? 1 : 0
identifier = var.cluster_subnet_id
}
data "http" "fetch_myip" {
url = "http://ipv4.icanhazip.com"
}
data "ibm_is_subnet" "subnet_id" {
for_each = var.vpc_name == "" ? [] : toset(data.ibm_is_vpc.vpc.subnets[*].id)
identifier = each.value
}
data "ibm_is_ssh_key" "ssh_key" {
for_each = toset(split(",", var.ssh_key_name))
name = each.value
}
data "ibm_is_instance_profile" "login" {
name = var.login_node_instance_type
}
data "ibm_is_image" "stock_image" {
name = local.stock_image_name
}
data "ibm_is_instance_profile" "spectrum_scale_storage" {
name = var.scale_storage_node_instance_type
}
data "ibm_is_image" "scale_image" {
name = var.scale_storage_image_name
count = local.scale_image_mapping_entry_found ? 0 : 1
}
# data "ibm_is_subnet_reserved_ips" "dns_reserved_ips" {
# for_each = toset([for subnetsdetails in data.ibm_is_subnet.subnet_id : subnetsdetails.id])
# subnet = each.value
# }
# data "ibm_dns_custom_resolvers" "dns_custom_resolver" {
# count = local.dns_reserved_ip == "" ? 0 : 1
# instance_id = local.dns_service_id
# }
# data "ibm_kms_key" "kms_key" {
# count = var.enable_customer_managed_encryption ? 1 : 0
# instance_id = var.kms_instance_id
# key_name = var.kms_key_name
# }
data "ibm_is_vpc_address_prefixes" "existing_vpc" {
#count = var.vpc_name != "" ? 1 : 0
vpc = data.ibm_is_vpc.vpc.id
}
data "ibm_is_subnet" "existing_login_subnet" {
// Lookup for this Subnet resources only if var.login_subnet_id is not empty
count = (var.login_subnet_id != "" && var.vpc_name != "") ? 1 : 0
identifier = var.login_subnet_id
}
data "ibm_is_image" "ldap_vsi_image" {
name = var.ldap_vsi_osimage_name
count = var.ldap_basedns != null && var.ldap_server == "null" ? 1 : 0
}
data "ibm_is_image" "compute" {
name = var.compute_image_name
count = local.compute_image_mapping_entry_found ? 0 : 1
}