Skip to content

Commit

Permalink
fix: retrocompatibility break when v0.62.3 was released
Browse files Browse the repository at this point in the history
  • Loading branch information
david-ortiz-saez committed Oct 31, 2023
1 parent c8754ed commit d7dd453
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions sonarqube/resource_sonarqube_qualityprofile_project_association.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ func resourceSonarqubeQualityProfileProjectAssociationRead(d *schema.ResourceDat

// Id is composed of qualityProfile name and project name
idSlice := strings.Split(d.Id(), "/")

// Call api/qualityprofiles/search to return the qualityProfileID
sonarQubeURL := m.(*ProviderConfiguration).sonarQubeURL
sonarQubeURLSubPath := sonarQubeURL.Path
Expand All @@ -124,10 +123,18 @@ func resourceSonarqubeQualityProfileProjectAssociationRead(d *schema.ResourceDat

var qualityProfileID string
for _, value := range getQualityProfileResponse.Profiles {
if idSlice[0] == value.Name && idSlice[2] == value.Language {
qualityProfileID = value.Key
language = value.Language
qualityProfile = value.Name
if len(idSlice) == 3 {
if idSlice[0] == value.Name && idSlice[2] == value.Language {
qualityProfileID = value.Key
language = value.Language
qualityProfile = value.Name
}
} else {
if idSlice[0] == value.Name && d.Get("language").(string) == value.Language {
qualityProfileID = value.Key
language = value.Language
qualityProfile = value.Name
}
}
}

Expand Down

0 comments on commit d7dd453

Please sign in to comment.