Optional List-Based Relations Between Building Blocks
Florian Nowarre
Problem / Use Case
Today a Building Block can only declare a dependency on a single instance of
another Building Block Definition via "Parent Building Block Output" - one
output value from one parent. There is no way to relate a Building Block to
an arbitrary, optional number of instances of another definition and collect
a specific output from each as a list.
Example: a GKE cluster Building Block creates a node pool with a service
account that needs read access to a variable number of Artifact Registry
repositories, each provisioned as its own Building Block. Today this
requires deploying a separate "Relation" Building Block per repository link,
which does not scale and quickly becomes confusing to manage.
Proposed Solution
Allow a Building Block input to be sourced from N related instances of
another Building Block Definition (an optional, list-based relation),
taking a chosen output (e.g. "id") from each related instance and passing
them as a list input (e.g.
repository_ids
). The Building Blockimplementation can then iterate the list.