Terraform Cloud run task: 500 Internal Server Error

  • ALM used (GitHub, Bitbucket Cloud, Azure DevOps)
  • CI system used (Bitbucket Cloud, Azure DevOps, Travis CI, Circle CI
  • Scanner command used when applicable (private details masked)
  • Languages of the repository
  • Only if the SonarCloud project is public, the URL
    • And if you need help with pull request decoration, then the URL to the PR too
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
    When running terraform plan:
Pre-plan Tasks:

All tasks completed! 0 passed, 1 failed           (4s elapsed)

│ SonarCloud ⸺   Errored (Advisory)
│ 500 Internal Server Error
│ Overall Result: Passed with advisory failures

Hello @Ari_Becker :grinning:

Welcome to our community! I’m sorry you are facing some issues using our Terraform Cloud integration so I’ll do my best to help you and solve this issue.

Could you please check if your project on SonarCloud, the one you are trying to configure on Terraform Cloud, has the New Code Definition set for the Quality Gate? I’m suspecting that might be the issue that is not clear from the error message causing the run task pre-plan to fail.

In the example below, this is a screenshot of a new project I added as an example on SonarCloud and since it’s new, it doesn’t have the New Code Definition set:

When I click on “Set New Code Definition”, it allows me to choose between these options:

After configuring the New Code Definition, please try again in Terraform Cloud to see if this solves the issue.

However, if the issue persists, could you please provide me a specific timestamp when the error happened and the name of your project?

Hi @aura ,

The New Code Definition was already set (to the previous version) and the quality gate is passing.

The most recent apply which triggered the 500 (during pre-plan for the apply) is today (July 10th) at 11:48:50 GMT, so the timestamp for the pre-plan would be within a few minutes before that.

Hello again @Ari_Becker !

Apologies for the delayed response, do you think you could try again with the purpose of generating more logs so I can check?

Thanks in advance!

Hi Aura,
I’ve tried again now, 13 July at approximately 7:51 AM GMT.

1 Like

Hello again @Ari_Becker

I have been trying to replicate your issue on my side without being able to do it so far, unfortunately.

I confirmed that if the issue was related to the HMAC key, you would receive a different type of error (403 Forbidden).

Is it possible, in the meantime, to delete all configurations in Terraform Cloud and start from scratch? Meaning, remove the SonarCloud Run Task from the project, delete the Run Task from the organization, create it again, and add it back?

I can understand it can be frustrating as it’s a straightforward configuration. I’ll keep trying to duplicate it.

Hello @Ari_Becker !

I wanted to catch up with you on this thread. I still haven’t been able to replicate the issue I’m afraid. Where you able to recreate all the configurations?