Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating 3 resources icon in the graph where I have so many other resources for Azure Provider #155

Open
subrata-mettle opened this issue Aug 23, 2021 · 1 comment
Assignees

Comments

@subrata-mettle
Copy link

subrata-mettle commented Aug 23, 2021

If I am executing below command with verbose I am getting the respective Icon..

Terraform v1.0.1
provider : Azure
Inframapcurrent version is: v0.6.7

===================================================================================

root@61e25d5f9ffd:/home/project/jobs/NHoRa6NT8hIY/20210820141618-1629468978/infrastructure# ../../infrastructure/inframap/inframap generate terraform.tfstate --clean=false| dot -Tpng > graph1.png -v
dot - graphviz version 2.43.0 (0)
Using render: cairo:cairo
Using device: png:cairo:cairo
libdir = "/usr/lib/x86_64-linux-gnu/graphviz"
Activated plugin library: libgvplugin_dot_layout.so.6
Using layout: dot:dot_layout
The plugin configuration file:
/usr/lib/x86_64-linux-gnu/graphviz/config6a
was successfully loaded.
render : cairo dot dot_json fig gd json json0 map mp pic pov ps svg tk visio vml vrml xdot xdot_json
layout : circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi
textlayout : textlayout
device : canon cmap cmapx cmapx_np dot dot_json eps fig gd gd2 gif gv imap imap_np ismap jpe jpeg jpg json json0 mp pdf pic plain plain-ext png pov ps ps2 svg svgz tk vdx vml vmlz vrml wbmp webp x11 xdot xdot1.2 xdot1.4 xdot_json xlib
loadimage : (lib) eps gd gd2 gif jpe jpeg jpg png ps svg webp xbm
pack info:
mode undefined
size 0
flags 0
margin 8
pack info:
mode node
size 0
flags 0
fontname: "Times-Roman" resolved to: (ps:pango DejaVu Serif, ) (PangoCairoFcFont) "DejaVu Serif, Book" /usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf
network simplex: 2 nodes 1 edges maxiter=2147483647 balance=1
network simplex: 2 nodes 1 edges 0 iter 0.00 sec
network simplex: 1 nodes 0 edges maxiter=2147483647 balance=1
network simplex: 1 nodes 0 edges 0 iter 0.00 sec
Maxrank = 1, minrank = 0
mincross: pass 0 iter 0 trying 0 cur_cross 0 best_cross 0
mincross: pass 0 iter 0 trying 0 cur_cross 0 best_cross 0
mincross G: 0 crossings, 0.00 secs.
network simplex: 4 nodes 3 edges maxiter=2147483647 balance=2
network simplex: 4 nodes 3 edges 0 iter 0.00 sec
routesplines: 1 edges, 3 boxes 0.00 sec
Using render: cairo:cairo
Using device: png:cairo:cairo
dot: allocating a 1036K cairo image surface (947 x 280 pixels)
Using render: cairo:cairo
Using loadimage: png:cairo:cairo
Using render: cairo:cairo
Using loadimage: png:cairo:cairo
Using render: cairo:cairo
Using loadimage: png:cairo:cairo
gvRenderJobs G: 0.03 secs.
root@61e25d5f9ffd:/home/project/jobs/NHoRa6NT8hIY/20210820141618-1629468978/infrastructure#

==========================================
image

=========================================
We can see we have many resources :

root@61e25d5f9ffd:/home/project/jobs/NHoRa6NT8hIY/20210820141618-1629468978/infrastructure# terraform state list
module.app-insights.azurerm_application_insights.insights
module.kv01.data.azurerm_client_config.current
module.kv01.azurerm_key_vault.example
module.monitor.azurerm_log_analytics_workspace.law
module.monitor.azurerm_monitor_action_group.actiongroup01
module.monitor.azurerm_network_watcher.nw
module.monitor.azurerm_network_watcher_flow_log.flowlog
module.policy.azurerm_policy_assignment.Blocked_Ingesion_Public_Network[0]
module.policy.azurerm_policy_assignment.NIC_PIP_not_allowed[0]
module.policy.azurerm_policy_assignment.Public_access_to_SQL_DB[0]
module.policy.azurerm_policy_assignment.SQL_logs_to_workspace[0]
module.policy.azurerm_policy_assignment.SQL_server_enable_auditing[0]
module.policy.azurerm_policy_assignment.TLS_1_2_SQL_DB[0]
module.policy.azurerm_policy_assignment.VNET_flow_log_configure[0]
module.policy.azurerm_policy_assignment.auditLockOnNetworking[0]
module.policy.azurerm_policy_assignment.secure_storage_transfer[0]
module.policy.azurerm_policy_assignment.storage_VNET_endpoint[0]
module.policy.azurerm_policy_assignment.storage_private_link_usage[0]
module.policy.azurerm_policy_assignment.storage_shared_access_key_usage[0]
module.policy.azurerm_policy_definition.auditLockOnNetworking[0]
module.rg01.azurerm_resource_group.rg01
module.rsv.azurerm_recovery_services_vault.vault
module.sqldb.azurerm_sql_database.sqldb
module.sqlserver.azurerm_key_vault_secret.pass
module.sqlserver.azurerm_key_vault_secret.user
module.sqlserver.azurerm_mssql_server_extended_auditing_policy.auditing_policy
module.sqlserver.azurerm_sql_server.sqlserver
module.sqlserver.random_password.password
module.sqlserver.random_string.user
module.sta01.azurerm_storage_account.sta
module.subnet.azurerm_network_security_group.nsg
module.subnet.azurerm_network_security_rule.rules[0]
module.subnet.azurerm_network_security_rule.rules[1]
module.subnet.azurerm_subnet.snet
module.subnet.azurerm_subnet_network_security_group_association.nsgAssociate
module.vnet01.azurerm_network_ddos_protection_plan.ddos
module.vnet01.azurerm_virtual_network.main
root@61e25d5f9ffd:/home/project/jobs/NHoRa6NT8hIY/20210820141618-1629468978/infrastructure#

============================================================
If We execute with --raw command then we can see the Terraform Graph utility graph. .
../../infrastructure/inframap/inframap generate terraform.tfstate --raw --clean=false| dot -Tpng > g
root@61e25d5f9ffd:/home/project/jobs/NHoRa6NT8hIY/20210820141618-1629468978/infrastructure# raph2.png -v

PFA graph2.png for this

graph2

.....................................

Is the other Azure resources not supported currently ..
If I am doing prune then getting below response :

========================
{
"version": 4,
"terraform_version": "0.15.3",
"serial": 38,
"lineage": "8444fdc7-c916-xxxxxx-bb8fbcd72755",
"outputs": {},
"resources": [
{
"module": "module.sqldb",
"mode": "managed",
"type": "azurerm_sql_database",
"name": "EfyRy",
"provider": "provider["registry.terraform.io/hashicorp/azurerm"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"id": "/subscriptions/c3fd45ea-xxxxxxxxx-xxxxxxxxxxxdb733/resourceGroups/MSSalesWUS2DevRSGLAND01/providers/Microsoft.Sql/servers/mssaleswus2devsdb/databases/MSSalesWUS2DevSQL",
"name": "MSSalesWUS2DevSQL"
},
"sensitive_attributes": [],
"dependencies": [
"module.sqlserver.azurerm_sql_server.nCOuU"
]
}
]
},
{
"module": "module.sqlserver",
"mode": "managed",
"type": "azurerm_sql_server",
"name": "nCOuU",
"provider": "provider["registry.terraform.io/hashicorp/azurerm"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"id": "/subscriptions/c3fd45ea-xxxxxxxxx-xxxxxxxxxxxdb733/resourceGroups/MSSalesWUS2DevRSGLAND01/providers/Microsoft.Sql/servers/mssaleswus2devsdb",
"name": "mssaleswus2devsdb"
},
"sensitive_attributes": [
[
{
"type": "get_attr",
"value": "administrator_login_password"
}
]
]
}
]
},
{
"module": "module.vnet01",
"mode": "managed",
"type": "azurerm_virtual_network",
"name": "jSsoX",
"provider": "provider["registry.terraform.io/hashicorp/azurerm"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"id": "/subscriptions/c3fd45ea-xxxxxxxxx-xxxxxxxxxxxdb733/resourceGroups/MSSalesWUS2DevRSGLAND01/providers/Microsoft.Network/virtualNetworks/MSSalesWUS2DevVNT01",
"name": "MSSalesWUS2DevVNT01"
},
"sensitive_attributes": []
}
]
}
]
}
==================================

