terratag icon indicating copy to clipboard operation
terratag copied to clipboard

Feat: allow using terratag as a validation tool - add dryrun

Open TomerHeber opened this issue 2 years ago • 5 comments

Added a new dryrun mode that checks if all resources are tagged. If a resource isn't tagged, it returns 1 exit code.

resolves #178

TomerHeber avatar Nov 13 '23 00:11 TomerHeber

@TomerHeber could you please add some screenshots here or something like that so I could understand the flow and it how it looks like to the user? Thanks

avnerenv0 avatar Nov 19 '23 12:11 avnerenv0

@TomerHeber could you please add some screenshots here or something like that so I could understand the flow and it how it looks like to the user? Thanks

@avnerenv0

➜  terratag git:(feat-add-dryrun-#178) ✗ ./terratag -dryrun -dir ./tf2
2023/11/20 07:49:31 [INFO] Processing file tf2/main.tf
2023/11/20 07:49:31 [INFO] Processing resource [azurerm_resource_group example]
2023/11/20 07:49:32 [INFO] Resource taggable, processing...[azurerm_resource_group example]
2023/11/20 07:49:32 [INFO] Resource [azurerm_resource_group example] is taggable and tagged
2023/11/20 07:49:32 [INFO] Processing resource [azurerm_virtual_network example]
2023/11/20 07:49:32 [INFO] Resource taggable, processing...[azurerm_virtual_network example]
2023/11/20 07:49:32 [INFO] Resource [azurerm_virtual_network example] is taggable and tagged
2023/11/20 07:49:32 [INFO] Summary:
2023/11/20 07:49:32 [INFO] Scanned 1 files
2023/11/20 07:49:32 [INFO] Detected 0 untagged resources (out of 2 resource/s)
➜  terratag git:(feat-add-dryrun-#178) ✗ echo $?
0
➜  terratag git:(feat-add-dryrun-#178) ✗ ./terratag -dryrun -dir ./tf2
2023/11/20 07:51:09 [INFO] Processing file tf2/main.tf
2023/11/20 07:51:09 [INFO] Processing resource [azurerm_resource_group example]
2023/11/20 07:51:10 [INFO] Resource taggable, processing...[azurerm_resource_group example]
2023/11/20 07:51:10 [WARN] Resource [azurerm_resource_group example] is taggable but does not have tags
2023/11/20 07:51:10 [INFO] Processing resource [azurerm_virtual_network example]
2023/11/20 07:51:10 [INFO] Resource taggable, processing...[azurerm_virtual_network example]
2023/11/20 07:51:10 [INFO] Resource [azurerm_virtual_network example] is taggable and tagged
2023/11/20 07:51:10 [INFO] Summary:
2023/11/20 07:51:10 [INFO] Scanned 1 files
2023/11/20 07:51:10 [INFO] Detected 1 untagged resources (out of 2 resource/s)
2023/11/20 07:51:10 [ERROR] execution failed due to an error
dry run detected untagged resources
➜  terratag git:(feat-add-dryrun-#178) ✗ echo $?
1

TomerHeber avatar Nov 20 '23 13:11 TomerHeber

talked in Slack - will change to verifing for specific tags - If tags are passed it will check for these tags... otherwise just in general...

avnerenv0 avatar Nov 28 '23 13:11 avnerenv0

@TomerHeber what's the status here?

avnerenv0 avatar Dec 13 '23 12:12 avnerenv0

@avnerenv0 - I have been busy with the provider. I will get back to it when things cool down on the provider side.

TomerHeber avatar Dec 13 '23 12:12 TomerHeber

@TomerHeber it's Passover soon I have to close this :)

avnerenv0 avatar Apr 02 '24 11:04 avnerenv0

not deleting the branch though

avnerenv0 avatar Apr 02 '24 11:04 avnerenv0