Fix Azure resources rendering without their icons - #210
Open
vasanth064 wants to merge 2 commits into
Open
Conversation
…icons Both icons already ship with Terravision but neither is reachable, so the resources render as generic unconnected nodes. - azurerm_static_site was renamed azurerm_static_web_app in the AzureRM provider. Only the old name was aliased, so current configurations miss static-apps.png. The legacy alias is kept for older configurations. - azurerm_cdn_frontdoor_* was never aliased, leaving FrontDoorAndCDNProfiles and front-door-and-cdn-profiles.png unreachable. Classic CDN is not an alternative for new work: creating azurerm_cdn_profile resources has been blocked since 1 October 2025, so Front Door is the only CDN path a current configuration can take. - Adds tests/test_azure_web_aliases.py, which fails without this change. No new icons or logic, aliases only. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
_icon_dir read resource_images/azure/database while every icon the module names ships under resource_images/azure/databases. 41 of its 45 classes resolved to a file that does not exist. Nothing reported this. The alias resolved, so the renderer believed it had an icon and drew an empty node instead of warning. modules.drawing loads every module in the package into a single namespace, so the alphabetically last module wins. databases.py therefore overrode the working aliases in database.py, which is why azurerm_redis_cache and azurerm_postgresql_flexible_server rendered blank even though database.py mapped both to classes whose icons are present. Adds tests/test_azure_icon_dirs.py, which asserts every Azure class with an _icon points at a file that exists. It fails on exactly those 41 classes without this change. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Terravision ships icons for several Azure resources it can't reach, so they render as blank or unconnected nodes. Two causes.
1. Wrong icon directory hides 41 classes
resource_classes/azure/databases.pysets_icon_dirtoresource_images/azure/database, but its icons ship underresource_images/azure/databases. 41 of its 45 classes point at a file that doesn't exist.Nothing warns about it — the alias resolves, so the renderer believes it has an icon and draws an empty node.
It also spreads.
modules/drawing.pyflattens the package into one namespace, so the alphabetically last module wins:databases.pyoverridesdatabase.py'sazurerm_redis_cacheandazurerm_postgresql_flexible_server, which were mapped to classes whose icons are correct. Both render blank in every Azure diagram.Fix: one character,
database→databases.2. Two missing Terraform aliases
azurerm_static_sitewas renamedazurerm_static_web_appin the provider; only the old name is mapped, sostatic-apps.pngis unreachable. The legacy alias is kept.azurerm_cdn_frontdoor_*is not mapped at all, leavingFrontDoorAndCDNProfilesunreachable. Classic CDN isn't an alternative — creatingazurerm_cdn_profilehas been blocked since 1 Oct 2025, so no CDN resource in a current config draws an icon.Fix: six alias lines. No new icons, no logic, no dependencies.
Effect
On a 29-resource Azure config (VNet, subnets, AKS, App Gateway, Load Balancer, PostgreSQL Flexible Server, Redis, Front Door, Static Web App), missing-icon warnings drop from 8 to 2. Static Web App and the five Front Door resources gain icons and edges; Redis and Postgres stop rendering blank.
Remaining 2 warnings are out of scope:
azurerm_postgresql_flexible_server_database,azurerm_private_dns_zone_virtual_network_link.Tests
tests/test_azure_icon_dirs.py— asserts every Azure class with an_iconpoints at a real file, catching the class of bug rather than this instance. Reverting the_icon_dirline: 41 failed.tests/test_azure_web_aliases.py— covers the alias mappings. Reverting the alias block: 12 of 15 failed.poetry run pytest tests -m "not slow"— 1719 passed, 5 deselected.poetry run black --checkonmodulesand all changed files — 39 unchanged.Written with AI assistance (Claude), per CONTRIBUTING. I reviewed the diff; all counts above are from local runs.