Hi all,
I’m running into a limitation with Grafana’s variable system and would appreciate any advice or potential workarounds.
Use Case:
I have the following variables configured on a dashboard:
• $realm – a query variable fetching available realms from a T2 datasource.
• $region – a query variable dependent on $realm, which fetches regions from the same datasource.
• $Tier – a custom variable with hardcoded values: Tier1, Tier2, Tier3.
• $tier1, $tier2, $tier3 – custom variables with comma-separated regions, like:
• tier1: us-ashburn-1, us-phoenix-1
• tier2: me-dubai-1, eu-zurich-1
• tier3: uk-london-1, eu-paris-1
These tier-region mappings are not stored in the T2 datasource – they are static and only defined within the dashboard as custom variables.
Problem:
I want to dynamically update the $region variable based on the selected $Tier (so users can just pick a tier and see the corresponding regions).
However:
- The tier-to-region mappings (e.g., Tier1 → us-ashburn-1, us-phoenix-1) are not available in the T2 datasource, so I cannot use a query to fetch region values based on the selected tier.
- $Tier is a custom variable, and custom variables in Grafana are statically evaluated — their values are treated as plain text and cannot be used to dynamically drive or modify other variables like $region.
- Grafana does not support indirect referencing, so selecting Tier1 as the value of $Tier does not cause $Tier1 to be interpreted or substituted automatically. In other words, $Tier pointing to Tier1 does not result in $Tier1’s values being resolved or used elsewhere.
- For example, if I select Tier1 as the value of $Tier, and try to use that to dynamically populate $region via something like $${Tier}, it doesn’t resolve to the contents of $Tier1 (i.e., the actual regions). Grafana does not support indirect referencing like this.
- I cannot define $region as a custom variable either, because it needs to pull dynamic values from the T2 datasource and support filtering in panel queries — which requires a query variable, not a custom one.
Goal:
When the user selects a value in $Tier, I want $region to automatically update to the regions mapped to that tier (e.g., selecting Tier1 sets $region to us-ashburn-1, us-phoenix-1).
Has anyone faced a similar situation? Is there any workaround or plugin that might help implement this logic?
Thanks in advance!