How to run the sonar scanning with terraform

Hello All,

I am trying to run the sonar scanning on the terraform scripts on the sonarQube application. I am running the sonar scanner version 5.1 and the sonarQube version is 9.9. I am running the sonar-scanning on the env folder of the terraform where the root modules for the all the resources are located.

When I am running the sonar-scanning the scanning is running successfully but there is no coverage, bugs or code smells are showing on the sonar server.

Can someone please guide me how to get the coverage for the terraform scripts on the sonar server?

Hey there.

Is there a specific issue/rule you expect to be triggered on your Terraform files? Maybe there’s simply nothing wrong with them! I would welcome you to include a specific example.

As far as I’m aware, there’s no tools in the Terraform ecosystem that emit code coverage reports. As a result, you won’t be able to get coverage metrics for Terraform files.

1 Like