Skip to content

fix: handle wrapped dashboards and inject inputs in portables converter#169

Open
kcorbett-hdx wants to merge 1 commit into
mainfrom
fix/portables-dashboard-inputs
Open

fix: handle wrapped dashboards and inject inputs in portables converter#169
kcorbett-hdx wants to merge 1 commit into
mainfrom
fix/portables-dashboard-inputs

Conversation

@kcorbett-hdx

Copy link
Copy Markdown
Collaborator

Summary

  • grafana_gen.py: Unwraps {"dashboard": {...}} bundle format before processing dashboards, injects the required datasource entry into __inputs when missing, adds constant template variables from templating.list as __inputs, and always includes the datasource in resources.gfo.yaml inputs
  • discoverer.py: Unwraps {"dashboard": {...}} format when reading source dashboards, falls back to extracting constant variables from templating.list as inputs when __inputs is absent

Context

Bundle-format dashboards use a {"dashboard": {...}} wrapper and store table/datasource references as plain constant variables (e.g. raw_table = "__PROJECT_NAME__.__TABLE_NAME__") rather than Grafana __inputs. The portables converter previously produced output dashboards with no __inputs beyond the datasource, and resources.gfo.yaml with no inputs entries — both required for CaC deployment.

Test plan

  • Run python3 scripts/bundle_to_yaml.py --source aws/cdn-insights --verbose and confirm all 4 phases pass
  • Verify generated dashboard JSONs contain __inputs with datasource + all constant template variables
  • Verify resources.gfo.yaml contains an inputs map for each dashboard
  • Confirm trafficpeak/security still converts correctly (dashboards already have __inputs — existing path unchanged)

🤖 Generated with Claude Code

- grafana_gen: unwrap {"dashboard": {...}} bundle format before processing,
  inject datasource __inputs entry when missing, add constant template
  variables from templating.list as __inputs, and always include datasource
  in resources.gfo.yaml inputs
- discoverer: unwrap {"dashboard": {...}} format when reading source
  dashboards, fall back to extracting constant variables from
  templating.list when __inputs is absent

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant