feat: Added extra info to analysis output: number of managed resources,...
Using 'tf state pull' to fetch remote state and calculate number of managed resources. When this number is available, we can calculate the drift percentage. Also, the drift categories (minor, medium, major, and unknown) are now also calculated as a percentage.
Here's an example of the JSON output that will be pushed to the Azure Data Collection Endpoint. This JSON can be used to create metrics which can be displayed in a Grafana dashboard. Think (per module): pie-chart thats shows current/latest drift. And, a line-chart that can display drift over time.
(note that the drift is currently not in the 'summary' ... we could add that if needed)
{
"details": [
{
"drifts": {
"minor": 0,
"medium": 1,
"major": 0,
"unknown": 0,
"total": 1,
"percentage": {
"minor": 0.0,
"medium": 100.0,
"major": 0.0,
"unknown": 0.0
},
"score": 1.0
},
"all": [
"module.base.module.kv[0].azurerm_key_vault.this"
],
"creations": [],
"updates": [
"module.base.module.kv[0].azurerm_key_vault.this"
],
"deletions": [],
"unauthorized": [],
"unknowns": [],
"stats": {
"total_managed_resources": 7,
"percentage_drift": 14.3,
"percentage_managed": 85.7
},
"ignorable_updates": [],
"outputs": [
"kv"
],
"module": ""
}
],
"summary": {
"creations": 0,
"updates": 1,
"deletions": 0,
"outputs": 1,
"minor": 0,
"medium": 1,
"major": 0,
"unknown": 0,
"total": 1,
"score": 1.0
}
}