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

Provider initialization failing #226

Open
buddhamangler-cbre opened this issue Dec 11, 2023 · 2 comments
Open

Provider initialization failing #226

buddhamangler-cbre opened this issue Dec 11, 2023 · 2 comments
Labels
bug Something isn't working p1 High priority

Comments

@buddhamangler-cbre
Copy link

buddhamangler-cbre commented Dec 11, 2023

This provider (0.16.9) is not initializing correctly during the version and edition check...

We are using SonarQube 9.9.2.77730 with DataCenter edition deployed in K8s as a cluster of 3 nodes.

// If either of installed_version or installed_edition is not set, we need to fetch them from the API

The issue is the code is checking the system information here...

func sonarqubeSystemInfo(client *retryablehttp.Client, sonarqube url.URL) (string, string, error) {

It expects two properties out of the system information call it makes...

	sonarqubeVersion := gjson.GetBytes(responseData, "System.Version").String()
	sonarqubeEdition := gjson.GetBytes(responseData, "System.Edition").String()

The problem is that our SQ instance is returning this for that section in the json (with redactions)...

    "System": {
        "Server ID": "redacted",
        "Edition": "Data Center",
        "Lines of Code": 17105284,
        "Docker": false,
        "High Availability": true,
        "Accepted external identity providers": "Azure AD",
        "External identity providers whose users are allowed to sign themselves up": "Azure AD",
        "Force authentication": true
    },

As you can see, System.Version is not present. It is however present in another section of the returned json in each of the objects of an array with key "Application Nodes"...

{
   ...
    "Application Nodes": [
        {
            "Name": "redacted",
            "Host": "",
            "Health": "GREEN",
            "Health Causes": [],
            "System": {
                "Version": "9.9.2.77730",
                "Official Distribution": true,
                "Home Dir": "/opt/sonarqube",
                "Data Dir": "/opt/sonarqube/data",
                "Temp Dir": "/opt/sonarqube/temp",
                "Processors": 1
            },
            ...
      },
      ...
   ]
}

Perhaps the system information is returned this way in clusters? The system information check should account for this.

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.

N/A

Affected Resource(s)

Please list the resources as a list, for example:

  • provider initialization

Terraform Configuration Files

# Copy-paste your Terraform configurations here - for large Terraform configs,

N/A

Expected Behavior

What should have happened?

The provider initialization should have worked.

Actual Behavior

What actually happened?

 Error: -11T17:23:23.849Z [ERROR] provider.terraform-provider-sonarqube_v0.16.9: Response contains error diagnostic: tf_provider_addr=registry.terraform.io/jdamata/sonarqube tf_req_id=a0c0a2a2-f1e9-0a52-b79a-3cbf9a1fe066 @caller=github.com/hashicorp/[email protected]/tfprotov5/internal/diag/diagnostics.go:58 @module=sdk.proto diagnostic_summary="failed to convert sonarqube version to a version: Malformed version: " tf_proto_version=5.3 tf_rpc=Configure diagnostic_detail="" diagnostic_severity=ERROR timestamp=2023-12-11T17:23:23.849Z
Error: -11T17:23:23.850Z [ERROR] vertex "provider[\"registry.terraform.io/jdamata/sonarqube\"]" error: failed to convert sonarqube version to a version: Malformed version:

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:

  • None
@Lucatronlk
Copy link
Contributor

I have the same problem.

On Community or Enterprise, it works fine, just with the DataCenter edition it happens.

You can add installed_version and installed_edition to the provider as a quick fix.

image

@jdamata jdamata added the bug Something isn't working label Dec 18, 2023
@jdamata
Copy link
Owner

jdamata commented Dec 18, 2023

Thank you for the detailed write up! This looks like something that should definitely be fixed.

@jdamata jdamata added the p1 High priority label Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working p1 High priority
Projects
None yet
Development

No branches or pull requests

3 participants