@subrata-mettle subrata-mettle changed the title Generating 3 resources icon in the graph where I have so many other resources .. Generating 3 resources icon in the graph where I have so many other resources for Azure Provider Aug 23, 2021
@xescugc xescugc self-assigned this Aug 25, 2021
@xescugc
Copy link
Member

xescugc commented Aug 25, 2021

Hi @subrata-mettle !

So the "main" issue here is that for Azure we only have a few elements that we identify as "Nodes":

		"azurerm_app_service":                       struct{}{},
		"azurerm_app_service_certificate":           struct{}{},
		"azurerm_app_service_environment":           struct{}{},
		"azurerm_app_service_plan":                  struct{}{},
		"azurerm_application_gateway":               struct{}{},
		"azurerm_bastion_host":                      struct{}{},
		"azurerm_batch_account":                     struct{}{},
		"azurerm_batch_application":                 struct{}{},
		"azurerm_batch_pool":                        struct{}{},
		"azurerm_cdn_endpoint":                      struct{}{},
		"azurerm_cdn_profile":                       struct{}{},
		"azurerm_container_group":                   struct{}{},
		"azurerm_container_registry":                struct{}{},
		"azurerm_cosmosdb_account":                  struct{}{},
		"azurerm_data_factory":                      struct{}{},
		"azurerm_dedicated_host":                    struct{}{},
		"azurerm_dedicated_host_group":              struct{}{},
		"azurerm_dns_zone":                          struct{}{},
		"azurerm_firewall":                          struct{}{},
		"azurerm_frontdoor":                         struct{}{},
		"azurerm_function_app":                      struct{}{},
		"azurerm_image":                             struct{}{},
		"azurerm_kubernetes_cluster":                struct{}{},
		"azurerm_kubernetes_cluster_node_pool":      struct{}{},
		"azurerm_lb":                                struct{}{},
		"azurerm_linux_virtual_machine":             struct{}{},
		"azurerm_mariadb_database":                  struct{}{},
		"azurerm_mariadb_server":                    struct{}{},
		"azurerm_mssql_database":                    struct{}{},
		"azurerm_mssql_elasticpool":                 struct{}{},
		"azurerm_mssql_server":                      struct{}{},
		"azurerm_mssql_virtual_machine":             struct{}{},
		"azurerm_mysql_database":                    struct{}{},
		"azurerm_mysql_server":                      struct{}{},
		"azurerm_nat_gateway":                       struct{}{},
		"azurerm_nat_gateway_public_ip_association": struct{}{},
		"azurerm_netapp_account":                    struct{}{},
		"azurerm_netapp_pool":                       struct{}{},
		"azurerm_netapp_volume":                     struct{}{},
		"azurerm_postgresql_database":               struct{}{},
		"azurerm_postgresql_server":                 struct{}{},
		"azurerm_private_dns_zone":                  struct{}{},
		"azurerm_private_endpoint":                  struct{}{},
		"azurerm_public_ip":                         struct{}{},
		"azurerm_redis_cache":                       struct{}{},
		"azurerm_sql_database":                      struct{}{},
		"azurerm_sql_server":                        struct{}{},
		"azurerm_storage_container":                 struct{}{},
		"azurerm_virtual_machine":                   struct{}{},
		"azurerm_virtual_network_gateway":           struct{}{},
		"azurerm_vpn_gateway":                       struct{}{},
		"azurerm_windows_virtual_machine":           struct{}{},
		"azurerm_virtual_network":                   struct{}{},

And the only type of connections we support is using "azurerm_virtual_network_peering".

So when using the Azure provider we only show that as it's as good as we can do now (we do not support that many things but we have plans to push more information in the future)

When using the --raw flag it escapes the Provider logic that tries to make it prettier and just show all the information.

The provider logic is there because the intend of InfraMap is to remove the elements that are not Nodes (like azurerm_virtual_network_peering) and only show the relevant ones with the right connections.

We know that the Azure provider is lacking for now, what would you expect to see more? Do we have missing nodes? Do you know/have another logic to connect Nodes beside the azurerm_virtual_network_peering?

With your feedback we could fix/extend it improve the Azure Provider. Or you can contribute too https://github.com/cycloidio/inframap/blob/master/CONTRIBUTING.md 🙈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants