-
Notifications
You must be signed in to change notification settings - Fork 10
Description
I'd like to report an issue we encountered with the use of the merge function in ibm roks terraform module for managing ROKS addons.
When both var.addons and the detected addon list include "vpc-block-csi-driver", the detected version (retrieved from ibm_container_addons) always overrides the manual version defined in var.addons, due to how merge prioritizes later values.
addons = merge(
{ for addon_name, addon_version in(var.addons != null ? var.addons : {}) : addon_name =>
addon_version if addon_version != null },
length(local.csi_driver_version) > 0 ? { vpc-block-csi-driver = local.csi_driver_version[0] } : {}
)
By default, version 5.1 on the CSI Driver is installed, but we want to enforce the installation of version 5.2 explicitly defined in var.addons. Unfortunately, this is currently overwritten by the auto-detected version.
Workaround implemented:
To ensure user-defined versions take precedence, we now only add the detected version if it's not already defined :
addons = merge(length(local.csi_driver_version) > 0 && !contains(keys(var.addons), "vpc-block-csi-driver") ? { vpc-block-csi-driver = local.csi_driver_version[0] } : {},
{ for addon_name, addon_version in(var.addons != null ? var.addons : {}) : addon_name => addon_version if addon_version != null })
Module version used : 3.35.7