diff --git a/go.mod b/go.mod index 9343bae5..8e2ad1ef 100644 --- a/go.mod +++ b/go.mod @@ -4,11 +4,12 @@ go 1.18 require ( github.com/hashicorp/go-cleanhttp v0.5.2 - github.com/hashicorp/go-retryablehttp v0.7.4 + github.com/hashicorp/go-retryablehttp v0.7.5 github.com/hashicorp/go-version v1.6.0 github.com/hashicorp/terraform-plugin-sdk/v2 v2.28.0 github.com/hashicorp/terraform-plugin-testing v1.5.1 github.com/satori/uuid v1.2.0 + golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 ) require ( @@ -18,7 +19,6 @@ require ( github.com/tidwall/pretty v1.2.0 // indirect github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect - golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 // indirect ) require ( @@ -62,6 +62,6 @@ require ( golang.org/x/text v0.13.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect - google.golang.org/grpc v1.56.1 // indirect + google.golang.org/grpc v1.56.3 // indirect google.golang.org/protobuf v1.31.0 // indirect ) diff --git a/go.sum b/go.sum index 5b697097..1cc2ae29 100644 --- a/go.sum +++ b/go.sum @@ -47,8 +47,8 @@ github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+l github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/go-plugin v1.4.10 h1:xUbmA4jC6Dq163/fWcp8P3JuHilrHHMLNRxzGQJ9hNk= github.com/hashicorp/go-plugin v1.4.10/go.mod h1:6/1TEzT0eQznvI/gV2CM29DLSkAK/e58mUWKVsPaph0= -github.com/hashicorp/go-retryablehttp v0.7.4 h1:ZQgVdpTdAL7WpMIwLzCfbalOcSUdkDZnpUv3/+BxzFA= -github.com/hashicorp/go-retryablehttp v0.7.4/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= +github.com/hashicorp/go-retryablehttp v0.7.5 h1:bJj+Pj19UZMIweq/iie+1u5YCdGrnxCT9yvm0e+Nd5M= +github.com/hashicorp/go-retryablehttp v0.7.5/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= @@ -173,8 +173,8 @@ google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6 google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= -google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= -google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.56.3 h1:8I4C0Yq1EjstUzUJzpcRVbuYA2mODtEmpWiQoN/b2nc= +google.golang.org/grpc v1.56.3/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/sonarqube/resource_sonarqube_alm_gitlab.go b/sonarqube/resource_sonarqube_alm_gitlab.go index e1f76573..a86dab4d 100644 --- a/sonarqube/resource_sonarqube_alm_gitlab.go +++ b/sonarqube/resource_sonarqube_alm_gitlab.go @@ -127,7 +127,7 @@ func resourceSonarqubeAlmGitlabUpdate(d *schema.ResourceData, m interface{}) err m.(*ProviderConfiguration).httpClient, "POST", sonarQubeURL.String(), - http.StatusOK, + http.StatusNoContent, "resourceSonarqubeAlmGitlabUpdate", ) if err != nil { diff --git a/sonarqube/resource_sonarqube_qualityprofile_project_association.go b/sonarqube/resource_sonarqube_qualityprofile_project_association.go index 703688e8..9425687b 100644 --- a/sonarqube/resource_sonarqube_qualityprofile_project_association.go +++ b/sonarqube/resource_sonarqube_qualityprofile_project_association.go @@ -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 @@ -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 + } } }