diff options
| author | xuzhang3 <Zhangxu894765> | 2022-11-02 11:16:42 +0800 |
|---|---|---|
| committer | xuzhang3 <Zhangxu894765> | 2022-11-02 11:16:42 +0800 |
| commit | 06ecfef760a121b23ade54ff8e9456b7bab599e9 (patch) | |
| tree | 3621a5df1e6491b2ca11d50931cb227f42bc33ad | |
| parent | 2c788a0e7eb5a236e88f085ce9ae5b07ac655b96 (diff) | |
remote unused check and formmat doc
3 files changed, 21 insertions, 29 deletions
diff --git a/azuredevops/internal/acceptancetests/resource_serviceendpoint_sonarcloud_test.go b/azuredevops/internal/acceptancetests/resource_serviceendpoint_sonarcloud_test.go index 5197d8cd..46bede6f 100644 --- a/azuredevops/internal/acceptancetests/resource_serviceendpoint_sonarcloud_test.go +++ b/azuredevops/internal/acceptancetests/resource_serviceendpoint_sonarcloud_test.go @@ -52,7 +52,6 @@ func TestAccServiceEndpointSonarCloud_complete(t *testing.T) { Check: resource.ComposeTestCheckFunc( testutils.CheckServiceEndpointExistsWithName(tfSvcEpNode, serviceEndpointName), resource.TestCheckResourceAttrSet(tfSvcEpNode, "project_id"), - resource.TestCheckResourceAttrSet(tfSvcEpNode, "token_hash"), resource.TestCheckResourceAttr(tfSvcEpNode, "service_endpoint_name", serviceEndpointName), resource.TestCheckResourceAttr(tfSvcEpNode, "description", description), ), @@ -87,7 +86,6 @@ func TestAccServiceEndpointSonarCloud_update(t *testing.T) { Check: resource.ComposeTestCheckFunc( testutils.CheckServiceEndpointExistsWithName(tfSvcEpNode, serviceEndpointNameSecond), resource.TestCheckResourceAttrSet(tfSvcEpNode, "project_id"), - resource.TestCheckResourceAttrSet(tfSvcEpNode, "token_hash"), resource.TestCheckResourceAttr(tfSvcEpNode, "service_endpoint_name", serviceEndpointNameSecond), resource.TestCheckResourceAttr(tfSvcEpNode, "description", description), ), @@ -124,9 +122,9 @@ func TestAccServiceEndpointSonarCloud_RequiresImportErrorStep(t *testing.T) { func hclSvcEndpointSonarCloudResourceBasic(projectName string, serviceEndpointName string) string { serviceEndpointResource := fmt.Sprintf(` resource "azuredevops_serviceendpoint_sonarcloud" "test" { - project_id = azuredevops_project.project.id - service_endpoint_name = "%s" - token = "redacted" + project_id = azuredevops_project.project.id + service_endpoint_name = "%s" + token = "redacted" }`, serviceEndpointName) projectResource := testutils.HclProjectResource(projectName) @@ -136,10 +134,10 @@ resource "azuredevops_serviceendpoint_sonarcloud" "test" { func hclSvcEndpointSonarCloudResourceComplete(projectName string, serviceEndpointName string, description string) string { serviceEndpointResource := fmt.Sprintf(` resource "azuredevops_serviceendpoint_sonarcloud" "test" { - project_id = azuredevops_project.project.id - service_endpoint_name = "%s" - description = "%s" - token = "redacted" + project_id = azuredevops_project.project.id + service_endpoint_name = "%s" + description = "%s" + token = "redacted" }`, serviceEndpointName, description) projectResource := testutils.HclProjectResource(projectName) @@ -149,10 +147,10 @@ resource "azuredevops_serviceendpoint_sonarcloud" "test" { func hclSvcEndpointSonarCloudResourceUpdate(projectName string, serviceEndpointName string, description string) string { serviceEndpointResource := fmt.Sprintf(` resource "azuredevops_serviceendpoint_sonarcloud" "test" { - project_id = azuredevops_project.project.id - service_endpoint_name = "%s" - description = "%s" - token = "redacted2" + project_id = azuredevops_project.project.id + service_endpoint_name = "%s" + description = "%s" + token = "redacted2" }`, serviceEndpointName, description) projectResource := testutils.HclProjectResource(projectName) @@ -164,10 +162,10 @@ func hclSvcEndpointSonarCloudResourceRequiresImport(projectName string, serviceE return fmt.Sprintf(` %s resource "azuredevops_serviceendpoint_sonarcloud" "import" { - project_id = azuredevops_serviceendpoint_sonarcloud.test.project_id + project_id = azuredevops_serviceendpoint_sonarcloud.test.project_id service_endpoint_name = azuredevops_serviceendpoint_sonarcloud.test.service_endpoint_name - description = azuredevops_serviceendpoint_sonarcloud.test.description - token = "redacted" + description = azuredevops_serviceendpoint_sonarcloud.test.description + token = "redacted" } `, template) } diff --git a/azuredevops/internal/service/serviceendpoint/resource_serviceendpoint_sonarcloud.go b/azuredevops/internal/service/serviceendpoint/resource_serviceendpoint_sonarcloud.go index c023b6c9..c1b881bd 100644 --- a/azuredevops/internal/service/serviceendpoint/resource_serviceendpoint_sonarcloud.go +++ b/azuredevops/internal/service/serviceendpoint/resource_serviceendpoint_sonarcloud.go @@ -6,7 +6,6 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/microsoft/azure-devops-go-api/azuredevops/v6/serviceendpoint" "github.com/microsoft/terraform-provider-azuredevops/azuredevops/internal/utils/converter" - "github.com/microsoft/terraform-provider-azuredevops/azuredevops/internal/utils/tfhelper" ) // ResourceServiceEndpointSonarCloud schema and implementation for SonarCloud service endpoint resource @@ -14,17 +13,12 @@ func ResourceServiceEndpointSonarCloud() *schema.Resource { r := genBaseServiceEndpointResource(flattenServiceEndpointSonarCloud, expandServiceEndpointSonarCloud) r.Schema["token"] = &schema.Schema{ - Type: schema.TypeString, - Required: true, - Sensitive: true, - DiffSuppressFunc: tfhelper.DiffFuncSuppressSecretChanged, - ValidateFunc: validation.StringIsNotWhiteSpace, - Description: "Authentication Token generated through SonarCloud (go to My Account > Security > Generate Tokens)", + Type: schema.TypeString, + Required: true, + Sensitive: true, + ValidateFunc: validation.StringIsNotWhiteSpace, + Description: "Authentication Token generated through SonarCloud (go to My Account > Security > Generate Tokens)", } - // Add a spot in the schema to store the token secretly - stSecretHashKey, stSecretHashSchema := tfhelper.GenerateSecreteMemoSchema("token") - r.Schema[stSecretHashKey] = stSecretHashSchema - return r } diff --git a/website/docs/r/serviceendpoint_sonarcloud.html.markdown b/website/docs/r/serviceendpoint_sonarcloud.html.markdown index da839fa1..aea40f2a 100644 --- a/website/docs/r/serviceendpoint_sonarcloud.html.markdown +++ b/website/docs/r/serviceendpoint_sonarcloud.html.markdown @@ -33,7 +33,7 @@ The following arguments are supported: * `project_id` - (Required) The ID of the project. * `service_endpoint_name` - (Required) The Service Endpoint name. -* `token` - (Required) Authentication Token generated through SonarCloud (go to My Account > Security > Generate Tokens). +* `token` - (Required) Authentication Token generated through SonarCloud (go to `My Account > Security > Generate Tokens`). * `description` - (Optional) The Service Endpoint description. ## Attributes Reference @@ -48,7 +48,7 @@ The following attributes are exported: - [Azure DevOps Service REST API 6.0 - Endpoints](https://docs.microsoft.com/en-us/rest/api/azure/devops/serviceendpoint/endpoints?view=azure-devops-rest-6.0) - [Azure DevOps Service Connections](https://docs.microsoft.com/en-us/azure/devops/pipelines/library/service-endpoints?view=azure-devops&tabs=yaml) -- [SonarCloud User Token](https://docs.sonarcloud.org/latest/user-guide/user-token/) +- [SonarCloud User Token](https://docs.sonarcloud.io/advanced-setup/user-accounts/) ## Import Azure DevOps Service Endpoint SonarCloud can be imported using the **projectID/serviceEndpointID**, e.g. |
