Some settings not found when trying to configure email via IaC

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube 10.3
  • how is SonarQube deployed: zip, Docker, Helm
    Helm
  • what are you trying to achieve
    Configure email settings via Terraform
  • what have you tried so far to achieve this
    Configure via terraform

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

I’m trying to configure the various email settings shown in the UI under Administration > Configuration > General:

email.smtp_host.secured
email.smtp_port.secured
email.smtp_secure_connection.secured
email.smtp_username.secured
email.smtp_password.secured
email.from
email.prefix
email.fromName

Example of how I’m setting these using Terraform:

resource "sonarqube_setting" "email_smtp_host" {
  key   = "email.smtp_host.secured"
  value = "smtp.sendgrid.net"
}

I’m using the jdamata/sonarqube v0.16 provider.

I get the following errors when trying to apply:
Error: resourceSonarqubeSettingsRead: Failed to find setting: email.smtp_host.secured
Error: resourceSonarqubeSettingsRead: Failed to find setting: email.smtp_port.secured
Error: resourceSonarqubeSettingsRead: Failed to find setting: email.smtp_secure_connection.secured
Error: resourceSonarqubeSettingsRead: Failed to find setting: email.smtp_username.secured

Hey there.

My suggestion would be to reach out directly to the maintainer of the terraform provider at GitHub - jdamata/terraform-provider-sonarqube: Terraform provider for managing Sonarqube configuration

Hi Colin,

I also tried setting the email settings directly in the helm to take the terraform provider out of the equation. This still yields the same errors.

sonarProperties:

  email.smtp_host.secured: xxxx
  email.smtp_port.secured: xxxx
  email.smtp_secure_connection.secured: xxxx
  email.smtp_username.secured: xxxx
  email.from: xxxx
  email.prefix: [SONARQUBE]
  email.fromName: SonarQube
  email.smtp_password.secured: xxxx

For reference: https://github.com/SonarSource/helm-chart-sonarqube/blob/87cf0af9db9e573476803b811f95edc7088169f6/charts/sonarqube/values.yaml#L403

I did get this working. I created a reusable terraform module to handle setting the secured properties.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.