Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After redeploy sonarqube server, some settings are detected with error not as a drift #197

Open
humpalu opened this issue Sep 10, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@humpalu
Copy link

humpalu commented Sep 10, 2023

Hi there,

Thank you for opening an issue.

Terraform Version

Run terraform -v to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed.
Terraform v1.4.5

Affected Resource(s)

Please list the resources as a list, for example:

  • sonarqube_permissions
  • sonarqube_setting

Terraform Configuration Files

terraform {
   backend "s3" {
     bucket = "xxxx"
     key    = "xxxx/terraform.tfstate"
     region = "eu-central-1"
   }

  required_providers {
    sonarqube = {
      source = "jdamata/sonarqube"
    }
  }

}

resource "sonarqube_permissions" "admin_permission" {
  group_name  = "xxxxx-xxxxx-xxxxx-xxxxx"
  permissions = ["admin", "gateadmin", "profileadmin", "provisioning", "scan"]
}

resource "sonarqube_setting" "sonar_core_serverBaseURL" {
  key   = "sonar.core.serverBaseURL"
  value = var.sonarqube_host
}

resource "sonarqube_setting" "sonar_auth_saml_providerId" {
  key   = "sonar.auth.saml.providerId"
  value = "https://sts.windows.net/dxxxx-xxxx-xxxx-xxxx"
}

resource "sonarqube_setting" "sonar_auth_saml_loginUrl" {
  key   = "sonar.auth.saml.loginUrl"
  value = "https://login.microsoftonline.com/ddxxxx-xxxx-xxxx-xxxx/saml2"
}

Expected Behavior

After the redeploy of the server, these changes should be recognized as a drift and terraform tries to recreate them

Actual Behavior

error messages

│ Error: resourceSonarqubePermissionsRead: Unable to find group permissions for group: xxxxx-xxxxx-xxxxx-xxxxx
│ 
│   with sonarqube_permissions.admin_permission,
│   on main.tf line 52, in resource "sonarqube_permissions" "admin_permission":
│   52: resource "sonarqube_permissions" "admin_permission" {
│ 
╵
╷
│ Error: resourceSonarqubeSettingsRead: Failed to find setting: sonar.core.serverBaseURL
│ 
│   with sonarqube_setting.sonar_core_serverBaseURL,
│   on main.tf line 60, in resource "sonarqube_setting" "sonar_core_serverBaseURL":
│   60: resource "sonarqube_setting" "sonar_core_serverBaseURL" {
│ 
╵
╷
│ Error: resourceSonarqubeSettingsRead: Failed to find setting: sonar.auth.saml.providerId
│ 
│   with sonarqube_setting.sonar_auth_saml_providerId,
│   on main.tf line 87, in resource "sonarqube_setting" "sonar_auth_saml_providerId":
│   87: resource "sonarqube_setting" "sonar_auth_saml_providerId" {
│ 

│ Error: resourceSonarqubeSettingsRead: Failed to find setting: sonar.auth.saml.loginUrl
│ 
│   with sonarqube_setting.sonar_auth_saml_loginUrl,
│   on main.tf line 94, in resource "sonarqube_setting" "sonar_auth_saml_loginUrl":
│   94: resource "sonarqube_setting" "sonar_auth_saml_loginUrl" {
│ 

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform plan

References

Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:

  • GH-1234
@jdamata
Copy link
Owner

jdamata commented Sep 10, 2023

Looking for a clarification here on what redeploy means. Does that mean restart? Or a brand new deployment?

@humpalu
Copy link
Author

humpalu commented Sep 11, 2023

@jdamata
In this context deploy means, brand new deployment.

Currently if I redeploy the server, I need to
remove the sonarqube_setting resources from the .tfstate or create a new local state and migrate after the deployment

@jdamata jdamata added the bug Something isn't working label Sep 11, 2023
@Bastian82
Copy link

Ths issue hit me aswell. Steps to reproduce:

  • Im creating projects in TF
  • Im creating permissions for that projects
  • Doing some permission changes within a project manually (unclicking some groups that had permission granted by TF)
  • terraform plan

Error:

stderr: ╷
│ Error: resourceSonarqubePermissionsRead: Unable to find group permissions for group: d238ed49-35b9-4f38-9912-4f7a8bbd3d0b
│ 
│   with sonarqube_permissions.gitlab_sonarqube_permission_shared_group["it-integration-myproject"],
│   on main.tf line 28, in resource "sonarqube_permissions" "gitlab_sonarqube_permission_shared_group":
│   28: resource "sonarqube_permissions" "gitlab_sonarqube_permission_shared_group" {

It should detect drift not error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants