Dynamically updating one variable based on another (custom variable limitation)

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!

Yes, use for example SQL datasource and write query (whole business logic will be in SQL), which will return correct region based on tier value

So $region will depend both on $Tier and $realm?

$realm (dynamic)
  - realm1
  - realm2

$region (dynamic)
  - region1,realm1
  - region2,realm2

$Tier (static)
  - Tier 1
  - Tier 2

$tier1 (static)
  - us-ashburn-1, us-phoenix-1
$tier2 (static)
  - me-dubai-1, eu-zurich-1
$tier3 (static)
  - uk-london-1, eu-paris-1

does $region have tier data, if so in what form?
what are $region and $realm datasources? sql? a rest api?

does $region have tier data, if so in what form?
$region will have all available regions in T2 (based on the passed variable $realm in grafana query variable)
So $region will have data which we want to query using variable $Tier [Tier1, Tier2, Tier2].

what are $region and $realm datasources? sql? a rest api?
We’re using OCI T2 as dataSource here and data being fetched using T2 query in grafana variable.