The idea for this problem came to me when I switched from Ubuntu to MacBook M1. I have tried to run my terraform plan as usual, but this time I got the error that template provider cannot be run on MacBook M1. After some time put in troubleshooting, I found out that the template provider was deprecated a long time ago 😅. This gave me the idea to write a Go program that will get all used terraform providers by executing terraform providers
command and then checking on the page of the terraform docs if it has a label that states that terraform provider has expired. To be able to run this in CI, the pipeline code exits with 1 status code if a deprecated terraform provider has been found.
You can find the code here
This Go program is using rod for web browser
When you run a pipeline that tests if terraform provider is deprecated and it finds one or more deprecated terraform provider/s, it will look like this:
[launcher.Browser]2023/06/23 17:38:34 Download: https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/1131003/chrome-linux.zip
[launcher.Browser]2023/06/23 17:38:35 Progress: 00%
[launcher.Browser]2023/06/23 17:38:36 Progress: 09%
[launcher.Browser]2023/06/23 17:38:37 Progress: 36%
[launcher.Browser]2023/06/23 17:38:38 Progress: 62%
[launcher.Browser]2023/06/23 17:38:39 Progress: 87%
[launcher.Browser]2023/06/23 17:38:39 Unzip: /home/vsts/.cache/rod/browser/chromium-1131003
[launcher.Browser]2023/06/23 17:38:39 Progress: 00%
[launcher.Browser]2023/06/23 17:38:40 Progress: 19%
[launcher.Browser]2023/06/23 17:38:41 Progress: 34%
[launcher.Browser]2023/06/23 17:38:42 Progress: 52%
[launcher.Browser]2023/06/23 17:38:43 Progress: 82%
[launcher.Browser]2023/06/23 17:38:44 Downloaded: /home/vsts/.cache/rod/browser/chromium-1131003
Provider azurerm is not deprecated.
Provider azuread is not deprecated.
Provider template is deprecated.
Provider random is not deprecated.
##[error]Bash exited with code '1'.