Skip to content

Commit 2d93f6b

Browse files
authored
fix: include default worker pool in list in the workerpools output (#383)
1 parent cee78d6 commit 2d93f6b

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ Optionally, you need the following permissions to attach Access Management tags
224224
| [ibm_container_addons.existing_addons](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/data-sources/container_addons) | data source |
225225
| [ibm_container_cluster_config.cluster_config](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/data-sources/container_cluster_config) | data source |
226226
| [ibm_container_cluster_versions.cluster_versions](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/data-sources/container_cluster_versions) | data source |
227+
| [ibm_container_vpc_worker_pool.all_pools](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/data-sources/container_vpc_worker_pool) | data source |
227228
| [ibm_is_lbs.all_lbs](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/data-sources/is_lbs) | data source |
228229
| [ibm_is_virtual_endpoint_gateways.all_vpes](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/data-sources/is_virtual_endpoint_gateways) | data source |
229230

main.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,18 @@ data "ibm_container_cluster_config" "cluster_config" {
266266
# Worker Pools
267267
##############################################################################
268268

269+
locals {
270+
additional_pool_names = var.ignore_worker_pool_size_changes ? [for pool in local.other_autoscaling_pools : pool.pool_name] : [for pool in local.other_pools : pool.pool_name]
271+
pool_names = toset(flatten([["default"], local.additional_pool_names]))
272+
}
273+
274+
data "ibm_container_vpc_worker_pool" "all_pools" {
275+
depends_on = [ibm_container_vpc_worker_pool.autoscaling_pool, ibm_container_vpc_worker_pool.pool]
276+
for_each = local.pool_names
277+
cluster = local.cluster_id
278+
worker_pool_name = each.value
279+
}
280+
269281
resource "ibm_container_vpc_worker_pool" "pool" {
270282
for_each = { for pool in local.other_pools : pool.pool_name => pool }
271283
vpc_id = var.vpc_id

outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ output "cluster_crn" {
2222

2323
output "workerpools" {
2424
description = "Worker pools created"
25-
value = var.ignore_worker_pool_size_changes ? ibm_container_vpc_worker_pool.autoscaling_pool : ibm_container_vpc_worker_pool.pool
25+
value = data.ibm_container_vpc_worker_pool.all_pools
2626
}
2727

2828
output "ocp_version" {

0 commit comments

Comments
 (0)