From cd2594ff091697c56557dc139bdcc764a4193b78 Mon Sep 17 00:00:00 2001 From: Lorne Date: Wed, 16 Oct 2024 17:51:47 +0100 Subject: [PATCH 01/24] tf provider documentation update --- docs/data-sources/sonarqube_group.md | 10 +++++-- docs/data-sources/sonarqube_portfolio.md | 13 +++++++-- docs/data-sources/sonarqube_project.md | 11 ++++++-- docs/data-sources/sonarqube_qualitygate.md | 15 +++++++--- docs/data-sources/sonarqube_qualityprofile.md | 13 +++++++-- docs/data-sources/sonarqube_rule.md | 11 ++++++-- docs/data-sources/sonarqube_user.md | 12 ++++++-- docs/index.md | 17 ++++++++--- docs/resources/sonarqube_alm_azure.md | 10 ++++++- docs/resources/sonarqube_alm_github.md | 11 ++++++-- docs/resources/sonarqube_alm_gitlab.md | 11 ++++++-- docs/resources/sonarqube_azure_binding.md | 10 ++++++- docs/resources/sonarqube_github_binding.md | 12 ++++++-- docs/resources/sonarqube_gitlab_binding.md | 10 ++++++- docs/resources/sonarqube_group.md | 9 +++++- docs/resources/sonarqube_group_member.md | 9 +++++- docs/resources/sonarqube_new_code_periods.md | 9 +++++- .../sonarqube_permission_template.md | 10 ++++++- docs/resources/sonarqube_permissions.md | 9 +++++- docs/resources/sonarqube_plugin.md | 20 +++++++++++-- docs/resources/sonarqube_portfolio.md | 28 +++++++++++++------ docs/resources/sonarqube_project.md | 27 +++++++++++++----- .../sonarqube_project_main_branch.md | 18 ++++++++++-- docs/resources/sonarqube_qualitygate.md | 13 +++++++-- ...narqube_qualitygate_project_association.md | 19 ++++++++++--- ...rqube_qualitygate_usergroup_association.md | 15 ++++++++-- docs/resources/sonarqube_qualityprofile.md | 24 ++++++++++++---- .../sonarqube_qualityprofile_activate_rule.md | 13 +++++++-- ...qube_qualityprofile_project_association.md | 23 +++++++++++---- docs/resources/sonarqube_rules.md | 11 ++++++-- docs/resources/sonarqube_settings.md | 16 +++++++++-- docs/resources/sonarqube_user.md | 11 ++++++-- .../sonarqube_user_external_identity.md | 18 ++++++++---- docs/resources/sonarqube_user_token.md | 9 +++++- docs/resources/sonarqube_webhook.md | 12 ++++++-- 35 files changed, 393 insertions(+), 96 deletions(-) diff --git a/docs/data-sources/sonarqube_group.md b/docs/data-sources/sonarqube_group.md index f14c595f..eca06269 100644 --- a/docs/data-sources/sonarqube_group.md +++ b/docs/data-sources/sonarqube_group.md @@ -1,4 +1,11 @@ -# Data Source: sonarqube_group +--- +page_title: "sonarqube_group Data Source - terraform-provider-sonarqube" +subcategory: "" +description: |- + Use this data source to get a Sonarqube Group resource +--- + +# sonarqube_group (Data Source) Use this data source to get a Sonarqube Group resource @@ -10,7 +17,6 @@ data "sonarqube_group" "group" { } ``` - ## Argument Reference The following arguments are supported: diff --git a/docs/data-sources/sonarqube_portfolio.md b/docs/data-sources/sonarqube_portfolio.md index a30ae10d..8dfe4504 100644 --- a/docs/data-sources/sonarqube_portfolio.md +++ b/docs/data-sources/sonarqube_portfolio.md @@ -1,4 +1,11 @@ -# Data Source: sonarqube_portfolio +--- +page_title: "sonarqube_portfolio Data Source - terraform-provider-sonarqube" +subcategory: "" +description: |- + Use this data source to get a Sonarqube portfolio resource +--- + +# sonarqube_portfolio (Data Source) Use this data source to get a Sonarqube portfolio resource @@ -24,7 +31,7 @@ The following attributes are exported: - description - Description of the portfolio - qualifier - `VW` (portfolios always have this qualifier) - visibility - Portfolio visibility -- selection_mode - How the Portfolio is populated. Possible values are ``NONE``, ``MANUAL``, ``TAGS``, ``REGEXP`` or ``REST``. [See docs](https://docs.sonarqube.org/9.8/project-administration/managing-portfolios/#populating-portfolios) for how Portfolio population works +- selection_mode - How the Portfolio is populated. Possible values are `NONE`, `MANUAL`, `TAGS`, `REGEXP` or `REST`. [See docs](https://docs.sonarqube.org/9.8/project-administration/managing-portfolios/#populating-portfolios) for how Portfolio population works - branch - Which branch is analyzed - tags - The list of tags used to populate the Portfolio. Only active when `selection_mode` is `TAGS` -- regexp - The regular expression used to populate the portfolio. Only active when `selection_mode` is `REGEXP` \ No newline at end of file +- regexp - The regular expression used to populate the portfolio. Only active when `selection_mode` is `REGEXP` diff --git a/docs/data-sources/sonarqube_project.md b/docs/data-sources/sonarqube_project.md index c81d1ad5..c4f61d09 100644 --- a/docs/data-sources/sonarqube_project.md +++ b/docs/data-sources/sonarqube_project.md @@ -1,4 +1,11 @@ -# Data Source: sonarqube_project +--- +page_title: "sonarqube_project Data Source - terraform-provider-sonarqube" +subcategory: "" +description: |- + Use this data source to get a Sonarqube project resource +--- + +# sonarqube_project (Data Source) Use this data source to get a Sonarqube project resource @@ -22,4 +29,4 @@ The following attributes are exported: - name - Name of the project - project - Key of the project -- visibility - Project visibility \ No newline at end of file +- visibility - Project visibility diff --git a/docs/data-sources/sonarqube_qualitygate.md b/docs/data-sources/sonarqube_qualitygate.md index 814422ab..34a16dbf 100644 --- a/docs/data-sources/sonarqube_qualitygate.md +++ b/docs/data-sources/sonarqube_qualitygate.md @@ -1,4 +1,11 @@ -# Data Source: sonarqube_qualitygate +--- +page_title: "sonarqube_qualitygate Data Source - terraform-provider-sonarqube" +subcategory: "" +description: |- + Use this data source to get a Sonarqube qualitygate resource +--- + +# sonarqube_qualitygate (Data Source) Use this data source to get a Sonarqube qualitygate resource @@ -20,7 +27,7 @@ The following arguments are supported: The following attributes are exported: -- name - The name of the Quality Gate. -- copy_from - Origin of Quality Gate. +- name - The name of the Quality Gate. +- copy_from - Origin of Quality Gate. - is_default - Quality Gate default. -- condition - List of Quality Gate conditions. +- condition - List of Quality Gate conditions. diff --git a/docs/data-sources/sonarqube_qualityprofile.md b/docs/data-sources/sonarqube_qualityprofile.md index cbf0030c..81021efa 100644 --- a/docs/data-sources/sonarqube_qualityprofile.md +++ b/docs/data-sources/sonarqube_qualityprofile.md @@ -1,4 +1,11 @@ -# Data Source: sonarqube_qualityprofile +--- +page_title: "sonarqube_qualityprofile Data Source - terraform-provider-sonarqube" +subcategory: "" +description: |- + Use this data source to get a Sonarqube qualityprofile resource +--- + +# sonarqube_qualityprofile (Data Source) Use this data source to get a Sonarqube qualityprofile resource @@ -20,6 +27,6 @@ The following arguments are supported: The following attributes are exported: -- name - The name of the Quality Profile -- language - Quality profile language. +- name - The name of the Quality Profile +- language - Quality profile language. - is_default - Quality Profile default diff --git a/docs/data-sources/sonarqube_rule.md b/docs/data-sources/sonarqube_rule.md index e9288368..2d309d72 100644 --- a/docs/data-sources/sonarqube_rule.md +++ b/docs/data-sources/sonarqube_rule.md @@ -1,4 +1,11 @@ -# Data Source: sonarqube_rule +--- +page_title: "sonarqube_rule Data Source - terraform-provider-sonarqube" +subcategory: "" +description: |- + Use this data source to get a Sonarqube rule resource +--- + +# sonarqube_rule (Data Source) Use this data source to get a Sonarqube rule resource @@ -25,4 +32,4 @@ The following attributes are exported: - severity - Rule severity - status - Rule status - template_key - Key of the template rule -- type - Rule type \ No newline at end of file +- type - Rule type diff --git a/docs/data-sources/sonarqube_user.md b/docs/data-sources/sonarqube_user.md index 1e048154..2a1a5cda 100644 --- a/docs/data-sources/sonarqube_user.md +++ b/docs/data-sources/sonarqube_user.md @@ -1,4 +1,11 @@ -# Data Source: sonarqube_user +--- +page_title: "sonarqube_user Data Source - terraform-provider-sonarqube" +subcategory: "" +description: |- + Use this data source to get a Sonarqube User resource +--- + +# sonarqube_user (Data Source) Use this data source to get a Sonarqube User resource @@ -10,7 +17,6 @@ data "sonarqube_user" "user" { } ``` - ## Argument Reference The following arguments are supported: @@ -23,4 +29,4 @@ The following attributes are exported: - id - The ID of the User. - login_name - The login name of the user -- email - The users email. \ No newline at end of file +- email - The users email. diff --git a/docs/index.md b/docs/index.md index 4f3ff522..29eb3c0e 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,8 +1,15 @@ +--- +page_title: "Sonarqube Provider" +subcategory: "" +description: |- +--- + # Provider configuration The sonarqube provider is used to configure sonarqube. The provider needs to be configured with a url, and either with user and password or token. ## Example: Authenticate with username and password + ```terraform terraform { required_providers { @@ -14,12 +21,13 @@ terraform { provider "sonarqube" { user = "admin" - pass = "admin" + pass = "admin" host = "http://127.0.0.1:9000" } ``` ## Example: Authenticate with token + ```terraform terraform { required_providers { @@ -36,15 +44,16 @@ provider "sonarqube" { ``` ## Argument Reference + The following arguments are supported: - `user` - (Optional) Sonarqube user. This can also be set via the `SONARQUBE_USER` environment variable. - `pass` - (Optional) Sonarqube pass. This can also be set via the `SONARQUBE_PASS` environment variable. - `token` - (Optional) Sonarqube token. This can also be set via the `SONARQUBE_TOKEN` environment variable. - `host` - (Required) Sonarqube url. This can be also be set via the `SONARQUBE_HOST` environment variable. -- `installed_version` - (Optional) The version of the Sonarqube server. When specified, the provider will avoid requesting this from the +- `installed_version` - (Optional) The version of the Sonarqube server. When specified, the provider will avoid requesting this from the server during the initialization process. This can be helpful when using the same Terraform code to install Sonarqube and configure it. -- `tls_insecure_skip_verify` - (Optional) Allows ignoring insecure certificates when set to true. Defaults to false. Disabling TLS verification +- `tls_insecure_skip_verify` - (Optional) Allows ignoring insecure certificates when set to true. Defaults to false. Disabling TLS verification is dangerous and should only be done for local testing. -- `anonymize_user_on_delete` - (Optional) Allows anonymizing users on destroy. Requires Sonarqube version >= `9.7`. This can be helpful +- `anonymize_user_on_delete` - (Optional) Allows anonymizing users on destroy. Requires Sonarqube version >= `9.7`. This can be helpful to comply with regulations like [GDPR](https://en.wikipedia.org/wiki/General_Data_Protection_Regulation). diff --git a/docs/resources/sonarqube_alm_azure.md b/docs/resources/sonarqube_alm_azure.md index 3a873351..0f3bd10e 100644 --- a/docs/resources/sonarqube_alm_azure.md +++ b/docs/resources/sonarqube_alm_azure.md @@ -1,4 +1,12 @@ -# sonarqube_alm_azure +--- +page_title: "sonarqube_alm_azure Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Azure Devops Alm/Devops Platform Integration resource. This can be used to create and manage a Alm/Devops + Platform Integration for Azure Devops. +--- + +# sonarqube_alm_azure (Resource) Provides a Sonarqube Azure Devops Alm/Devops Platform Integration resource. This can be used to create and manage a Alm/Devops Platform Integration for Azure Devops. diff --git a/docs/resources/sonarqube_alm_github.md b/docs/resources/sonarqube_alm_github.md index dbfff025..b0ee6818 100644 --- a/docs/resources/sonarqube_alm_github.md +++ b/docs/resources/sonarqube_alm_github.md @@ -1,4 +1,12 @@ -# sonarqube_alm_github +--- +page_title: "sonarqube_alm_github Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube GitHub Alm/Devops Platform Integration resource. This can be used to create and manage a Alm/Devops + Platform Integration for GitHub. +--- + +# sonarqube_alm_github (Resource) Provides a Sonarqube GitHub Alm/Devops Platform Integration resource. This can be used to create and manage a Alm/Devops Platform Integration for GitHub. @@ -37,4 +45,3 @@ The following attributes are exported: - client_id - GitHub App Client ID. - key - The unique key of the GitHub instance setting. - url - GitHub API URL. - diff --git a/docs/resources/sonarqube_alm_gitlab.md b/docs/resources/sonarqube_alm_gitlab.md index 89ee5e19..b72edeeb 100644 --- a/docs/resources/sonarqube_alm_gitlab.md +++ b/docs/resources/sonarqube_alm_gitlab.md @@ -1,4 +1,12 @@ -# sonarqube_alm_gitlab +--- +page_title: "sonarqube_alm_gitlab Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube GitLab Alm/Devops Platform Integration resource. This can be used to create and manage a Alm/Devops + Platform Integration for GitLab. +--- + +# sonarqube_alm_gitlab (Resource) Provides a Sonarqube GitLab Alm/Devops Platform Integration resource. This can be used to create and manage a Alm/Devops Platform Integration for GitLab. @@ -27,4 +35,3 @@ The following attributes are exported: - key - The unique key of the GitLab instance setting. - url - GitLab API URL. - diff --git a/docs/resources/sonarqube_azure_binding.md b/docs/resources/sonarqube_azure_binding.md index 5fb9ce9b..68b9b94b 100644 --- a/docs/resources/sonarqube_azure_binding.md +++ b/docs/resources/sonarqube_azure_binding.md @@ -1,4 +1,12 @@ -# sonarqube_azure_binding +--- +page_title: "sonarqube_azure_binding Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Azure Devops binding resource. This can be used to create and manage the binding between an + Azure Devops repository and a SonarQube project +--- + +# sonarqube_azure_binding (Resource) Provides a Sonarqube Azure Devops binding resource. This can be used to create and manage the binding between an Azure Devops repository and a SonarQube project diff --git a/docs/resources/sonarqube_github_binding.md b/docs/resources/sonarqube_github_binding.md index 55124585..6cfdf558 100644 --- a/docs/resources/sonarqube_github_binding.md +++ b/docs/resources/sonarqube_github_binding.md @@ -1,4 +1,12 @@ -# sonarqube_github_binding +--- +page_title: "sonarqube_github_binding Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube GitHub binding resource. This can be used to create and manage the binding between a + GitHub repository and a SonarQube project +--- + +# sonarqube_github_binding (Resource) Provides a Sonarqube GitHub binding resource. This can be used to create and manage the binding between a GitHub repository and a SonarQube project @@ -52,4 +60,4 @@ Bindings can be imported using their ID ```terraform terraform import sonarqube_github_binding.github-binding project/repository -``` \ No newline at end of file +``` diff --git a/docs/resources/sonarqube_gitlab_binding.md b/docs/resources/sonarqube_gitlab_binding.md index 7be9ed4e..cfff9faa 100644 --- a/docs/resources/sonarqube_gitlab_binding.md +++ b/docs/resources/sonarqube_gitlab_binding.md @@ -1,4 +1,12 @@ -# sonarqube_gitlab_binding +--- +page_title: "sonarqube_gitlab_binding Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube GitLab binding resource. This can be used to create and manage the binding between a + GitLab repository and a SonarQube project +--- + +# sonarqube_gitlab_binding (Resource) Provides a Sonarqube GitLab binding resource. This can be used to create and manage the binding between a GitLab repository and a SonarQube project diff --git a/docs/resources/sonarqube_group.md b/docs/resources/sonarqube_group.md index a0256838..9f579bb8 100644 --- a/docs/resources/sonarqube_group.md +++ b/docs/resources/sonarqube_group.md @@ -1,4 +1,11 @@ -# sonarqube_group +--- +page_title: "sonarqube_group Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Group resource. This can be used to create and manage Sonarqube Groups. +--- + +# sonarqube_group (Resource) Provides a Sonarqube Group resource. This can be used to create and manage Sonarqube Groups. diff --git a/docs/resources/sonarqube_group_member.md b/docs/resources/sonarqube_group_member.md index b4c5d212..1026ee60 100644 --- a/docs/resources/sonarqube_group_member.md +++ b/docs/resources/sonarqube_group_member.md @@ -1,4 +1,11 @@ -# sonarqube_group_member +--- +page_title: "sonarqube_group_member Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Group Member resource. This can be used to add or remove user to or from Sonarqube Groups. +--- + +# sonarqube_group_member (Resource) Provides a Sonarqube Group Member resource. This can be used to add or remove user to or from Sonarqube Groups. diff --git a/docs/resources/sonarqube_new_code_periods.md b/docs/resources/sonarqube_new_code_periods.md index eaa9170a..521788a8 100644 --- a/docs/resources/sonarqube_new_code_periods.md +++ b/docs/resources/sonarqube_new_code_periods.md @@ -1,4 +1,11 @@ -# sonarqube_new_code_periods +--- +page_title: "sonarqube_new_code_periods Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube New Code Periods resource. This can be used to manage Sonarqube New Code Periods. +--- + +# sonarqube_new_code_periods (Resource) Provides a Sonarqube New Code Periods resource. This can be used to manage Sonarqube New Code Periods. diff --git a/docs/resources/sonarqube_permission_template.md b/docs/resources/sonarqube_permission_template.md index 6a46d831..aab0d3c4 100644 --- a/docs/resources/sonarqube_permission_template.md +++ b/docs/resources/sonarqube_permission_template.md @@ -1,4 +1,12 @@ -# sonarqube_permission_template +--- +page_title: "sonarqube_permission_template Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Permission template resource. This can be used to create and manage Sonarqube Permission + templates. +--- + +# sonarqube_permission_template (Resource) Provides a Sonarqube Permission template resource. This can be used to create and manage Sonarqube Permission templates. diff --git a/docs/resources/sonarqube_permissions.md b/docs/resources/sonarqube_permissions.md index 5112a8e8..2bfb3083 100644 --- a/docs/resources/sonarqube_permissions.md +++ b/docs/resources/sonarqube_permissions.md @@ -1,4 +1,11 @@ -# sonarqube_permissions +--- +page_title: "sonarqube_permissions Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Permissions resource. This can be used to manage global and project permissions. +--- + +# sonarqube_permissions (Resource) Provides a Sonarqube Permissions resource. This can be used to manage global and project permissions. diff --git a/docs/resources/sonarqube_plugin.md b/docs/resources/sonarqube_plugin.md index b8ccb872..0abc9582 100644 --- a/docs/resources/sonarqube_plugin.md +++ b/docs/resources/sonarqube_plugin.md @@ -1,7 +1,16 @@ -# sonarqube_plugin +--- +page_title: "sonarqube_plugin Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Plugin resource. This can be used to create and manage Sonarqube Plugins. +--- + +# sonarqube_plugin (Resource) + Provides a Sonarqube Plugin resource. This can be used to create and manage Sonarqube Plugins. ## Example: create a project + ```terraform resource "sonarqube_plugin" "main" { key = "cloudformation" @@ -9,15 +18,19 @@ resource "sonarqube_plugin" "main" { ``` ## Argument Reference + The following arguments are supported: - key - (Required) The key identifying the plugin to uninstall ## Attributes Reference + The following attributes are exported: + - key - (Required) The key identifying the plugin to uninstall -## Import +## Import + Projects can be imported using their plugin key ```terraform @@ -25,4 +38,5 @@ terraform import sonarqube_plugin.main key ``` ## Notes -After installing or uninstalling a plugin, the sonarqube server needs to be restarted. \ No newline at end of file + +After installing or uninstalling a plugin, the sonarqube server needs to be restarted. diff --git a/docs/resources/sonarqube_portfolio.md b/docs/resources/sonarqube_portfolio.md index 66617af2..74216a9b 100644 --- a/docs/resources/sonarqube_portfolio.md +++ b/docs/resources/sonarqube_portfolio.md @@ -1,7 +1,16 @@ -# sonarqube_portfolio -Provides a Sonarqube Portfolio resource. This can be used to create and manage Sonarqube Portfolio. Note that the SonarQube API for Portfolios is called ``views`` +--- +page_title: "sonarqube_portfolio Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Portfolio resource. This can be used to create and manage Sonarqube Portfolio. Note that the SonarQube API for Portfolios is called ``views`` +--- + +# sonarqube_portfolio (Resource) + +Provides a Sonarqube Portfolio resource. This can be used to create and manage Sonarqube Portfolio. Note that the SonarQube API for Portfolios is called `views` ## Example: create a portfolio + ```terraform resource "sonarqube_portfolio" "main" { key = "portfolio-key" @@ -11,24 +20,25 @@ resource "sonarqube_portfolio" "main" { ``` ## Argument Reference + The following arguments are supported: - key - (Required) The key of the Portfolio to create - name - (Required) The name of the Portfolio to create - description - (Required) A description of the Portfolio to create - visibility - (Optional) Whether the created portfolio should be visible to everyone, or only specific user/groups. If no visibility is specified, the default portfolio visibility will be `public`. -- selection_mode - (Optional) How to populate the Portfolio to create. Possible values are ``NONE``, ``MANUAL``, ``TAGS``, ``REGEXP`` or ``REST``. [See docs](https://docs.sonarqube.org/9.8/project-administration/managing-portfolios/#populating-portfolios) for how Portfolio population works +- selection_mode - (Optional) How to populate the Portfolio to create. Possible values are `NONE`, `MANUAL`, `TAGS`, `REGEXP` or `REST`. [See docs](https://docs.sonarqube.org/9.8/project-administration/managing-portfolios/#populating-portfolios) for how Portfolio population works - branch - (Optional) Which branch to analyze. If nothing, or "" is specified, the main branch is used. - tags - (Optional) List of Project tags to populate the Portfolio from. Only active when `selection_mode` is `TAGS` - regexp - (Optional) A regular expression that is used to match Projects with a matching name OR key. If they match, they are added to the Portfolio -- ``selected_projects`` - (Optional) Block set of projects to add to the portfolio. Only active when `selection_mode` is `MANUAL`. See [below for nested schema](#selected_projects) +- `selected_projects` - (Optional) Block set of projects to add to the portfolio. Only active when `selection_mode` is `MANUAL`. See [below for nested schema](#selected_projects) ### selected_projects The `selected_projects` block supports the following: -* `project_key` - (Required) The key of a project to add to the portfolio -* `selected_branches` (Optional) A list of branches of the project to add to the portfolio. Defaults to the `MAIN BRANCH` of the repo if omitted +- `project_key` - (Required) The key of a project to add to the portfolio +- `selected_branches` (Optional) A list of branches of the project to add to the portfolio. Defaults to the `MAIN BRANCH` of the repo if omitted Here is an example of how this option can be leveraged: @@ -52,14 +62,16 @@ resource "sonarqube_portfolio" "portfolio" { ``` ## Attributes Reference + The following attributes are exported in addition to the arguments above: + - qualifier - (Computed) Key of the portfolio (`VW` for views) - projects - (Computed) List of projects in the portfolio (only when `selection_mode` is `MANUAL`) -## Import +## Import + Portfolios can be imported using their portfolio key ```terraform terraform import sonarqube_portfolio.main my_portfolio ``` - diff --git a/docs/resources/sonarqube_project.md b/docs/resources/sonarqube_project.md index 58e624a4..0afeea20 100644 --- a/docs/resources/sonarqube_project.md +++ b/docs/resources/sonarqube_project.md @@ -1,21 +1,31 @@ -# sonarqube_project +--- +page_title: "sonarqube_project Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Project resource. This can be used to create and manage Sonarqube Project. +--- + +# sonarqube_project (Resource) + Provides a Sonarqube Project resource. This can be used to create and manage Sonarqube Project. ## Example: create a project + ```terraform resource "sonarqube_project" "main" { name = "SonarQube" project = "my_project" - visibility = "public" + visibility = "public" } ``` ## Example: a project with associated settings + ```terraform resource "sonarqube_project" "main" { name = "SonarQube" project = "my_project" - visibility = "public" + visibility = "public" setting { key = "sonar.demo" @@ -25,11 +35,12 @@ resource "sonarqube_project" "main" { ``` ## Argument Reference + The following arguments are supported: - name - (Required) The name of the Project to create - project - (Required) Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon. -- visibility - (Optional) Whether the created project should be visible to everyone, or only specific user/groups. If no visibility is specified, the default project visibility of the organization will be used. Valid values are `public` and `private`. +- visibility - (Optional) Whether the created project should be visible to everyone, or only specific user/groups. If no visibility is specified, the default project visibility of the organization will be used. Valid values are `public` and `private`. - tags - (Optional) A list of tags to put on the project. - setting - (Optional) The definition of a Setting to be used by this Portfolio as documented in the `setting` block below. @@ -40,16 +51,18 @@ A `setting` block supports: - values - (Optional) Multi-valued setting values - field_values - (Optional) Multi-field setting values -One of value, values, field_values _must_ be supplied +One of value, values, field*values \_must* be supplied ## Attributes Reference + The following attributes are exported: + - project - (Required) Key of the project -## Import +## Import + Projects can be imported using their project key ```terraform terraform import sonarqube_project.main my_project ``` - diff --git a/docs/resources/sonarqube_project_main_branch.md b/docs/resources/sonarqube_project_main_branch.md index 300cd171..7a862f58 100644 --- a/docs/resources/sonarqube_project_main_branch.md +++ b/docs/resources/sonarqube_project_main_branch.md @@ -1,12 +1,21 @@ -# sonarqube_project_main_branch +--- +page_title: "sonarqube_project_main_branch Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Project main branch resource. This can be used to create and manage a Sonarqube Projects main branch. +--- + +# sonarqube_project_main_branch (Resource) + Provides a Sonarqube Project main branch resource. This can be used to create and manage a Sonarqube Projects main branch. ## Example: Change the name of the main branch + ```terraform resource "sonarqube_project" "main" { name = "SonarQube" project = "my_project" - visibility = "public" + visibility = "public" } resource "sonarqube_project_main_branch" "mybranch" { name = "release" @@ -15,13 +24,16 @@ resource "sonarqube_project_main_branch" "mybranch" { ``` ## Argument Reference + The following arguments are supported: - name - (Required) The name you want the main branch to have. - project - (Required) Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon. ## Attributes Reference + The following attributes are exported: + - name - The name of the main branch - project - Key of the project @@ -31,4 +43,4 @@ Main branch can be imported using their ID ```terraform terraform import sonarqube_project_main_branch.mybranch project/name -``` \ No newline at end of file +``` diff --git a/docs/resources/sonarqube_qualitygate.md b/docs/resources/sonarqube_qualitygate.md index 5b56c742..994b3116 100644 --- a/docs/resources/sonarqube_qualitygate.md +++ b/docs/resources/sonarqube_qualitygate.md @@ -1,4 +1,11 @@ -# sonarqube_qualitygate +--- +page_title: "sonarqube_qualitygate Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Quality Gate resource. This can be used to create and manage Sonarqube Quality Gates and their Conditions. +--- + +# sonarqube_qualitygate (Resource) Provides a Sonarqube Quality Gate resource. This can be used to create and manage Sonarqube Quality Gates and their Conditions. @@ -30,13 +37,14 @@ The following arguments are supported: - name - (Required) The name of the Quality Gate to create. Maximum length 100 - copy_from - (Optional) Name of an existing Quality Gate to copy from - is_default - (Optional) When set to true this will make the added Quality Gate default -- condition - (Required) The definition of a Condition to be used by this Quality Gate as documented in the `condition` block below. At least one condition is required for a Quality Gate. +- condition - (Required) The definition of a Condition to be used by this Quality Gate as documented in the `condition` block below. At least one condition is required for a Quality Gate. A `condition` block supports: - metric - (Required) Condition metric. Only metrics of the following types are allowed: + - INT - MILLISEC - RATING @@ -46,6 +54,7 @@ A `condition` block supports: - LEVEL. The following metrics are forbidden: + - alert_status - security_hotspots - new_security_hotspots diff --git a/docs/resources/sonarqube_qualitygate_project_association.md b/docs/resources/sonarqube_qualitygate_project_association.md index 03ba0001..d86bc264 100644 --- a/docs/resources/sonarqube_qualitygate_project_association.md +++ b/docs/resources/sonarqube_qualitygate_project_association.md @@ -1,7 +1,16 @@ -# sonarqube_qualitygate_project_association +--- +page_title: "sonarqube_qualitygate_project_association Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Quality Gate Project association resource. This can be used to associate a Quality Gate to a Project +--- + +# sonarqube_qualitygate_project_association (Resource) + Provides a Sonarqube Quality Gate Project association resource. This can be used to associate a Quality Gate to a Project ## Example: create a quality gate project association + ```terraform resource "sonarqube_qualitygate" "main" { name = "my_qualitygate" @@ -16,7 +25,7 @@ resource "sonarqube_qualitygate" "main" { resource "sonarqube_project" "main" { name = "SonarQube" project = "my_project" - visibility = "public" + visibility = "public" } resource "sonarqube_qualitygate_project_association" "main" { @@ -26,14 +35,16 @@ resource "sonarqube_qualitygate_project_association" "main" { ``` ## Argument Reference + The following arguments are supported: - gatename - (Required) The name of the Quality Gate - projectkey - (Required) Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon. -## Import +## Import + Quality Gates Project Associations can be imported using a combination of quality gate name and project key ```terraform terraform import sonarqube_qualitygate_project_association.main my_qualitygate/my_project -``` \ No newline at end of file +``` diff --git a/docs/resources/sonarqube_qualitygate_usergroup_association.md b/docs/resources/sonarqube_qualitygate_usergroup_association.md index f3e037ab..e1046bf6 100644 --- a/docs/resources/sonarqube_qualitygate_usergroup_association.md +++ b/docs/resources/sonarqube_qualitygate_usergroup_association.md @@ -1,9 +1,18 @@ -# sonarqube_qualitygate_usergroup_association +--- +page_title: "sonarqube_qualitygate_usergroup_association Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Quality Gate Usergroup association resource. This can be used to associate a Quality Gate to an User or to a Group. + The feature is available on SonarQube 9.2 or newer. +--- + +# sonarqube_qualitygate_usergroup_association (Resource) Provides a Sonarqube Quality Gate Usergroup association resource. This can be used to associate a Quality Gate to an User or to a Group. The feature is available on SonarQube 9.2 or newer. ## Example: create a quality gate group association + ```terraform resource "sonarqube_qualitygate" "main" { name = "my_qualitygate" @@ -27,6 +36,7 @@ resource "sonarqube_qualitygate_usergroup_association" "main" { ``` ## Example: create a quality gate user association + ```terraform resource "sonarqube_qualitygate" "main" { name = "my_qualitygate" @@ -51,6 +61,7 @@ resource "sonarqube_qualitygate_usergroup_association" "main" { ``` ## Argument Reference + The following arguments are supported: - `gatename` - (Required) The name of the Quality Gate @@ -65,4 +76,4 @@ The following attributes are exported: ## Import -Import is not required because SonarQube overwrites existing associations. \ No newline at end of file +Import is not required because SonarQube overwrites existing associations. diff --git a/docs/resources/sonarqube_qualityprofile.md b/docs/resources/sonarqube_qualityprofile.md index dc2fa091..9e18b157 100644 --- a/docs/resources/sonarqube_qualityprofile.md +++ b/docs/resources/sonarqube_qualityprofile.md @@ -1,7 +1,16 @@ -# sonarqube_qualityprofile +--- +page_title: "sonarqube_qualityprofile Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Quality Profile resource. This can be used to create and manage Sonarqube Quality Profiles. +--- + +# sonarqube_qualityprofile (Resource) + Provides a Sonarqube Quality Profile resource. This can be used to create and manage Sonarqube Quality Profiles. ## Example: create a quality profile + ```terraform resource "sonarqube_qualityprofile" "main" { name = "example" @@ -12,23 +21,26 @@ resource "sonarqube_qualityprofile" "main" { ``` ## Argument Reference + The following arguments are supported: -- name - (Required) The name of the Quality Profile to create. Maximum length 100 +- name - (Required) The name of the Quality Profile to create. Maximum length 100 - language - (Required) Quality profile language. Must be one of "cs", "css", "flex", "go", "java", "js", "jsp", "kotlin", "php", "py", "ruby", "scala", "ts", "vbnet", "web", "xml" - is_default - (Optional) When set to true this will make the added Quality Profile default - parent - (Optional) When a parent is provided the quality profile will inherit it's rules ## Attributes Reference + The following attributes are exported: - name - Name of the Sonarqube Quality Profile -- id - ID of the Sonarqube Quality Profile -- key - ID of the Sonarqube Quality Profile +- id - ID of the Sonarqube Quality Profile +- key - ID of the Sonarqube Quality Profile + +## Import -## Import Quality Profiles can be imported using their ID ```terraform terraform import sonarqube_qualityprofile.main AU-Tpxb--iU5OvuD2FLy -``` \ No newline at end of file +``` diff --git a/docs/resources/sonarqube_qualityprofile_activate_rule.md b/docs/resources/sonarqube_qualityprofile_activate_rule.md index ca53a426..b3a55f31 100644 --- a/docs/resources/sonarqube_qualityprofile_activate_rule.md +++ b/docs/resources/sonarqube_qualityprofile_activate_rule.md @@ -1,4 +1,11 @@ -# sonarqube_qualityprofile_activate_rule +--- +page_title: "sonarqube_qualityprofile_activate_rule Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Rules resource. This can be used to manage Sonarqube rules. +--- + +# sonarqube_qualityprofile_activate_rule (Resource) Provides a Sonarqube Rules resource. This can be used to manage Sonarqube rules. @@ -8,7 +15,7 @@ Provides a Sonarqube Rules resource. This can be used to manage Sonarqube rules. resource "sonarqube_rule" "allowed_maven_dependencies" { custom_key = "Only_use_allowed_Maven_dependencies" - markdown_description = "Description" + markdown_description = "Description" name = "Only use allowed Maven dependencies" params = "FilePattern=**/pom.xml" severity = "BLOCKER" @@ -36,7 +43,7 @@ resource "sonarqube_qualityprofile_activate_rule" "xml_rule" { The following arguments are supported -- key - (Required) Quality Profile key. Can be obtained through api/qualityprofiles/search +- key - (Required) Quality Profile key. Can be obtained through api/qualityprofiles/search - params - (Optional) Parameters as semi-colon list of key=value. Ignored if parameter reset is true. - reset - (Optional) Reset severity and parameters of activated rule. Set the values defined on parent profile or from rule default values. - Possible values true false yes no (Default false) diff --git a/docs/resources/sonarqube_qualityprofile_project_association.md b/docs/resources/sonarqube_qualityprofile_project_association.md index cb207423..9d1b5d7c 100644 --- a/docs/resources/sonarqube_qualityprofile_project_association.md +++ b/docs/resources/sonarqube_qualityprofile_project_association.md @@ -1,7 +1,16 @@ -# sonarqube_qualityprofile_project_association +--- +page_title: "sonarqube_qualityprofile_project_association Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Quality Profile Project association resource. This can be used to associate a Quality Profile to a Project +--- + +# sonarqube_qualityprofile_project_association (Resource) + Provides a Sonarqube Quality Profile Project association resource. This can be used to associate a Quality Profile to a Project ## Example: create a quality profile project association + ```terraform resource "sonarqube_qualityprofile" "main" { name = "my_quality_profile" @@ -11,7 +20,7 @@ resource "sonarqube_qualityprofile" "main" { resource "sonarqube_project" "main" { name = "SonarQube" project = "my_project" - visibility = "public" + visibility = "public" } resource "sonarqube_qualityprofile_project_association" "main" { @@ -22,15 +31,17 @@ resource "sonarqube_qualityprofile_project_association" "main" { ``` ## Argument Reference + The following arguments are supported: - quality_profile - (Required) Name of the Quality Profile -- project - (Required) Name of the project -- language - (Required) Quality profile language. Must be a langauge in this list https://next.sonarqube.com/sonarqube/web_api/api/languages/list +- project - (Required) Name of the project +- language - (Required) Quality profile language. Must be a langauge in this list https://next.sonarqube.com/sonarqube/web_api/api/languages/list + +## Import -## Import Quality Profiles Project Associations can be imported using a combination of quality profile name, project name and language ```terraform terraform import sonarqube_qualityprofile_project_association.main my_quality_profile/SonarQube/js -``` \ No newline at end of file +``` diff --git a/docs/resources/sonarqube_rules.md b/docs/resources/sonarqube_rules.md index 125bae69..de835edb 100644 --- a/docs/resources/sonarqube_rules.md +++ b/docs/resources/sonarqube_rules.md @@ -1,4 +1,11 @@ -# sonarqube_rules +--- +page_title: "sonarqube_rules Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Rules resource. This can be used to manage Sonarqube rules. +--- + +# sonarqube_rules (Resource) Provides a Sonarqube Rules resource. This can be used to manage Sonarqube rules. @@ -23,7 +30,7 @@ resource "sonarqube_rule" "rule" { The following arguments are supported -- key - (Required) key of the custom rule should only contain : a-z, 0-9, _ +- key - (Required) key of the custom rule should only contain : a-z, 0-9, \_ - markdown_description - (Required) Rule description - name - (Required) Rule name - params - (Optional) Parameters as semi-colon list of =, for example 'params=key1=v1;key2=v2' (Only for custom rule) diff --git a/docs/resources/sonarqube_settings.md b/docs/resources/sonarqube_settings.md index 6e932327..8d8c262d 100644 --- a/docs/resources/sonarqube_settings.md +++ b/docs/resources/sonarqube_settings.md @@ -1,4 +1,11 @@ -# sonarqube_settings +--- +page_title: "sonarqube_settings Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Settings resource. This can be used to manage Sonarqube settings. +--- + +# sonarqube_settings (Resource) Provides a Sonarqube Settings resource. This can be used to manage Sonarqube settings. @@ -13,13 +20,16 @@ resource "sonarqube_setting" "single_setting" { ``` ## Example: create a setting with multiple values + ```terraform resource "sonarqube_setting" "multi_value_setting" { key = "sonar.global.exclusions" values = ["foo", "bar/**/*.*"] } ``` + ## Example: create a setting with multiple field values + ```terraform resource "sonarqube_setting" "multi_field_setting" { key = "sonar.issue.ignore.multicriteria" @@ -35,6 +45,7 @@ resource "sonarqube_setting" "multi_field_setting" { ] } ``` + ## Argument Reference The following arguments are supported @@ -44,7 +55,8 @@ The following arguments are supported - values - (Optional) Multi-valued setting values - field_values - (Optional) Multi-field setting values -One of value, values, field_values _must_ be supplied +One of value, values, field*values \_must* be supplied + ## Attribute Reference The following attributes are exported: diff --git a/docs/resources/sonarqube_user.md b/docs/resources/sonarqube_user.md index 7355f64d..2357d9b3 100644 --- a/docs/resources/sonarqube_user.md +++ b/docs/resources/sonarqube_user.md @@ -1,8 +1,15 @@ -# sonarqube_user +--- +page_title: "sonarqube_user Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube User resource. This can be used to manage Sonarqube Users. +--- + +# sonarqube_user (Resource) Provides a Sonarqube User resource. This can be used to manage Sonarqube Users. -**Note**: By default Sonarqube only *deactivates* a user on `destroy` but keeps its personal data in the database. Since release `9.7` it +**Note**: By default Sonarqube only _deactivates_ a user on `destroy` but keeps its personal data in the database. Since release `9.7` it is possible to automatically anonymize the data. This can be helpful to comply with regulations like [GDPR](https://en.wikipedia.org/wiki/General_Data_Protection_Regulation). This behaviour can be activated with the `anonymize_user_on_delete` flag on the `provider` configuration. diff --git a/docs/resources/sonarqube_user_external_identity.md b/docs/resources/sonarqube_user_external_identity.md index 97108862..7526eff9 100644 --- a/docs/resources/sonarqube_user_external_identity.md +++ b/docs/resources/sonarqube_user_external_identity.md @@ -1,9 +1,17 @@ -# sonarqube_user_external_entity +--- +page_title: "sonarqube_user_external_entity Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Updates the *external identity* of a *non local* Sonarqube User. This can be used to set the *Identity Provider* which should be used to + authenticate a specific user. +--- -Updates the *external identity* of a *non local* Sonarqube User. This can be used to set the *Identity Provider* which should be used to +# sonarqube_user_external_entity (Resource) + +Updates the _external identity_ of a _non local_ Sonarqube User. This can be used to set the _Identity Provider_ which should be used to authenticate a specific user. -The Sonarqube API currently does not provide an endpoint to read the *external identity* setting of an user. +The Sonarqube API currently does not provide an endpoint to read the _external identity_ setting of an user. ## Example: change the external identity to SAML @@ -27,7 +35,7 @@ resource "sonarqube_user_external_identity" "remote_user" { The following arguments are supported: - `login_name` - (Required) The login name of the User to update. Changing this forces a new resource to be created. -- `external_identity` - (Required) The identifier of the User used by the Authentication Provider. Changing this forces a new resource to be +- `external_identity` - (Required) The identifier of the User used by the Authentication Provider. Changing this forces a new resource to be created. -- `external_provider` - (Required) The key of the Authentication Provider. The Authentication Provider must be activated on Sonarqube. Changing +- `external_provider` - (Required) The key of the Authentication Provider. The Authentication Provider must be activated on Sonarqube. Changing this forces a new resource to be created. diff --git a/docs/resources/sonarqube_user_token.md b/docs/resources/sonarqube_user_token.md index 033ad51d..04ab1f38 100644 --- a/docs/resources/sonarqube_user_token.md +++ b/docs/resources/sonarqube_user_token.md @@ -1,4 +1,11 @@ -# sonarqube_user_token +--- +page_title: "sonarqube_user_token Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube User token resource. This can be used to manage Sonarqube User tokens. +--- + +# sonarqube_user_token (Resource) Provides a Sonarqube User token resource. This can be used to manage Sonarqube User tokens. diff --git a/docs/resources/sonarqube_webhook.md b/docs/resources/sonarqube_webhook.md index b31b3c50..bc6231a0 100644 --- a/docs/resources/sonarqube_webhook.md +++ b/docs/resources/sonarqube_webhook.md @@ -1,4 +1,11 @@ -# sonarqube_webhook +--- +page_title: "sonarqube_webhook Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Webhook resource. This can be used to manage Sonarqube webhooks. +--- + +# sonarqube_webhook (Resource) Provides a Sonarqube Webhook resource. This can be used to manage Sonarqube webhooks. @@ -17,7 +24,7 @@ resource "sonarqube_webhook" "webhook" { resource "sonarqube_project" "project" { name = "project" project = "project" - visibility = "public" + visibility = "public" } resource "sonarqube_webhook" "webhook" { @@ -36,7 +43,6 @@ The following arguments are supported: - project - (Optional) The key of the project that will own the webhook. - secret - (Optional) The secret to send with the event payload. - ## Attributes Reference The following attributes are exported: From 858d190c84037c01678d2087b8d13d07853965ec Mon Sep 17 00:00:00 2001 From: Lorne Date: Thu, 17 Oct 2024 14:48:57 +0100 Subject: [PATCH 02/24] generate documentation using tfplugindocs --- .DS_Store | Bin 0 -> 8196 bytes .../{sonarqube_group.md => group.md} | 19 ++-- docs/data-sources/portfolio.md | 38 +++++++ .../{sonarqube_project.md => project.md} | 20 ++-- docs/data-sources/qualitygate.md | 43 ++++++++ docs/data-sources/qualityprofile.md | 33 ++++++ docs/data-sources/rule.md | 36 +++++++ docs/data-sources/sonarqube_portfolio.md | 37 ------- docs/data-sources/sonarqube_qualitygate.md | 33 ------ docs/data-sources/sonarqube_qualityprofile.md | 32 ------ docs/data-sources/sonarqube_rule.md | 35 ------- docs/data-sources/sonarqube_user.md | 32 ------ docs/data-sources/user.md | 33 ++++++ docs/debugging.md | 4 + docs/index.md | 4 +- docs/resources/alm_azure.md | 36 +++++++ docs/resources/alm_github.md | 47 +++++++++ docs/resources/alm_gitlab.md | 36 +++++++ ...qube_azure_binding.md => azure_binding.md} | 34 +++--- docs/resources/github_binding.md | 56 ++++++++++ docs/resources/gitlab_binding.md | 52 ++++++++++ docs/resources/group.md | 35 +++++++ docs/resources/group_member.md | 43 ++++++++ docs/resources/new_code_periods.md | 49 +++++++++ docs/resources/permission_template.md | 40 +++++++ docs/resources/permissions.md | 66 ++++++++++++ docs/resources/plugin.md | 30 ++++++ docs/resources/portfolio.md | 55 ++++++++++ docs/resources/project.md | 66 ++++++++++++ docs/resources/project_main_branch.md | 37 +++++++ ...onarqube_qualitygate.md => qualitygate.md} | 98 +++++++++--------- ....md => qualitygate_project_association.md} | 36 ++++--- .../qualitygate_usergroup_association.md | 76 ++++++++++++++ docs/resources/qualityprofile.md | 40 +++++++ .../resources/qualityprofile_activate_rule.md | 59 +++++++++++ .../qualityprofile_project_association.md | 45 ++++++++ docs/resources/rule.md | 42 ++++++++ docs/resources/setting.md | 53 ++++++++++ docs/resources/sonarqube_alm_azure.md | 45 -------- docs/resources/sonarqube_alm_github.md | 47 --------- docs/resources/sonarqube_alm_gitlab.md | 37 ------- docs/resources/sonarqube_github_binding.md | 63 ----------- docs/resources/sonarqube_gitlab_binding.md | 59 ----------- docs/resources/sonarqube_group.md | 40 ------- docs/resources/sonarqube_group_member.md | 51 --------- docs/resources/sonarqube_new_code_periods.md | 51 --------- .../sonarqube_permission_template.md | 45 -------- docs/resources/sonarqube_permissions.md | 72 ------------- docs/resources/sonarqube_plugin.md | 42 -------- docs/resources/sonarqube_portfolio.md | 77 -------------- docs/resources/sonarqube_project.md | 68 ------------ .../sonarqube_project_main_branch.md | 46 -------- ...rqube_qualitygate_usergroup_association.md | 79 -------------- docs/resources/sonarqube_qualityprofile.md | 46 -------- .../sonarqube_qualityprofile_activate_rule.md | 58 ----------- ...qube_qualityprofile_project_association.md | 47 --------- docs/resources/sonarqube_rules.md | 54 ---------- docs/resources/sonarqube_settings.md | 64 ------------ docs/resources/sonarqube_user.md | 59 ----------- .../sonarqube_user_external_identity.md | 41 -------- docs/resources/sonarqube_user_token.md | 78 -------------- docs/resources/sonarqube_webhook.md | 58 ----------- docs/resources/user.md | 48 +++++++++ docs/resources/user_external_identity.md | 48 +++++++++ docs/resources/user_token.md | 74 +++++++++++++ docs/resources/webhook.md | 51 +++++++++ .../sonarqube_group/data-source.tf | 3 + .../sonarqube_portfolio/data-source.tf | 3 + .../sonarqube_project/data-source.tf | 3 + .../sonarqube_qualitygate/data-source.tf | 3 + .../sonarqube_qualityprofile/data-source.tf | 3 + .../sonarqube_rule/data-source.tf | 3 + .../sonarqube_user/data-source.tf | 3 + examples/provider/provider.tf | 30 ++++++ .../resources/sonarqube_alm_azure/resource.tf | 5 + .../sonarqube_alm_github/resource.tf | 9 ++ .../sonarqube_alm_gitlab/resource.tf | 5 + .../sonarqube_azure_binding/resource.tf | 18 ++++ .../sonarqube_github_binding/resource.tf | 20 ++++ .../sonarqube_gitlab_binding/resource.tf | 17 +++ .../resources/sonarqube_group/resource.tf | 4 + .../sonarqube_group_member/resource.tf | 15 +++ .../sonarqube_new_code_periods/global.tf | 4 + .../sonarqube_new_code_periods/project.tf | 8 ++ .../sonarqube_permission_template/resource.tf | 5 + .../sonarqube_permissions/global-admin.tf | 4 + .../sonarqube_permissions/project-admin.tf | 5 + .../sonarqube_permissions/project-template.tf | 5 + .../sonarqube_permissions/project-user.tf | 5 + .../resources/sonarqube_plugin/resource.tf | 3 + .../resources/sonarqube_portfolio/resource.tf | 5 + .../sonarqube_project/project-settings.tf | 10 ++ .../resources/sonarqube_project/project.tf | 5 + .../sonarqube_project_main_branch/resource.tf | 9 ++ .../sonarqube_qualitygate/resource.tf | 16 +++ .../resource.tf | 22 ++++ .../user-association.tf | 20 ++++ .../usergroup-association.tf | 19 ++++ .../sonarqube_qualityprofile/resource.tf | 6 ++ .../resource.tf | 23 ++++ .../resource.tf | 16 +++ .../resources/sonarqube_rules/resource.tf | 11 ++ .../sonarqube_setting/multi-field-values.tf | 13 +++ .../sonarqube_setting/multi-value.tf | 4 + examples/resources/sonarqube_user/local.tf | 5 + examples/resources/sonarqube_user/remote.tf | 6 ++ .../resource.tf | 14 +++ .../global-analysis-token.tf | 9 ++ .../project-analysis-token.tf | 9 ++ .../sonarqube_user_token/user-token.tf | 14 +++ .../sonarqube_webhook/project-webhook.tf | 11 ++ .../resources/sonarqube_webhook/webhook.tf | 4 + sonarqube/data_source_sonarqube_group.go | 13 ++- sonarqube/data_source_sonarqube_portfolio.go | 44 +++++--- sonarqube/data_source_sonarqube_project.go | 18 ++-- .../data_source_sonarqube_qualitygate.go | 19 ++-- .../data_source_sonarqube_qualityprofile.go | 23 ++-- sonarqube/data_source_sonarqube_rule.go | 38 ++++--- sonarqube/data_source_sonarqube_user.go | 23 ++-- sonarqube/resource_sonarqube_alm_azure.go | 4 +- sonarqube/resource_sonarqube_alm_github.go | 53 ++++++---- sonarqube/resource_sonarqube_alm_gitlab.go | 7 +- sonarqube/resource_sonarqube_azure_binding.go | 2 + .../resource_sonarqube_github_binding.go | 41 +++++--- .../resource_sonarqube_gitlab_binding.go | 26 +++-- sonarqube/resource_sonarqube_group.go | 19 ++-- sonarqube/resource_sonarqube_group_member.go | 21 ++-- .../resource_sonarqube_new_code_periods.go | 23 ++-- sonarqube/resource_sonarqube_permissions.go | 14 ++- ...resource_sonarqube_permissions_template.go | 25 +++-- sonarqube/resource_sonarqube_plugins.go | 14 +-- sonarqube/resource_sonarqube_portfolio.go | 38 ++++--- sonarqube/resource_sonarqube_project.go | 31 +++--- .../resource_sonarqube_project_main_branch.go | 22 ++-- sonarqube/resource_sonarqube_qualitygate.go | 45 +++++--- ...narqube_qualitygate_project_association.go | 21 ++-- ...rqube_qualitygate_usergroup_association.go | 11 +- .../resource_sonarqube_qualityprofile.go | 24 ++--- ..._sonarqube_qualityprofile_activate_rule.go | 28 ++--- ...qube_qualityprofile_project_association.go | 15 ++- sonarqube/resource_sonarqube_rules.go | 58 ++++++----- sonarqube/resource_sonarqube_setting.go | 11 +- sonarqube/resource_sonarqube_user.go | 44 ++++---- ...source_sonarqube_user_external_identity.go | 27 +++-- sonarqube/resource_sonarqube_user_token.go | 39 ++++--- sonarqube/resource_sonarqube_webhook.go | 28 ++--- templates/debugging.md | 52 ++++++++++ templates/index.md.tmpl | 60 +++++++++++ templates/resources/new_code_periods.md.tmpl | 20 ++++ templates/resources/permissions.md.tmpl | 26 +++++ templates/resources/project.md.tmpl | 20 ++++ templates/resources/qualitygate.md.tmpl | 31 ++++++ .../qualitygate_usergroup_association.md.tmpl | 19 ++++ templates/resources/setting.md.tmpl | 19 ++++ templates/resources/user.md.tmpl | 19 ++++ templates/resources/user_token.md.tmpl | 22 ++++ templates/resources/webhook.md.tmpl | 19 ++++ 157 files changed, 2733 insertions(+), 1955 deletions(-) create mode 100644 .DS_Store rename docs/data-sources/{sonarqube_group.md => group.md} (54%) create mode 100644 docs/data-sources/portfolio.md rename docs/data-sources/{sonarqube_project.md => project.md} (51%) create mode 100644 docs/data-sources/qualitygate.md create mode 100644 docs/data-sources/qualityprofile.md create mode 100644 docs/data-sources/rule.md delete mode 100644 docs/data-sources/sonarqube_portfolio.md delete mode 100644 docs/data-sources/sonarqube_qualitygate.md delete mode 100644 docs/data-sources/sonarqube_qualityprofile.md delete mode 100644 docs/data-sources/sonarqube_rule.md delete mode 100644 docs/data-sources/sonarqube_user.md create mode 100644 docs/data-sources/user.md create mode 100644 docs/resources/alm_azure.md create mode 100644 docs/resources/alm_github.md create mode 100644 docs/resources/alm_gitlab.md rename docs/resources/{sonarqube_azure_binding.md => azure_binding.md} (55%) create mode 100644 docs/resources/github_binding.md create mode 100644 docs/resources/gitlab_binding.md create mode 100644 docs/resources/group.md create mode 100644 docs/resources/group_member.md create mode 100644 docs/resources/new_code_periods.md create mode 100644 docs/resources/permission_template.md create mode 100644 docs/resources/permissions.md create mode 100644 docs/resources/plugin.md create mode 100644 docs/resources/portfolio.md create mode 100644 docs/resources/project.md create mode 100644 docs/resources/project_main_branch.md rename docs/resources/{sonarqube_qualitygate.md => qualitygate.md} (52%) rename docs/resources/{sonarqube_qualitygate_project_association.md => qualitygate_project_association.md} (53%) create mode 100644 docs/resources/qualitygate_usergroup_association.md create mode 100644 docs/resources/qualityprofile.md create mode 100644 docs/resources/qualityprofile_activate_rule.md create mode 100644 docs/resources/qualityprofile_project_association.md create mode 100644 docs/resources/rule.md create mode 100644 docs/resources/setting.md delete mode 100644 docs/resources/sonarqube_alm_azure.md delete mode 100644 docs/resources/sonarqube_alm_github.md delete mode 100644 docs/resources/sonarqube_alm_gitlab.md delete mode 100644 docs/resources/sonarqube_github_binding.md delete mode 100644 docs/resources/sonarqube_gitlab_binding.md delete mode 100644 docs/resources/sonarqube_group.md delete mode 100644 docs/resources/sonarqube_group_member.md delete mode 100644 docs/resources/sonarqube_new_code_periods.md delete mode 100644 docs/resources/sonarqube_permission_template.md delete mode 100644 docs/resources/sonarqube_permissions.md delete mode 100644 docs/resources/sonarqube_plugin.md delete mode 100644 docs/resources/sonarqube_portfolio.md delete mode 100644 docs/resources/sonarqube_project.md delete mode 100644 docs/resources/sonarqube_project_main_branch.md delete mode 100644 docs/resources/sonarqube_qualitygate_usergroup_association.md delete mode 100644 docs/resources/sonarqube_qualityprofile.md delete mode 100644 docs/resources/sonarqube_qualityprofile_activate_rule.md delete mode 100644 docs/resources/sonarqube_qualityprofile_project_association.md delete mode 100644 docs/resources/sonarqube_rules.md delete mode 100644 docs/resources/sonarqube_settings.md delete mode 100644 docs/resources/sonarqube_user.md delete mode 100644 docs/resources/sonarqube_user_external_identity.md delete mode 100644 docs/resources/sonarqube_user_token.md delete mode 100644 docs/resources/sonarqube_webhook.md create mode 100644 docs/resources/user.md create mode 100644 docs/resources/user_external_identity.md create mode 100644 docs/resources/user_token.md create mode 100644 docs/resources/webhook.md create mode 100644 examples/data-sources/sonarqube_group/data-source.tf create mode 100644 examples/data-sources/sonarqube_portfolio/data-source.tf create mode 100644 examples/data-sources/sonarqube_project/data-source.tf create mode 100644 examples/data-sources/sonarqube_qualitygate/data-source.tf create mode 100644 examples/data-sources/sonarqube_qualityprofile/data-source.tf create mode 100644 examples/data-sources/sonarqube_rule/data-source.tf create mode 100644 examples/data-sources/sonarqube_user/data-source.tf create mode 100644 examples/provider/provider.tf create mode 100644 examples/resources/sonarqube_alm_azure/resource.tf create mode 100644 examples/resources/sonarqube_alm_github/resource.tf create mode 100644 examples/resources/sonarqube_alm_gitlab/resource.tf create mode 100644 examples/resources/sonarqube_azure_binding/resource.tf create mode 100644 examples/resources/sonarqube_github_binding/resource.tf create mode 100644 examples/resources/sonarqube_gitlab_binding/resource.tf create mode 100644 examples/resources/sonarqube_group/resource.tf create mode 100644 examples/resources/sonarqube_group_member/resource.tf create mode 100644 examples/resources/sonarqube_new_code_periods/global.tf create mode 100644 examples/resources/sonarqube_new_code_periods/project.tf create mode 100644 examples/resources/sonarqube_permission_template/resource.tf create mode 100644 examples/resources/sonarqube_permissions/global-admin.tf create mode 100644 examples/resources/sonarqube_permissions/project-admin.tf create mode 100644 examples/resources/sonarqube_permissions/project-template.tf create mode 100644 examples/resources/sonarqube_permissions/project-user.tf create mode 100644 examples/resources/sonarqube_plugin/resource.tf create mode 100644 examples/resources/sonarqube_portfolio/resource.tf create mode 100644 examples/resources/sonarqube_project/project-settings.tf create mode 100644 examples/resources/sonarqube_project/project.tf create mode 100644 examples/resources/sonarqube_project_main_branch/resource.tf create mode 100644 examples/resources/sonarqube_qualitygate/resource.tf create mode 100644 examples/resources/sonarqube_qualitygate_project_association/resource.tf create mode 100644 examples/resources/sonarqube_qualitygate_usergroup_association/user-association.tf create mode 100644 examples/resources/sonarqube_qualitygate_usergroup_association/usergroup-association.tf create mode 100644 examples/resources/sonarqube_qualityprofile/resource.tf create mode 100644 examples/resources/sonarqube_qualityprofile_activate_rule/resource.tf create mode 100644 examples/resources/sonarqube_qualityprofile_project_association/resource.tf create mode 100644 examples/resources/sonarqube_rules/resource.tf create mode 100644 examples/resources/sonarqube_setting/multi-field-values.tf create mode 100644 examples/resources/sonarqube_setting/multi-value.tf create mode 100644 examples/resources/sonarqube_user/local.tf create mode 100644 examples/resources/sonarqube_user/remote.tf create mode 100644 examples/resources/sonarqube_user_external_identity/resource.tf create mode 100644 examples/resources/sonarqube_user_token/global-analysis-token.tf create mode 100644 examples/resources/sonarqube_user_token/project-analysis-token.tf create mode 100644 examples/resources/sonarqube_user_token/user-token.tf create mode 100644 examples/resources/sonarqube_webhook/project-webhook.tf create mode 100644 examples/resources/sonarqube_webhook/webhook.tf create mode 100644 templates/debugging.md create mode 100644 templates/index.md.tmpl create mode 100644 templates/resources/new_code_periods.md.tmpl create mode 100644 templates/resources/permissions.md.tmpl create mode 100644 templates/resources/project.md.tmpl create mode 100644 templates/resources/qualitygate.md.tmpl create mode 100644 templates/resources/qualitygate_usergroup_association.md.tmpl create mode 100644 templates/resources/setting.md.tmpl create mode 100644 templates/resources/user.md.tmpl create mode 100644 templates/resources/user_token.md.tmpl create mode 100644 templates/resources/webhook.md.tmpl diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..1ee7ba0e80adad4ebe9bd2535cfc86f95aced8f2 GIT binary patch literal 8196 zcmeHMU2GIp6h7ayzzh>%S}PRnxLYd}OAQ49#UI%IMSfaZXlsA?sk=J^9i7gUo!M=x zQR|aN)WjE!|8GQnK#k(xtN)4dfmEWzM2v|~yl4a;OpNEwoe~P|qe^6Ma__h2+;h(K zp8d|;oGlTdrD&}uswN_pr$9sJWsV{C#k_1Nv8Id>>`zpnBUGdu*=}%|b)rZzkYpgq zK$3wZ14#z1gbeVVErvSJy)So@HOWAdfvYkD;{A~3DKHb`l*H)O!AsNvFqX4A8vL32 zfXF8uV!uI z2c>ns;Ja?OA2^}odxHa^JrRmM5op%dz);{9!qzC*fWz^nRi$`F*O+h)?zIa6qoy5S zvOIOunp-y9c2}l-N9UgDrA9@iUZpSVFFApebM3xy#|lRVvq9eWEXO-M-Dmu_Hh-gJS zX02JTs{4e#wP5oq)p~>3s2N$cH{c`75bN~ynh|Kd4>(@zx>4V(8kW}QW^=YHqixae zRE=F)e@UKLDy#Husy2}KM@RWEfz-8_ZL0C5dQd#LBO8QWW41T*C$*T{RdpyB$rkLc zanCNycyy?0^fj_xxU^eN=og}F?5;J&$9r3O%(;)d*CxIx+ab2cK%2hM!7{!%fQWLe%PC7_qG)YJ4IeLxWqZ9N# zeMaBVDf)qapzEYDqZW3uR!<8v2X>YnX8cJAu9 zVvFwkC8Er(t-5a6^7N{PbsKNLyZHhcC3k1&dT|*<%%4>+5%VK%w0Hs4!X^xA2j_wf`%*iA`{TzHAvamJ_}XT0zaL;jp*Q{j_| YaY`aL=>1SI!=a{ounySkUZ0Vcxv>i_@% literal 0 HcmV?d00001 diff --git a/docs/data-sources/sonarqube_group.md b/docs/data-sources/group.md similarity index 54% rename from docs/data-sources/sonarqube_group.md rename to docs/data-sources/group.md index eca06269..73c5f7a3 100644 --- a/docs/data-sources/sonarqube_group.md +++ b/docs/data-sources/group.md @@ -1,4 +1,5 @@ --- +# generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "sonarqube_group Data Source - terraform-provider-sonarqube" subcategory: "" description: |- @@ -9,7 +10,7 @@ description: |- Use this data source to get a Sonarqube Group resource -## Example usage +## Example Usage ```terraform data "sonarqube_group" "group" { @@ -17,16 +18,14 @@ data "sonarqube_group" "group" { } ``` -## Argument Reference + +## Schema -The following arguments are supported: +### Required -- name - (Required) The name of the Group +- `name` (String) The name of the group. -## Attributes Reference +### Read-Only -The following attributes are exported: - -- id - The ID of the Group. -- name - The name of the group. -- description - The group description. +- `description` (String) The group description. +- `id` (String) The ID of this resource. diff --git a/docs/data-sources/portfolio.md b/docs/data-sources/portfolio.md new file mode 100644 index 00000000..e323207d --- /dev/null +++ b/docs/data-sources/portfolio.md @@ -0,0 +1,38 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "sonarqube_portfolio Data Source - terraform-provider-sonarqube" +subcategory: "" +description: |- + Use this data source to get a Sonarqube portfolio resource +--- + +# sonarqube_portfolio (Data Source) + +Use this data source to get a Sonarqube portfolio resource + +## Example Usage + +```terraform +data "sonarqube_portfolio" "portfolio" { + key = "portfolio-key" +} +``` + + +## Schema + +### Required + +- `key` (String) The key of the portfolio + +### Read-Only + +- `branch` (String) Which branch is analyzed +- `description` (String) Description of the portfolio +- `id` (String) The ID of this resource. +- `name` (String) Name of the portfolio +- `qualifier` (String) `VW` (portfolios always have this qualifier) +- `regexp` (String) The regular expression used to populate the portfolio. Only active when `selection_mode` is `REGEXP` +- `selection_mode` (String) How the Portfolio is populated. Possible values are `NONE`, `MANUAL`, `TAGS`, `REGEXP` or `REST`. [See docs](https://docs.sonarqube.org/9.8/project-administration/managing-portfolios/#populating-portfolios) for how Portfolio population works +- `tags` (List of String) The list of tags used to populate the Portfolio. Only active when `selection_mode` is `TAGS` +- `visibility` (String) Portfolio visibility diff --git a/docs/data-sources/sonarqube_project.md b/docs/data-sources/project.md similarity index 51% rename from docs/data-sources/sonarqube_project.md rename to docs/data-sources/project.md index c4f61d09..9bcef7b8 100644 --- a/docs/data-sources/sonarqube_project.md +++ b/docs/data-sources/project.md @@ -1,4 +1,5 @@ --- +# generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "sonarqube_project Data Source - terraform-provider-sonarqube" subcategory: "" description: |- @@ -9,7 +10,7 @@ description: |- Use this data source to get a Sonarqube project resource -## Example usage +## Example Usage ```terraform data "sonarqube_project" "project" { @@ -17,16 +18,15 @@ data "sonarqube_project" "project" { } ``` -## Argument Reference + +## Schema -The following arguments are supported: +### Required -- project - (Required) The project key of the project +- `project` (String) The project key of the project -## Attributes Reference +### Read-Only -The following attributes are exported: - -- name - Name of the project -- project - Key of the project -- visibility - Project visibility +- `id` (String) The ID of this resource. +- `name` (String) Name of the project +- `visibility` (String) Project visibility diff --git a/docs/data-sources/qualitygate.md b/docs/data-sources/qualitygate.md new file mode 100644 index 00000000..d3d11330 --- /dev/null +++ b/docs/data-sources/qualitygate.md @@ -0,0 +1,43 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "sonarqube_qualitygate Data Source - terraform-provider-sonarqube" +subcategory: "" +description: |- + Use this data source to get a Sonarqube qualitygate resource +--- + +# sonarqube_qualitygate (Data Source) + +Use this data source to get a Sonarqube qualitygate resource + +## Example Usage + +```terraform +data "sonarqube_qualitygate" "main" { + name = "example" +} +``` + + +## Schema + +### Required + +- `name` (String) The name of the Quality Gate. + +### Read-Only + +- `condition` (List of Object) List of Quality Gate conditions. (see [below for nested schema](#nestedatt--condition)) +- `copy_from` (String) Origin of the Quality Gate +- `id` (String) The ID of this resource. +- `is_default` (Boolean) Quality Gate default. + + +### Nested Schema for `condition` + +Read-Only: + +- `id` (String) +- `metric` (String) +- `op` (String) +- `threshold` (String) diff --git a/docs/data-sources/qualityprofile.md b/docs/data-sources/qualityprofile.md new file mode 100644 index 00000000..934d009c --- /dev/null +++ b/docs/data-sources/qualityprofile.md @@ -0,0 +1,33 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "sonarqube_qualityprofile Data Source - terraform-provider-sonarqube" +subcategory: "" +description: |- + Use this data source to get a Sonarqube qualityprofile resource +--- + +# sonarqube_qualityprofile (Data Source) + +Use this data source to get a Sonarqube qualityprofile resource + +## Example Usage + +```terraform +data "sonarqube_qualityprofile" "main" { + name = "example" +} +``` + + +## Schema + +### Required + +- `name` (String) The name of the Quality Profile + +### Read-Only + +- `id` (String) The ID of this resource. +- `is_default` (Boolean) Quality Profile default +- `key` (String) The key of the Quality Profile +- `language` (String) Quality Profile language diff --git a/docs/data-sources/rule.md b/docs/data-sources/rule.md new file mode 100644 index 00000000..9263ca7e --- /dev/null +++ b/docs/data-sources/rule.md @@ -0,0 +1,36 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "sonarqube_rule Data Source - terraform-provider-sonarqube" +subcategory: "" +description: |- + Use this data source to get a Sonarqube rule resource +--- + +# sonarqube_rule (Data Source) + +Use this data source to get a Sonarqube rule resource + +## Example Usage + +```terraform +data "sonarqube_rule" "rule" { + key = "squid:forbidSonar" +} +``` + + +## Schema + +### Required + +- `key` (String) The key of the sonarqube rule. Should be :. https://next.sonarqube.com/sonarqube/web_api/api/rules?query=api%2Frules%2Fcreate + +### Read-Only + +- `id` (String) The ID of this resource. +- `markdown_description` (String) Rule description +- `name` (String) Rule name +- `severity` (String) Rule severity +- `status` (String) Rule status +- `template_key` (String) Key of the template rule +- `type` (String) Rule type diff --git a/docs/data-sources/sonarqube_portfolio.md b/docs/data-sources/sonarqube_portfolio.md deleted file mode 100644 index 8dfe4504..00000000 --- a/docs/data-sources/sonarqube_portfolio.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -page_title: "sonarqube_portfolio Data Source - terraform-provider-sonarqube" -subcategory: "" -description: |- - Use this data source to get a Sonarqube portfolio resource ---- - -# sonarqube_portfolio (Data Source) - -Use this data source to get a Sonarqube portfolio resource - -## Example usage - -```terraform -data "sonarqube_portfolio" "portfolio" { - key = "portfolio-key" -} -``` - -## Argument Reference - -The following arguments are supported: - -- key - (Required) The key of the portfolio - -## Attributes Reference - -The following attributes are exported: - -- name - Name of the portfolio -- description - Description of the portfolio -- qualifier - `VW` (portfolios always have this qualifier) -- visibility - Portfolio visibility -- selection_mode - How the Portfolio is populated. Possible values are `NONE`, `MANUAL`, `TAGS`, `REGEXP` or `REST`. [See docs](https://docs.sonarqube.org/9.8/project-administration/managing-portfolios/#populating-portfolios) for how Portfolio population works -- branch - Which branch is analyzed -- tags - The list of tags used to populate the Portfolio. Only active when `selection_mode` is `TAGS` -- regexp - The regular expression used to populate the portfolio. Only active when `selection_mode` is `REGEXP` diff --git a/docs/data-sources/sonarqube_qualitygate.md b/docs/data-sources/sonarqube_qualitygate.md deleted file mode 100644 index 34a16dbf..00000000 --- a/docs/data-sources/sonarqube_qualitygate.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -page_title: "sonarqube_qualitygate Data Source - terraform-provider-sonarqube" -subcategory: "" -description: |- - Use this data source to get a Sonarqube qualitygate resource ---- - -# sonarqube_qualitygate (Data Source) - -Use this data source to get a Sonarqube qualitygate resource - -## Example usage - -```terraform -data "sonarqube_qualitygate" "main" { - name = "example" -} -``` - -## Argument Reference - -The following arguments are supported: - -- name - (Required) The name of the quality gate - -## Attributes Reference - -The following attributes are exported: - -- name - The name of the Quality Gate. -- copy_from - Origin of Quality Gate. -- is_default - Quality Gate default. -- condition - List of Quality Gate conditions. diff --git a/docs/data-sources/sonarqube_qualityprofile.md b/docs/data-sources/sonarqube_qualityprofile.md deleted file mode 100644 index 81021efa..00000000 --- a/docs/data-sources/sonarqube_qualityprofile.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -page_title: "sonarqube_qualityprofile Data Source - terraform-provider-sonarqube" -subcategory: "" -description: |- - Use this data source to get a Sonarqube qualityprofile resource ---- - -# sonarqube_qualityprofile (Data Source) - -Use this data source to get a Sonarqube qualityprofile resource - -## Example usage - -```terraform -data "sonarqube_qualityprofile" "main" { - name = "example" -} -``` - -## Argument Reference - -The following arguments are supported: - -- name - (Required) The name of the quality profile - -## Attributes Reference - -The following attributes are exported: - -- name - The name of the Quality Profile -- language - Quality profile language. -- is_default - Quality Profile default diff --git a/docs/data-sources/sonarqube_rule.md b/docs/data-sources/sonarqube_rule.md deleted file mode 100644 index 2d309d72..00000000 --- a/docs/data-sources/sonarqube_rule.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -page_title: "sonarqube_rule Data Source - terraform-provider-sonarqube" -subcategory: "" -description: |- - Use this data source to get a Sonarqube rule resource ---- - -# sonarqube_rule (Data Source) - -Use this data source to get a Sonarqube rule resource - -## Example usage - -```terraform -data "sonarqube_rule" "rule" { - key = "squid:forbidSonar" -} -``` - -## Argument Reference - -The following arguments are supported: - -- key - (Required) The key of the sonarqube rule. Should be :. https://next.sonarqube.com/sonarqube/web_api/api/rules?query=api%2Frules%2Fcreate - -## Attributes Reference - -The following attributes are exported: - -- markdown_description - Rule description -- name - Rule name -- severity - Rule severity -- status - Rule status -- template_key - Key of the template rule -- type - Rule type diff --git a/docs/data-sources/sonarqube_user.md b/docs/data-sources/sonarqube_user.md deleted file mode 100644 index 2a1a5cda..00000000 --- a/docs/data-sources/sonarqube_user.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -page_title: "sonarqube_user Data Source - terraform-provider-sonarqube" -subcategory: "" -description: |- - Use this data source to get a Sonarqube User resource ---- - -# sonarqube_user (Data Source) - -Use this data source to get a Sonarqube User resource - -## Example usage - -```terraform -data "sonarqube_user" "user" { - login_name = "terraform-test" -} -``` - -## Argument Reference - -The following arguments are supported: - -- login_name - (Required) The login name of the User - -## Attributes Reference - -The following attributes are exported: - -- id - The ID of the User. -- login_name - The login name of the user -- email - The users email. diff --git a/docs/data-sources/user.md b/docs/data-sources/user.md new file mode 100644 index 00000000..e5612289 --- /dev/null +++ b/docs/data-sources/user.md @@ -0,0 +1,33 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "sonarqube_user Data Source - terraform-provider-sonarqube" +subcategory: "" +description: |- + Use this data source to get a Sonarqube User resource +--- + +# sonarqube_user (Data Source) + +Use this data source to get a Sonarqube User resource + +## Example Usage + +```terraform +data "sonarqube_user" "user" { + login_name = "terraform-test" +} +``` + + +## Schema + +### Required + +- `login_name` (String) The login name of the user + +### Read-Only + +- `email` (String) The email of the user +- `id` (String) The ID of this resource. +- `is_local` (Boolean) Whether the user is local +- `name` (String) The name of the user diff --git a/docs/debugging.md b/docs/debugging.md index 2059da21..d224d22f 100644 --- a/docs/debugging.md +++ b/docs/debugging.md @@ -7,6 +7,7 @@ You can debug the provider using a tool similar to [delve](https://github.com/go ### Visual Studio Code Using [Visual Studio Code](https://code.visualstudio.com/) with the [Go extension](https://marketplace.visualstudio.com/items?itemName=golang.go) installed, you would add a configuration similar to this to your `launch.json` file: + ```json { "name": "Debug Terraform Provider", @@ -23,7 +24,9 @@ Using [Visual Studio Code](https://code.visualstudio.com/) with the [Go extensio "showLog": true } ``` + Start the process using this configuration and then follow the instructions provided in the debug console: + ```shell Provider started. To attach Terraform CLI, set the TF_REATTACH_PROVIDERS environment variable with the following: @@ -35,6 +38,7 @@ Provider started. To attach Terraform CLI, set the TF_REATTACH_PROVIDERS environ ### Delve CLI With the delve CLI you would start a delve debugging session: + ```shell dlv exec --accept-multiclient --continue --headless ./terraform-provider-example -- -debug ``` diff --git a/docs/index.md b/docs/index.md index 29eb3c0e..93dff5ff 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,7 +1,7 @@ --- -page_title: "Sonarqube Provider" -subcategory: "" +page_title: "Provider: sonarqube" description: |- + The sonarqube provider is used to configure sonarqube. The provider needs to be configured with a url, and either with user and password or token. --- # Provider configuration diff --git a/docs/resources/alm_azure.md b/docs/resources/alm_azure.md new file mode 100644 index 00000000..03430d14 --- /dev/null +++ b/docs/resources/alm_azure.md @@ -0,0 +1,36 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "sonarqube_alm_azure Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Azure Devops Alm/Devops Platform Integration resource. This can be used to create and manage a Alm/Devops + Platform Integration for Azure Devops. +--- + +# sonarqube_alm_azure (Resource) + +Provides a Sonarqube Azure Devops Alm/Devops Platform Integration resource. This can be used to create and manage a Alm/Devops +Platform Integration for Azure Devops. + +## Example Usage + +```terraform +resource "sonarqube_alm_azure" "az1" { + key = "az1" + personal_access_token = "my_pat" + url = "https://dev.azure.com/my-org" +} +``` + + +## Schema + +### Required + +- `key` (String) Unique key of the Azure Devops instance setting +- `personal_access_token` (String, Sensitive) Azure Devops personal access token +- `url` (String) Azure API URL + +### Read-Only + +- `id` (String) The ID of this resource. diff --git a/docs/resources/alm_github.md b/docs/resources/alm_github.md new file mode 100644 index 00000000..0bcc3b84 --- /dev/null +++ b/docs/resources/alm_github.md @@ -0,0 +1,47 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "sonarqube_alm_github Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube GitHub Alm/Devops Platform Integration resource. This can be used to create and manage a Alm/Devops + Platform Integration for GitHub. +--- + +# sonarqube_alm_github (Resource) + +Provides a Sonarqube GitHub Alm/Devops Platform Integration resource. This can be used to create and manage a Alm/Devops +Platform Integration for GitHub. + +## Example Usage + +```terraform +resource "sonarqube_alm_github" "github-alm" { + app_id = "12345" + client_id = "56789" + client_secret = "secret" + key = "myalm" + private_key = "myprivate_key" + url = "https://api.github.com" + webhook_secret = "mysecret" +} +``` + + +## Schema + +### Required + +- `app_id` (String) GitHub App ID. Maximum length: 80 +- `client_id` (String) GitHub App Client ID. Maximum length: 80 +- `client_secret` (String) GitHub App Client Secret. Maximum length: 160 +- `key` (String) Unique key of the GitHUb instance setting. Maximum length: 200 +- `private_key` (String) GitHub App private key. Maximum length: 2500 +- `url` (String) GitHub API URL. Maximum length: 2000 + +### Optional + +- `webhook_secret` (String) GitHub App Webhook Secret. Maximum length: 160 + +### Read-Only + +- `id` (String) The ID of this resource. diff --git a/docs/resources/alm_gitlab.md b/docs/resources/alm_gitlab.md new file mode 100644 index 00000000..36ed008b --- /dev/null +++ b/docs/resources/alm_gitlab.md @@ -0,0 +1,36 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "sonarqube_alm_gitlab Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube GitLab Alm/Devops Platform Integration resource. This can be used to create and manage a Alm/Devops + Platform Integration for GitLab. +--- + +# sonarqube_alm_gitlab (Resource) + +Provides a Sonarqube GitLab Alm/Devops Platform Integration resource. This can be used to create and manage a Alm/Devops +Platform Integration for GitLab. + +## Example Usage + +```terraform +resource "sonarqube_alm_gitlab" "gitlab-alm" { + key = "myalm" + personal_access_token = "my_personal_access_token" + url = "https://gitlab.com/api/v4" +} +``` + + +## Schema + +### Required + +- `key` (String) Unique key of the GitLab instance setting. Maximum length: 200 +- `personal_access_token` (String, Sensitive) GitLab App personal access token with the `read_api` scope. See [this doc](https://docs.sonarqube.org/latest/devops-platform-integration/gitlab-integration/#importing-your-gitlab-projects-into-sonarqube) for more information. Maximum length: 2000 +- `url` (String) GitLab API URL. Maximum length: 2000 + +### Read-Only + +- `id` (String) The ID of this resource. diff --git a/docs/resources/sonarqube_azure_binding.md b/docs/resources/azure_binding.md similarity index 55% rename from docs/resources/sonarqube_azure_binding.md rename to docs/resources/azure_binding.md index 68b9b94b..62346505 100644 --- a/docs/resources/sonarqube_azure_binding.md +++ b/docs/resources/azure_binding.md @@ -1,4 +1,5 @@ --- +# generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "sonarqube_azure_binding Resource - terraform-provider-sonarqube" subcategory: "" description: |- @@ -11,7 +12,7 @@ description: |- Provides a Sonarqube Azure Devops binding resource. This can be used to create and manage the binding between an Azure Devops repository and a SonarQube project -## Example: Create an Azure Devops binding +## Example Usage ```terraform resource "sonarqube_alm_azure" "az1" { @@ -34,29 +35,20 @@ resource "sonarqube_azure_binding" "main" { } ``` -## Argument Reference + +## Schema -The following arguments are supported: +### Required -- alm_setting - (Required) - azure ALM setting key -- monorepo - (Optional) - Is this project part of a monorepo. Default value: false -- project - (Required) - SonarQube Project key -- project_name - (Required) - Azure DevOps Project name -- repository_name - (Required) - Azure DevOps Repository name +- `alm_setting` (String) Azure DevOps setting key +- `project` (String) SonarQube project key +- `project_name` (String) Azure project name +- `repository_name` (String) Azure repository name -## Attributes Reference +### Optional -The following attributes are exported: +- `monorepo` (Boolean) Is this project part of a monorepo -- alm_setting - The unique key of the azure alm instance setting. -- project - SonarQube Project key. -- project_name - Azure DevOps Project name. -- repository_name - Azure DevOps Repository name. +### Read-Only -## Import - -Bindings can be imported using their ID - -```terraform -terraform import sonarqube_azure_binding.main project/project_name/repository -``` +- `id` (String) The ID of this resource. diff --git a/docs/resources/github_binding.md b/docs/resources/github_binding.md new file mode 100644 index 00000000..597bda37 --- /dev/null +++ b/docs/resources/github_binding.md @@ -0,0 +1,56 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "sonarqube_github_binding Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube GitHub binding resource. This can be used to create and manage the binding between a + GitHub repository and a SonarQube project +--- + +# sonarqube_github_binding (Resource) + +Provides a Sonarqube GitHub binding resource. This can be used to create and manage the binding between a +GitHub repository and a SonarQube project + +## Example Usage + +```terraform +resource "sonarqube_alm_github" "github-alm" { + app_id = "12345" + client_id = "56789" + client_secret = "secret" + key = "myalm" + private_key = "myprivate_key" + url = "https://api.github.com" + webhook_secret = "mysecret" +} + +resource "sonarqube_project" "main" { + name = "SonarQube" + project = "my_project" + visibility = "public" +} +resource "sonarqube_github_binding" "github-binding" { + alm_setting = sonarqube_alm_github.github-alm.key + project = "my_project" + repository = "myorg/myrepo" +} +``` + + +## Schema + +### Required + +- `alm_setting` (String) GitHub ALM setting key +- `project` (String) Project key +- `repository` (String) The full name of your GitHub repository, including the organization, case-sensitive. Maximum length: 256 + +### Optional + +- `monorepo` (String) Is this project part of a monorepo. Default value: false +- `summary_comment_enabled` (String) Enable/disable summary in PR discussion tab. Default value: true + +### Read-Only + +- `id` (String) The ID of this resource. diff --git a/docs/resources/gitlab_binding.md b/docs/resources/gitlab_binding.md new file mode 100644 index 00000000..423574da --- /dev/null +++ b/docs/resources/gitlab_binding.md @@ -0,0 +1,52 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "sonarqube_gitlab_binding Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube GitLab binding resource. This can be used to create and manage the binding between a + GitLab repository and a SonarQube project +--- + +# sonarqube_gitlab_binding (Resource) + +Provides a Sonarqube GitLab binding resource. This can be used to create and manage the binding between a +GitLab repository and a SonarQube project + +## Example Usage + +```terraform +resource "sonarqube_alm_gitlab" "gitlab-alm" { + key = "myalm" + personal_access_token = "my_personal_access_token" + url = "https://gitlab.com/api/v4" +} + +resource "sonarqube_project" "main" { + name = "SonarQube" + project = "my_project" + visibility = "public" +} + +resource "sonarqube_gitlab_binding" "gitlab-binding" { + alm_setting = sonarqube_alm_gitlab.gitlab-alm.key + project = "my_project" + repository = "123" +} +``` + + +## Schema + +### Required + +- `alm_setting` (String) GitLab ALM setting key +- `project` (String) SonarQube project key. Changing this will force a new resource to be created +- `repository` (String) The GitLab project ID + +### Optional + +- `monorepo` (String) Is this project part of a monorepo. Default value: false + +### Read-Only + +- `id` (String) The ID of this resource. diff --git a/docs/resources/group.md b/docs/resources/group.md new file mode 100644 index 00000000..42921e1d --- /dev/null +++ b/docs/resources/group.md @@ -0,0 +1,35 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "sonarqube_group Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Group resource. This can be used to create and manage Sonarqube Groups. +--- + +# sonarqube_group (Resource) + +Provides a Sonarqube Group resource. This can be used to create and manage Sonarqube Groups. + +## Example Usage + +```terraform +resource "sonarqube_group" "project_users" { + name = "Project-Users" + description = "This is a group" +} +``` + + +## Schema + +### Required + +- `name` (String) The name of the Group to create. Changing this forces a new resource to be created. + +### Optional + +- `description` (String) Description of the Group. + +### Read-Only + +- `id` (String) The ID of this resource. diff --git a/docs/resources/group_member.md b/docs/resources/group_member.md new file mode 100644 index 00000000..0b5d4aff --- /dev/null +++ b/docs/resources/group_member.md @@ -0,0 +1,43 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "sonarqube_group_member Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Group Member resource. This can be used to add or remove user to or from Sonarqube Groups. +--- + +# sonarqube_group_member (Resource) + +Provides a Sonarqube Group Member resource. This can be used to add or remove user to or from Sonarqube Groups. + +## Example Usage + +```terraform +resource "sonarqube_user" "user" { + login_name = "terraform-test" + name = "terraform-test" + password = "secret-sauce37!" +} + +resource "sonarqube_group" "project_users" { + name = "Project-Users" + description = "This is a group" +} + +resource "sonarqube_group_member" "project_users_member" { + name = sonarqube_group.project_users.name + login_name = sonarqube_user.user.login_name +} +``` + + +## Schema + +### Required + +- `login_name` (String) The `login_name` of the User to add as a member. Changing this forces a new resource to be created. +- `name` (String) The name of the Group to add a member to. Changing this forces a new resource to be created. + +### Read-Only + +- `id` (String) The ID of this resource. diff --git a/docs/resources/new_code_periods.md b/docs/resources/new_code_periods.md new file mode 100644 index 00000000..f52f0e65 --- /dev/null +++ b/docs/resources/new_code_periods.md @@ -0,0 +1,49 @@ +--- +page_title: "sonarqube_new_code_periods Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube New Code Periods resource. This can be used to manage Sonarqube New Code Periods. +--- + +# sonarqube_new_code_periods (Resource) + +Provides a Sonarqube New Code Periods resource. This can be used to manage Sonarqube New Code Periods. + +## Example Usage + +### Example: Set the global new code period to a number of days +```terraform +resource "sonarqube_new_code_periods" "code_period" { + type = "NUMBER_OF_DAYS" + value = "7" +} +``` + +### Example: create a project and set its new code period to a reference branch +```terraform +resource "sonarqube_project" "reference" { + name = "my-project" +} + +resource "sonarqube_new_code_periods" "reference" { + project = sonarqube_project.reference.project + type = "REFERENCE_BRANCH" + value = "main" +``` + + +## Schema + +### Required + +- `type` (String) The kind of new code period to use. Supported values are SPECIFIC_ANALYSIS, PREVIOUS_VERSION, NUMBER_OF_DAYS, or REFERENCE_BRANCH. + +### Optional + +- `branch` (String) The name of a branch of a project for which the new code period will be configured. Changing this will force a new resource to be created. Setting this also requires setting the 'project' argument. +- `project` (String) The key of a project for which the new code period will be configured. Changing this will force a new resource to be created. +- `value` (String) The desired value of the new code period. Varies based on the 'type'. For SPECIFIC_ANALYIS, the value must be the UUID of a previous analysis. For NUMBER_OF_DAYS it must be a numeric string. For REFERENCE_BRANCH it should be the name of branch on the project. For PREVIOUS_VERSION it must **not** be set. + +### Read-Only + +- `id` (String) The ID of this resource. diff --git a/docs/resources/permission_template.md b/docs/resources/permission_template.md new file mode 100644 index 00000000..4f27e999 --- /dev/null +++ b/docs/resources/permission_template.md @@ -0,0 +1,40 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "sonarqube_permission_template Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Permission template resource. This can be used to create and manage Sonarqube Permission + templates. +--- + +# sonarqube_permission_template (Resource) + +Provides a Sonarqube Permission template resource. This can be used to create and manage Sonarqube Permission +templates. + +## Example Usage + +```terraform +resource "sonarqube_permission_template" "template" { + name = "Internal-Projects" + description = "These are internal projects" + project_key_pattern = "internal.*" +} +``` + + +## Schema + +### Required + +- `name` (String) The name of the Permission template to create. Do not use names with `/`. If needed, use `replace(var.permission_template_name, "/", "_")`. Changing this forces a new resource to be created. + +### Optional + +- `default` (Boolean) Set the template as the default. This can only be set for one template. +- `description` (String) Description of the Template. +- `project_key_pattern` (String) The project key pattern. Must be a valid Java regular expression. + +### Read-Only + +- `id` (String) The ID of this resource. diff --git a/docs/resources/permissions.md b/docs/resources/permissions.md new file mode 100644 index 00000000..22493f17 --- /dev/null +++ b/docs/resources/permissions.md @@ -0,0 +1,66 @@ +--- +page_title: "sonarqube_permissions Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Permissions resource. This can be used to manage global and project permissions. +--- + +# sonarqube_permissions (Resource) + +Provides a Sonarqube Permissions resource. This can be used to manage global and project permissions. + +## Example Usage + +### Example: Set global admin permissions for a group called "my-admins" +```terraform +resource "sonarqube_permissions" "my_global_admins" { + group_name = "my-admins" + permissions = ["admin"] +} +``` + +### Example: Set project admin permissions for a group called "my-project-admins" +```terraform +resource "sonarqube_permissions" "my_project_admins" { + group_name = "my-project-admins" + project_key = "my-project" + permissions = ["admin"] +} +``` + +### Example: Set project admin permissions for a group called "my-project-admins on a permission template" +```terraform +resource "sonarqube_permissions" "internal_admins" { + group_name = "my-internal-admins" + template_id = sonarqube_permission_template.template.id + permissions = ["admin"] +} +``` + +### Example: Set codeviewer & user permissions on project level for a user called "johndoe" +```terraform +resource "sonarqube_permissions" "john_project_read" { + login_name = "johndoe" + project_key = "my-project" + permissions = ["codeviewer", "user"] +} +``` + + +## Schema + +### Required + +- `permissions` (List of String) A list of permissions that should be applied. Changing this forces a new resource to be created. Possible values are: `admin`, `codeviewer`, `issueadmin`, `securityhotspotadmin`, `scan`, `user`. + +### Optional + +- `group_name` (String) The name of the Group that should get the specified permissions. Changing this forces a new resource to be created. Cannot be used with `login_name` +- `login_name` (String) The name of the user that should get the specified permissions. Changing this forces a new resource to be created. Cannot be used with `group_name` +- `project_key` (String) Specify if you want to apply project level permissions. Changing this forces a new resource to be created. Cannot be used with `template_id & template_name` +- `template_id` (String) Specify if you want to apply the permissions to a permission template. Changing this forces a new resource to be created. Cannot be used with `project_key & template_name` +- `template_name` (String) Specify if you want to apply the permissions to a permission template. Changing this forces a new resource to be created. Cannot be used with `project_key & template_id` + +### Read-Only + +- `id` (String) The ID of this resource. diff --git a/docs/resources/plugin.md b/docs/resources/plugin.md new file mode 100644 index 00000000..af3a8f5d --- /dev/null +++ b/docs/resources/plugin.md @@ -0,0 +1,30 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "sonarqube_plugin Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Plugin resource. This can be used to create and manage Sonarqube Plugins. +--- + +# sonarqube_plugin (Resource) + +Provides a Sonarqube Plugin resource. This can be used to create and manage Sonarqube Plugins. + +## Example Usage + +```terraform +resource "sonarqube_plugin" "main" { + key = "cloudformation" +} +``` + + +## Schema + +### Required + +- `key` (String) The key identifying the plugin to uninstall + +### Read-Only + +- `id` (String) The ID of this resource. diff --git a/docs/resources/portfolio.md b/docs/resources/portfolio.md new file mode 100644 index 00000000..fd8ff220 --- /dev/null +++ b/docs/resources/portfolio.md @@ -0,0 +1,55 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "sonarqube_portfolio Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Portfolio resource. This can be used to create and manage Sonarqube Portfolio. Note that the SonarQube API for Portfolios is called views +--- + +# sonarqube_portfolio (Resource) + +Provides a Sonarqube Portfolio resource. This can be used to create and manage Sonarqube Portfolio. Note that the SonarQube API for Portfolios is called ``views`` + +## Example Usage + +```terraform +resource "sonarqube_portfolio" "main" { + key = "portfolio-key" + name = "portfolio-name" + description = "portfolio-description" +} +``` + + +## Schema + +### Required + +- `description` (String) A description of the Portfolio to create +- `key` (String) The key of the Portfolio to create +- `name` (String) The name of the Portfolio to create + +### Optional + +- `branch` (String) Which branch to analyze. If nothing, or '' is specified, the main branch is used. +- `regexp` (String) A regular expression that is used to match Projects with a matching name OR key. If they match, they are added to the Portfolio +- `selected_projects` (Block Set) A set of projects to add to the portfolio. (see [below for nested schema](#nestedblock--selected_projects)) +- `selection_mode` (String) How to populate the Portfolio to create. Possible values are `NONE`, `MANUAL`, `TAGS`, `REGEXP` or `REST`. [See docs](https://docs.sonarqube.org/9.8/project-administration/managing-portfolios/#populating-portfolios) for how Portfolio population works +- `tags` (List of String) List of Project tags to populate the Portfolio from. Only active when `selection_mode` is `TAGS` +- `visibility` (String) Whether the created portfolio should be visible to everyone, or only specific user/groups. If no visibility is specified, the default portfolio visibility will be `public`. + +### Read-Only + +- `id` (String) The ID of this resource. +- `qualifier` (String) + + +### Nested Schema for `selected_projects` + +Required: + +- `project_key` (String) The project key of the project to add to the portfolio + +Optional: + +- `selected_branches` (Set of String) A set of branches for the project to add to the portfolio diff --git a/docs/resources/project.md b/docs/resources/project.md new file mode 100644 index 00000000..2fcebe8e --- /dev/null +++ b/docs/resources/project.md @@ -0,0 +1,66 @@ +--- +page_title: "sonarqube_project Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Project resource. This can be used to create and manage Sonarqube Project. +--- + +# sonarqube_project (Resource) + +Provides a Sonarqube Project resource. This can be used to create and manage Sonarqube Project. + + +## Example Usage +### Example: create a project +```terraform +resource "sonarqube_project" "main" { + name = "SonarQube" + project = "my_project" + visibility = "public" +} +``` + +### Example: a project with associated settings +```terraform +resource "sonarqube_project" "main" { + name = "SonarQube" + project = "my_project" + visibility = "public" + + setting { + key = "sonar.demo" + value = "sonarqube@example.org" + } +} +``` + + +## Schema + +### Required + +- `name` (String) The name of the Project to create +- `project` (String) Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon. + +### Optional + +- `setting` (Block List) A list of settings associated to the project (see [below for nested schema](#nestedblock--setting)) +- `tags` (List of String) A list of tags to put on the project. +- `visibility` (String) Whether the created project should be visible to everyone, or only specific user/groups. If no visibility is specified, the default project visibility of the organization will be used. Valid values are `public` and `private`. + +### Read-Only + +- `id` (String) The ID of this resource. + + +### Nested Schema for `setting` + +Required: + +- `key` (String) Setting key + +Optional: + +- `field_values` (List of Map of String) Setting field values for the supplied key +- `value` (String) Setting a value for the supplied key +- `values` (List of String) Setting multi values for the supplied key diff --git a/docs/resources/project_main_branch.md b/docs/resources/project_main_branch.md new file mode 100644 index 00000000..2e18de4f --- /dev/null +++ b/docs/resources/project_main_branch.md @@ -0,0 +1,37 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "sonarqube_project_main_branch Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Project main branch resource. This can be used to create and manage a Sonarqube Projects main branch. +--- + +# sonarqube_project_main_branch (Resource) + +Provides a Sonarqube Project main branch resource. This can be used to create and manage a Sonarqube Projects main branch. + +## Example Usage + +```terraform +resource "sonarqube_project" "main" { + name = "SonarQube" + project = "my_project" + visibility = "public" +} +resource "sonarqube_project_main_branch" "mybranch" { + name = "release" + project = "my_project" +} +``` + + +## Schema + +### Required + +- `name` (String) The name you want the main branch to have. +- `project` (String) Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon. + +### Read-Only + +- `id` (String) The ID of this resource. diff --git a/docs/resources/sonarqube_qualitygate.md b/docs/resources/qualitygate.md similarity index 52% rename from docs/resources/sonarqube_qualitygate.md rename to docs/resources/qualitygate.md index 994b3116..d8ae3456 100644 --- a/docs/resources/sonarqube_qualitygate.md +++ b/docs/resources/qualitygate.md @@ -9,39 +9,65 @@ description: |- Provides a Sonarqube Quality Gate resource. This can be used to create and manage Sonarqube Quality Gates and their Conditions. -## Example: create a quality gate + +## Example Usage ```terraform resource "sonarqube_qualitygate" "main" { - name = "example" - is_default = true + name = "example" + is_default = true + + condition { + metric = "new_coverage" + op = "LT" + threshold = "50" + } + + condition { + metric = "vulnerabilities" + threshold = "10" + op = "GT" + } +} +``` - condition { - metric = "new_coverage" - op = "LT" - threshold = "50" - } +**Disclaimer: Operator Requirement for Grade Rating Conditions** + +When working with grade rating conditions, (A-D), it is important to note that the "GT" (greater than) operator must be used for the `op` field. This is due to SonarQube's API design. More information can be found in this [issue](https://github.com/jdamata/terraform-provider-sonarqube/issues/171). + +For example, if you are using a grade rating metric such as `new_reliability_rating`, where A represents the highest rating and subsequent letters represent lower ratings, you need to supply the `op` field with "GT" via the provider. Using "LT" will return an error from SonarQube's API: +```terraform condition { - metric = "vulnerabilities" - threshold = "10" + metric = "new_reliability_rating" op = "GT" + threshold = "1" } -} ``` -## Argument Reference + +## Schema + +### Required -The following arguments are supported: +- `name` (String) The name of the Quality Gate to create. Maximum length 100 -- name - (Required) The name of the Quality Gate to create. Maximum length 100 -- copy_from - (Optional) Name of an existing Quality Gate to copy from -- is_default - (Optional) When set to true this will make the added Quality Gate default -- condition - (Required) The definition of a Condition to be used by this Quality Gate as documented in the `condition` block below. At least one condition is required for a Quality Gate. +### Optional -A `condition` block supports: +- `condition` (Block List) A list of conditions that the gate uses (see [below for nested schema](#nestedblock--condition)) +- `copy_from` (String) Name of an existing Quality Gate to copy from +- `is_default` (Boolean) When set to true this Quality Gate is set as default -- metric - (Required) Condition metric. +### Read-Only + +- `id` (String) The ID of this resource. + + +### Nested Schema for `condition` + +Required: + +- `metric` (String) Condition metric. Only metrics of the following types are allowed: @@ -58,35 +84,9 @@ A `condition` block supports: - alert_status - security_hotspots - new_security_hotspots +- `op` (String) Condition operator. Possible values are: LT and GT +- `threshold` (String) Condition error threshold (For ratings: A=1, B=2, C=3, D=4) -- threshold - (Required) Condition error threshold (For ratings: A=1, B=2, C=3, D=4) -- op - (Required) Condition operator. Possible values are: LT and GT - -**Disclaimer: Operator Requirement for Grade Rating Conditions** - -When working with grade rating conditions, (A-D), it is important to note that the "GT" (greater than) operator must be used for the `op` field. This is due to SonarQube's API design. More information can be found in this [issue](https://github.com/jdamata/terraform-provider-sonarqube/issues/171). - -For example, if you are using a grade rating metric such as `new_reliability_rating`, where A represents the highest rating and subsequent letters represent lower ratings, you need to supply the `op` field with "GT" via the provider. Using "LT" will return an error from SonarQube's API: - -```terraform - condition { - metric = "new_reliability_rating" - op = "GT" - threshold = "1" - } -``` - -## Attributes Reference - -The following attributes are exported: +Read-Only: -- name - Name of the Sonarqube Quality Gate -- id - ID of the Sonarqube Quality Gate (Deprecated in SonarQube 8.4 and removed in 10.0 so recommended you do not rely on this) - -## Import - -Quality Gates can be imported using its name - -```terraform -terraform import sonarqube_qualitygate.main my-cool-gate -``` +- `id` (String) diff --git a/docs/resources/sonarqube_qualitygate_project_association.md b/docs/resources/qualitygate_project_association.md similarity index 53% rename from docs/resources/sonarqube_qualitygate_project_association.md rename to docs/resources/qualitygate_project_association.md index d86bc264..fb094c41 100644 --- a/docs/resources/sonarqube_qualitygate_project_association.md +++ b/docs/resources/qualitygate_project_association.md @@ -1,4 +1,5 @@ --- +# generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "sonarqube_qualitygate_project_association Resource - terraform-provider-sonarqube" subcategory: "" description: |- @@ -9,11 +10,13 @@ description: |- Provides a Sonarqube Quality Gate Project association resource. This can be used to associate a Quality Gate to a Project -## Example: create a quality gate project association +## Example Usage ```terraform +## Example: create a quality gate project association + resource "sonarqube_qualitygate" "main" { - name = "my_qualitygate" + name = "my_qualitygate" condition { metric = "new_coverage" @@ -23,28 +26,29 @@ resource "sonarqube_qualitygate" "main" { } resource "sonarqube_project" "main" { - name = "SonarQube" - project = "my_project" - visibility = "public" + name = "SonarQube" + project = "my_project" + visibility = "public" } resource "sonarqube_qualitygate_project_association" "main" { - gatename = sonarqube_qualitygate.main.id - projectkey = sonarqube_project.main.project + gatename = sonarqube_qualitygate.main.id + projectkey = sonarqube_project.main.project } ``` -## Argument Reference + +## Schema -The following arguments are supported: +### Required -- gatename - (Required) The name of the Quality Gate -- projectkey - (Required) Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon. +- `projectkey` (String) Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon. -## Import +### Optional -Quality Gates Project Associations can be imported using a combination of quality gate name and project key +- `gateid` (String) +- `gatename` (String) The name of the Quality Gate -```terraform -terraform import sonarqube_qualitygate_project_association.main my_qualitygate/my_project -``` +### Read-Only + +- `id` (String) The ID of this resource. diff --git a/docs/resources/qualitygate_usergroup_association.md b/docs/resources/qualitygate_usergroup_association.md new file mode 100644 index 00000000..be405f4f --- /dev/null +++ b/docs/resources/qualitygate_usergroup_association.md @@ -0,0 +1,76 @@ +--- +page_title: "sonarqube_qualitygate_usergroup_association Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Quality Gate Usergroup association resource. This can be used to associate a Quality Gate to an User or to a Group. + The feature is available on SonarQube 9.2 or newer. +--- + +# sonarqube_qualitygate_usergroup_association (Resource) + +Provides a Sonarqube Quality Gate Usergroup association resource. This can be used to associate a Quality Gate to an User or to a Group. +The feature is available on SonarQube 9.2 or newer. + +## Example Usage +### Example: create a quality gate user association +```terraform +resource "sonarqube_qualitygate" "main" { + name = "my_qualitygate" + + condition { + metric = "new_coverage" + op = "LT" + threshold = "30" + } +} + +resource "sonarqube_user" "qa_user" { + login_name = "qa-user" + name = "qa-user" + password = "secret-sauce37!" +} + +resource "sonarqube_qualitygate_usergroup_association" "main" { + gatename = sonarqube_qualitygate.main.id + login_name = sonarqube_user.qa_user.id +} +``` + +### Example: create a quality gate group association +```terraform +resource "sonarqube_qualitygate" "main" { + name = "my_qualitygate" + + condition { + metric = "new_coverage" + op = "LT" + threshold = "30" + } +} + +resource "sonarqube_group" "qa_team" { + name = "QA-Team" + description = "Quality Assurence Team" +} + +resource "sonarqube_qualitygate_usergroup_association" "main" { + gatename = sonarqube_qualitygate.main.id + group_name = sonarqube_group.qa_team.name +} +``` + + +## Schema + +### Required + +- `gatename` (String) The name of the Quality Gate + +### Optional + +- `group_name` (String) The name of the Group to associate. Either `group_name` or `login_name` should be provided. +- `login_name` (String) The name of the User to associate. Either `group_name` or `login_name` should be provided. + +### Read-Only + +- `id` (String) The ID of this resource. diff --git a/docs/resources/qualityprofile.md b/docs/resources/qualityprofile.md new file mode 100644 index 00000000..91c2c9d9 --- /dev/null +++ b/docs/resources/qualityprofile.md @@ -0,0 +1,40 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "sonarqube_qualityprofile Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Quality Profile resource. This can be used to create and manage Sonarqube Quality Profiles. +--- + +# sonarqube_qualityprofile (Resource) + +Provides a Sonarqube Quality Profile resource. This can be used to create and manage Sonarqube Quality Profiles. + +## Example Usage + +```terraform +resource "sonarqube_qualityprofile" "main" { + name = "example" + language = "js" + is_default = false + parent = "sonar way" +} +``` + + +## Schema + +### Required + +- `language` (String) Quality profile language. Must be one of "cs", "css", "flex", "go", "java", "js", "jsp", "kotlin", "php", "py", "ruby", "scala", "ts", "vbnet", "web", "xml" +- `name` (String) The name of the Quality Profile to create. Maximum length 100 + +### Optional + +- `is_default` (Boolean) When set to true this will make the added Quality Profile default +- `parent` (String) When a parent is provided the quality profile will inherit it's rules + +### Read-Only + +- `id` (String) The ID of this resource. +- `key` (String) ID of the Sonarqube Quality Profile diff --git a/docs/resources/qualityprofile_activate_rule.md b/docs/resources/qualityprofile_activate_rule.md new file mode 100644 index 00000000..a63cdb8e --- /dev/null +++ b/docs/resources/qualityprofile_activate_rule.md @@ -0,0 +1,59 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "sonarqube_qualityprofile_activate_rule Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Rules resource. This can be used to manage Sonarqube rules. +--- + +# sonarqube_qualityprofile_activate_rule (Resource) + +Provides a Sonarqube Rules resource. This can be used to manage Sonarqube rules. + +## Example Usage + +```terraform +resource "sonarqube_rule" "allowed_maven_dependencies" { + custom_key = "Only_use_allowed_Maven_dependencies" + markdown_description = "Description" + name = "Only use allowed Maven dependencies" + params = "FilePattern=**/pom.xml" + severity = "BLOCKER" + status = "READY" + template_key = "xml:XPathCheck" + type = "VULNERABILITY" +} + +resource "sonarqube_qualityprofile" "xml" { + name = "test way - xml" + language = "xml" + is_default = "false" + parent = "Sonar way" +} + +resource "sonarqube_qualityprofile_activate_rule" "xml_rule" { + key = sonarqube_qualityprofile.xml.key # .id also works + rule = sonarqube_rule.allowed_maven_dependencies.id + severity = "BLOCKER" +} +``` + + +## Schema + +### Required + +- `key` (String) Quality Profile key. Can be obtained through api/qualityprofiles/search +- `rule` (String) Rule key + +### Optional + +- `params` (String) Parameters as semi-colon list of =, for example 'params=key1=v1;key2=v2' (Only for custom rule) +- `reset` (String) Reset severity and parameters of activated rule. Set the values defined on parent profile or from rule default values. + - Possible values true false yes no (Default false) +- `severity` (String) Severity. Ignored if parameter reset is true. + - Possible values - INFO, MINOR, MAJOR, CRITICAL, BLOCKER + +### Read-Only + +- `id` (String) The ID of this resource. diff --git a/docs/resources/qualityprofile_project_association.md b/docs/resources/qualityprofile_project_association.md new file mode 100644 index 00000000..a0a4d853 --- /dev/null +++ b/docs/resources/qualityprofile_project_association.md @@ -0,0 +1,45 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "sonarqube_qualityprofile_project_association Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Quality Profile Project association resource. This can be used to associate a Quality Profile to a Project +--- + +# sonarqube_qualityprofile_project_association (Resource) + +Provides a Sonarqube Quality Profile Project association resource. This can be used to associate a Quality Profile to a Project + +## Example Usage + +```terraform +resource "sonarqube_qualityprofile" "main" { + name = "my_quality_profile" + language = "js" +} + +resource "sonarqube_project" "main" { + name = "SonarQube" + project = "my_project" + visibility = "public" +} + +resource "sonarqube_qualityprofile_project_association" "main" { + quality_profile = sonarqube_qualityprofile.main.name + project = sonarqube_project.main.project + language = "js" +} +``` + + +## Schema + +### Required + +- `language` (String) Quality profile language. Must be a langauge in this list https://next.sonarqube.com/sonarqube/web_api/api/languages/list +- `project` (String) Name of the project +- `quality_profile` (String) Name of the Quality Profile + +### Read-Only + +- `id` (String) The ID of this resource. diff --git a/docs/resources/rule.md b/docs/resources/rule.md new file mode 100644 index 00000000..0124d677 --- /dev/null +++ b/docs/resources/rule.md @@ -0,0 +1,42 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "sonarqube_rule Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Rules resource. This can be used to manage Sonarqube rules. +--- + +# sonarqube_rule (Resource) + +Provides a Sonarqube Rules resource. This can be used to manage Sonarqube rules. + + + + +## Schema + +### Required + +- `custom_key` (String) key of the custom rule should only contain : a-z, 0-9, \_ +- `markdown_description` (String) Rule description +- `name` (String) Rule name +- `template_key` (String) Key of the template rule in order to create a custom rule (mandatory for custom rule) + - [Example values](https://docs.sonarqube.org/latest/user-guide/rules/#header-4) + +### Optional + +- `params` (String) Parameters as semi-colon list of =, for example 'params=key1=v1;key2=v2' (Only for custom rule) + - parameter order: expression=value;filePattern=value;message=value +- `prevent_reactivation` (String) If set to true and if the rule has been deactivated (status 'REMOVED'), a status 409 will be returned + - Possible values - true, false, yes, no +- `severity` (String) Rule severity + - Possible values - INFO, MINOR, MAJOR, CRITICAL, BLOCKER +- `status` (String) Rule status + - Possible values - BETA, DEPRECATED, READY, REMOVED + - Default value - READY +- `type` (String) Rule type + - Possible values - CODE_SMELL, BUG, VULNERABILITY, SECURITY_HOTSPOT + +### Read-Only + +- `id` (String) The ID of this resource. diff --git a/docs/resources/setting.md b/docs/resources/setting.md new file mode 100644 index 00000000..b0d0790e --- /dev/null +++ b/docs/resources/setting.md @@ -0,0 +1,53 @@ +--- +page_title: "sonarqube_setting Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Settings resource. This can be used to manage Sonarqube settings. +--- + +# sonarqube_setting (Resource) + +Provides a Sonarqube Settings resource. This can be used to manage Sonarqube settings. + +## Example Usage +### Example: create a setting with multiple values +```terraform +resource "sonarqube_setting" "multi_value_setting" { + key = "sonar.global.exclusions" + values = ["foo", "bar/**/*.*"] +} +``` + +### Example: create a setting with multiple field values +```terraform +resource "sonarqube_setting" "multi_field_setting" { + key = "sonar.issue.ignore.multicriteria" + field_values = [ + { + "ruleKey" : "foo", + "resourceKey" : "bar" + }, + { + "ruleKey" : "foo2", + "resourceKey" : "bar2" + } + ] +} +``` + + +## Schema + +### Required + +- `key` (String) Setting key + +### Optional + +- `field_values` (List of Map of String) Setting field values for the supplied key +- `value` (String) Setting value. To reset a value, please use the reset web service. +- `values` (List of String) Setting multi values for the supplied key + +### Read-Only + +- `id` (String) The ID of this resource. diff --git a/docs/resources/sonarqube_alm_azure.md b/docs/resources/sonarqube_alm_azure.md deleted file mode 100644 index 0f3bd10e..00000000 --- a/docs/resources/sonarqube_alm_azure.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -page_title: "sonarqube_alm_azure Resource - terraform-provider-sonarqube" -subcategory: "" -description: |- - Provides a Sonarqube Azure Devops Alm/Devops Platform Integration resource. This can be used to create and manage a Alm/Devops - Platform Integration for Azure Devops. ---- - -# sonarqube_alm_azure (Resource) - -Provides a Sonarqube Azure Devops Alm/Devops Platform Integration resource. This can be used to create and manage a Alm/Devops -Platform Integration for Azure Devops. - -## Example: Create an Azure Devops Alm Integration - -```terraform -resource "sonarqube_alm_azure" "az1" { - key = "az1" - personal_access_token = "my_pat" - url = "https://dev.azure.com/my-org" -} -``` - -## Argument Reference - -The following arguments are supported: - -- key - (Required) - Unique key of the azure alm instance setting. Maximum length: 200 -- personal_access_token - (Required) - Azure Devops Personal Access Token. Maximum length: 2000 -- url - (Required) - Azure Devops Organization URL. Maximum length: 2000 - -## Attributes Reference - -The following attributes are exported: - -- key - The unique key of the azure alm instance setting. -- url - Azure Devops Organization URL. - -## Import - -Resource can be imported providing their Alm Instance Key and Azure DevOps Personal Access Token - -```terraform -terraform import sonarqube_alm_azure.az1 key/personal_access_token -``` diff --git a/docs/resources/sonarqube_alm_github.md b/docs/resources/sonarqube_alm_github.md deleted file mode 100644 index b0ee6818..00000000 --- a/docs/resources/sonarqube_alm_github.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -page_title: "sonarqube_alm_github Resource - terraform-provider-sonarqube" -subcategory: "" -description: |- - Provides a Sonarqube GitHub Alm/Devops Platform Integration resource. This can be used to create and manage a Alm/Devops - Platform Integration for GitHub. ---- - -# sonarqube_alm_github (Resource) - -Provides a Sonarqube GitHub Alm/Devops Platform Integration resource. This can be used to create and manage a Alm/Devops -Platform Integration for GitHub. - -## Example: Create a GitHub Alm Integration - -```terraform -resource "sonarqube_alm_github" "github-alm" { - app_id = "12345" - client_id = "56789" - client_secret = "secret" - key = "myalm" - private_key = "myprivate_key" - url = "https://api.github.com" - webhook_secret = "mysecret" -} -``` - -## Argument Reference - -The following arguments are supported: - -- app_id - (Required) - GitHub App ID. Maximum length: 80 -- client_id - (Required) - GitHub App Client ID. Maximum length: 80 -- client_secret - (Required) - GitHub App Client Secret. Maximum length: 160 -- key - (Required) - Unique key of the GitHub instance setting. Maximum length: 200 -- private_key - (Required) - GitHub App private key. Maximum length: 2500 -- url - (Required) - GitHub API URL. Maximum length: 2000 -- webhook_secret - (Optional) - GitHub App Webhook Secret. Maximum length: 160 - -## Attributes Reference - -The following attributes are exported: - -- app_id - GitHub App ID. -- client_id - GitHub App Client ID. -- key - The unique key of the GitHub instance setting. -- url - GitHub API URL. diff --git a/docs/resources/sonarqube_alm_gitlab.md b/docs/resources/sonarqube_alm_gitlab.md deleted file mode 100644 index b72edeeb..00000000 --- a/docs/resources/sonarqube_alm_gitlab.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -page_title: "sonarqube_alm_gitlab Resource - terraform-provider-sonarqube" -subcategory: "" -description: |- - Provides a Sonarqube GitLab Alm/Devops Platform Integration resource. This can be used to create and manage a Alm/Devops - Platform Integration for GitLab. ---- - -# sonarqube_alm_gitlab (Resource) - -Provides a Sonarqube GitLab Alm/Devops Platform Integration resource. This can be used to create and manage a Alm/Devops -Platform Integration for GitLab. - -## Example: Create a GitHub Alm Integration - -```terraform -resource "sonarqube_alm_gitlab" "gitlab-alm" { - key = "myalm" - personal_access_token = "my_personal_access_token" - url = "https://gitlab.com/api/v4" -} -``` - -## Argument Reference - -The following arguments are supported: - -- key - (Required) - Unique key of the GitLab instance setting. Maximum length: 200 -- personal_access_token - (Required) - GitLab App personal access token with the `read_api` scope. See [this doc](https://docs.sonarqube.org/latest/devops-platform-integration/gitlab-integration/#importing-your-gitlab-projects-into-sonarqube) for more information. Maximum length: 2000 -- url - (Required) - GitLab API URL. Maximum length: 2000 - -## Attributes Reference - -The following attributes are exported: - -- key - The unique key of the GitLab instance setting. -- url - GitLab API URL. diff --git a/docs/resources/sonarqube_github_binding.md b/docs/resources/sonarqube_github_binding.md deleted file mode 100644 index 6cfdf558..00000000 --- a/docs/resources/sonarqube_github_binding.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -page_title: "sonarqube_github_binding Resource - terraform-provider-sonarqube" -subcategory: "" -description: |- - Provides a Sonarqube GitHub binding resource. This can be used to create and manage the binding between a - GitHub repository and a SonarQube project ---- - -# sonarqube_github_binding (Resource) - -Provides a Sonarqube GitHub binding resource. This can be used to create and manage the binding between a -GitHub repository and a SonarQube project - -## Example: Create a GitHub binding - -```terraform -resource "sonarqube_alm_github" "github-alm" { - app_id = "12345" - client_id = "56789" - client_secret = "secret" - key = "myalm" - private_key = "myprivate_key" - url = "https://api.github.com" - webhook_secret = "mysecret" -} - -resource "sonarqube_project" "main" { - name = "SonarQube" - project = "my_project" - visibility = "public" -} -resource "sonarqube_github_binding" "github-binding" { - alm_setting = sonarqube_alm_github.github-alm.key - project = "my_project" - repository = "myorg/myrepo" -} -``` - -## Argument Reference - -The following arguments are supported: - -- alm_setting - (Required) - GitHub ALM setting key -- monorepo - (Optional) - Is this project part of a monorepo. Default value: false -- project - (Required) - Project key -- repository - (Required) - The full name of your GitHub repository, including the organization, case-sensitive. Maximum length: 256 -- summary_comment_enabled - (optional) - Enable/disable summary in PR discussion tab. Default value: true - -## Attributes Reference - -The following attributes are exported: - -- project - Project key. -- repository - GitHub Repository. -- alm_setting - The unique key of the GitHub instance setting. - -## Import - -Bindings can be imported using their ID - -```terraform -terraform import sonarqube_github_binding.github-binding project/repository -``` diff --git a/docs/resources/sonarqube_gitlab_binding.md b/docs/resources/sonarqube_gitlab_binding.md deleted file mode 100644 index cfff9faa..00000000 --- a/docs/resources/sonarqube_gitlab_binding.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -page_title: "sonarqube_gitlab_binding Resource - terraform-provider-sonarqube" -subcategory: "" -description: |- - Provides a Sonarqube GitLab binding resource. This can be used to create and manage the binding between a - GitLab repository and a SonarQube project ---- - -# sonarqube_gitlab_binding (Resource) - -Provides a Sonarqube GitLab binding resource. This can be used to create and manage the binding between a -GitLab repository and a SonarQube project - -## Example: Create a GitLab binding - -```terraform -resource "sonarqube_alm_gitlab" "gitlab-alm" { - key = "myalm" - personal_access_token = "my_personal_access_token" - url = "https://gitlab.com/api/v4" -} - -resource "sonarqube_project" "main" { - name = "SonarQube" - project = "my_project" - visibility = "public" -} - -resource "sonarqube_gitlab_binding" "gitlab-binding" { - alm_setting = sonarqube_alm_gitlab.gitlab-alm.key - project = "my_project" - repository = "123" -} -``` - -## Argument Reference - -The following arguments are supported: - -- alm_setting - (Required) - GitLab ALM setting key -- monorepo - (Optional) - Is this project part of a monorepo. Default value: false -- project - (Required) - SonarQube project key. Changing this will force a new resource to be created. -- repository - (Required) - The GitLab project ID. - -## Attributes Reference - -The following attributes are exported: - -- project - SonarQube unique project key. -- repository - GitLab project ID. -- alm_setting - The unique key of the GitLab instance setting. - -## Import - -Bindings can be imported using their ID - -```terraform -terraform import sonarqube_gitlab_binding.gitlab-binding project/repository -``` diff --git a/docs/resources/sonarqube_group.md b/docs/resources/sonarqube_group.md deleted file mode 100644 index 9f579bb8..00000000 --- a/docs/resources/sonarqube_group.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -page_title: "sonarqube_group Resource - terraform-provider-sonarqube" -subcategory: "" -description: |- - Provides a Sonarqube Group resource. This can be used to create and manage Sonarqube Groups. ---- - -# sonarqube_group (Resource) - -Provides a Sonarqube Group resource. This can be used to create and manage Sonarqube Groups. - -## Example: create a group - -```terraform -resource "sonarqube_group" "project_users" { - name = "Project-Users" - description = "This is a group" -} -``` - -## Argument Reference - -The following arguments are supported: - -- name - (Required) The name of the Group to create. Changing this forces a new resource to be created. -- description - (Optional) Description of the Group. - -## Attributes Reference - -The following attributes are exported: - -- id - The ID of the Group. - -## Import - -Groups can be imported using their ID, and only support in the Sonarqube version <= 9.9 - -```terraform -terraform import sonarqube_group.group 101 -``` diff --git a/docs/resources/sonarqube_group_member.md b/docs/resources/sonarqube_group_member.md deleted file mode 100644 index 1026ee60..00000000 --- a/docs/resources/sonarqube_group_member.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -page_title: "sonarqube_group_member Resource - terraform-provider-sonarqube" -subcategory: "" -description: |- - Provides a Sonarqube Group Member resource. This can be used to add or remove user to or from Sonarqube Groups. ---- - -# sonarqube_group_member (Resource) - -Provides a Sonarqube Group Member resource. This can be used to add or remove user to or from Sonarqube Groups. - -## Example: add a user to a group - -```terraform -resource "sonarqube_user" "user" { - login_name = "terraform-test" - name = "terraform-test" - password = "secret-sauce37!" -} - -resource "sonarqube_group" "project_users" { - name = "Project-Users" - description = "This is a group" -} - -resource "sonarqube_group_member" "project_users_member" { - name = sonarqube_group.project_users.name - login_name = sonarqube_user.user.login_name -} -``` - -## Argument Reference - -The following arguments are supported: - -- `name` - (Required) The name of the Group to add a member to. Changing this forces a new resource to be created. -- `login_name` - (Required) The `login_name` of the User to add as a member. Changing this forces a new resource to be created. - -## Attributes Reference - -The following attributes are exported: - -- id - The ID of the Group Membership. - -## Import - -Group Members can be imported using their ID (`[]`): - -```terraform -terraform import sonarqube_group_member.member group[user] -``` diff --git a/docs/resources/sonarqube_new_code_periods.md b/docs/resources/sonarqube_new_code_periods.md deleted file mode 100644 index 521788a8..00000000 --- a/docs/resources/sonarqube_new_code_periods.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -page_title: "sonarqube_new_code_periods Resource - terraform-provider-sonarqube" -subcategory: "" -description: |- - Provides a Sonarqube New Code Periods resource. This can be used to manage Sonarqube New Code Periods. ---- - -# sonarqube_new_code_periods (Resource) - -Provides a Sonarqube New Code Periods resource. This can be used to manage Sonarqube New Code Periods. - -## Example: Set the global new code period to a number of days - -```terraform -resource "sonarqube_new_code_periods" "code_period" { - type = "NUMBER_OF_DAYS" - value = "7" -} -``` - -## Example: create a project and set its new code period to a reference branch - -```terraform -resource "sonarqube_project" "reference" { - name = "my-project" -} - -resource "sonarqube_new_code_periods" "reference" { - project = sonarqube_project.reference.project - type = "REFERENCE_BRANCH" - value = "main" -``` - -## Argument Reference - -The following arguments are supported: - -- type - (Required) The kind of new code period to use. Supported values are SPECIFIC_ANALYSIS, PREVIOUS_VERSION, NUMBER_OF_DAYS, or REFERENCE_BRANCH. -- project - (Optional) The key of a project for which the new code period will be configured. Changing this will force a new resource to be created. -- branch - (Optional) The name of a branch of a project for which the new code period will be configured. Changing this will force a new resource to be created. Setting this also requires setting the 'project' argument. -- value - (Optional) The desired value of the new code period. Varies based on the 'type'. For SPECIFIC_ANALYIS, the value must be the UUID of a previous analysis. For NUMBER_OF_DAYS it must be a numeric string. For REFERENCE_BRANCH it should be the name of branch on the project. For PREVIOUS_VERSION it must **not** be set. - -## Attributes Reference - -The following attributes are exported: - -- id - The ID of the Token. - -## Import - -Import is not supported for this resource. diff --git a/docs/resources/sonarqube_permission_template.md b/docs/resources/sonarqube_permission_template.md deleted file mode 100644 index aab0d3c4..00000000 --- a/docs/resources/sonarqube_permission_template.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -page_title: "sonarqube_permission_template Resource - terraform-provider-sonarqube" -subcategory: "" -description: |- - Provides a Sonarqube Permission template resource. This can be used to create and manage Sonarqube Permission - templates. ---- - -# sonarqube_permission_template (Resource) - -Provides a Sonarqube Permission template resource. This can be used to create and manage Sonarqube Permission -templates. - -## Example: create a template - -```terraform -resource "sonarqube_permission_template" "template" { - name = "Internal-Projects" - description = "These are internal projects" - project_key_pattern = "internal.*" -} -``` - -## Argument Reference - -The following arguments are supported: - -- name - (Required) The name of the Permission template to create. Do not use names with `/`. If needed, use `replace(var.permission_template_name, "/", "_")`. Changing this forces a new resource to be created. -- description - (Optional) Description of the Template. -- project_key_pattern - (Optional) The project key pattern. Must be a valid Java regular expression. -- default - (Optional) Set the template as the default. This can only be set for one template. - -## Attributes Reference - -The following attributes are exported: - -- id - The ID of the Permission template. - -## Import - -Templates can be imported using their ID - -```terraform -terraform import sonarqube_permission_template.template ABC_defghij -``` diff --git a/docs/resources/sonarqube_permissions.md b/docs/resources/sonarqube_permissions.md deleted file mode 100644 index 2bfb3083..00000000 --- a/docs/resources/sonarqube_permissions.md +++ /dev/null @@ -1,72 +0,0 @@ ---- -page_title: "sonarqube_permissions Resource - terraform-provider-sonarqube" -subcategory: "" -description: |- - Provides a Sonarqube Permissions resource. This can be used to manage global and project permissions. ---- - -# sonarqube_permissions (Resource) - -Provides a Sonarqube Permissions resource. This can be used to manage global and project permissions. - -## Example: Set global admin permissions for a group called "my-admins" - -```terraform -resource "sonarqube_permissions" "my_global_admins" { - group_name = "my-admins" - permissions = ["admin"] -} -``` - -## Example: Set project admin permissions for a group called "my-project-admins" - -```terraform -resource "sonarqube_permissions" "my_project_admins" { - group_name = "my-project-admins" - project_key = "my-project" - permissions = ["admin"] -} -``` - -## Example: Set project admin permissions for a group called "my-project-admins on a permission template" - -```terraform -resource "sonarqube_permissions" "internal_admins" { - group_name = "my-internal-admins" - template_id = sonarqube_permission_template.template.id - permissions = ["admin"] -} -``` - -## Example: Set codeviewer & user permissions on project level for a user called "johndoe" - -```terraform -resource "sonarqube_permissions" "john_project_read" { - login_name = "johndoe" - project_key = "my-project" - permissions = ["codeviewer", "user"] -} -``` - -## Argument Reference - -The following arguments are supported: - -- login_name - (Optional) The name of the user that should get the specified permissions. Changing this forces a new resource to be created. Cannot be used with `group_name` -- group_name - (Optional) The name of the Group that should get the specified permissions. Changing this forces a new resource to be created. Cannot be used with `login_name` -- project_key - (Optional) Specify if you want to apply project level permissions. Changing this forces a new resource to be created. Cannot be used with `template_id & template_name` -- template_id - (Optional) Specify if you want to apply the permissions to a permission template. Changing this forces a new resource to be created. Cannot be used with `project_key & template_name` -- template_name - (Optional) Specify if you want to apply the permissions to a permission template. Changing this forces a new resource to be created. Cannot be used with `project_key & template_id` -- permissions - (Required) A list of permissions that should be applied. Changing this forces a new resource to be created. Possible values are: `admin`, `codeviewer`, `issueadmin`, `securityhotspotadmin`, `scan`, `user`. - -**Note:** To prevent unwanted diffs, you should sort the permissions alphabetically. - -## Attributes Reference - -The following attributes are exported: - -- id - A randomly generated UUID for the permission entry. - -## Import - -Importing is not supported for the `sonarqube_permissions` resource. diff --git a/docs/resources/sonarqube_plugin.md b/docs/resources/sonarqube_plugin.md deleted file mode 100644 index 0abc9582..00000000 --- a/docs/resources/sonarqube_plugin.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -page_title: "sonarqube_plugin Resource - terraform-provider-sonarqube" -subcategory: "" -description: |- - Provides a Sonarqube Plugin resource. This can be used to create and manage Sonarqube Plugins. ---- - -# sonarqube_plugin (Resource) - -Provides a Sonarqube Plugin resource. This can be used to create and manage Sonarqube Plugins. - -## Example: create a project - -```terraform -resource "sonarqube_plugin" "main" { - key = "cloudformation" -} -``` - -## Argument Reference - -The following arguments are supported: - -- key - (Required) The key identifying the plugin to uninstall - -## Attributes Reference - -The following attributes are exported: - -- key - (Required) The key identifying the plugin to uninstall - -## Import - -Projects can be imported using their plugin key - -```terraform -terraform import sonarqube_plugin.main key -``` - -## Notes - -After installing or uninstalling a plugin, the sonarqube server needs to be restarted. diff --git a/docs/resources/sonarqube_portfolio.md b/docs/resources/sonarqube_portfolio.md deleted file mode 100644 index 74216a9b..00000000 --- a/docs/resources/sonarqube_portfolio.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -page_title: "sonarqube_portfolio Resource - terraform-provider-sonarqube" -subcategory: "" -description: |- - Provides a Sonarqube Portfolio resource. This can be used to create and manage Sonarqube Portfolio. Note that the SonarQube API for Portfolios is called ``views`` ---- - -# sonarqube_portfolio (Resource) - -Provides a Sonarqube Portfolio resource. This can be used to create and manage Sonarqube Portfolio. Note that the SonarQube API for Portfolios is called `views` - -## Example: create a portfolio - -```terraform -resource "sonarqube_portfolio" "main" { - key = "portfolio-key" - name = "portfolio-name" - description = "portfolio-description" -} -``` - -## Argument Reference - -The following arguments are supported: - -- key - (Required) The key of the Portfolio to create -- name - (Required) The name of the Portfolio to create -- description - (Required) A description of the Portfolio to create -- visibility - (Optional) Whether the created portfolio should be visible to everyone, or only specific user/groups. If no visibility is specified, the default portfolio visibility will be `public`. -- selection_mode - (Optional) How to populate the Portfolio to create. Possible values are `NONE`, `MANUAL`, `TAGS`, `REGEXP` or `REST`. [See docs](https://docs.sonarqube.org/9.8/project-administration/managing-portfolios/#populating-portfolios) for how Portfolio population works -- branch - (Optional) Which branch to analyze. If nothing, or "" is specified, the main branch is used. -- tags - (Optional) List of Project tags to populate the Portfolio from. Only active when `selection_mode` is `TAGS` -- regexp - (Optional) A regular expression that is used to match Projects with a matching name OR key. If they match, they are added to the Portfolio -- `selected_projects` - (Optional) Block set of projects to add to the portfolio. Only active when `selection_mode` is `MANUAL`. See [below for nested schema](#selected_projects) - -### selected_projects - -The `selected_projects` block supports the following: - -- `project_key` - (Required) The key of a project to add to the portfolio -- `selected_branches` (Optional) A list of branches of the project to add to the portfolio. Defaults to the `MAIN BRANCH` of the repo if omitted - -Here is an example of how this option can be leveraged: - -```terraform -data "github_repositories" "repos" { - query = "org:my-cool-org topic:my-cool-topic language:go" -} - -resource "sonarqube_portfolio" "portfolio" { - key = "my-cool-portfolio" - name = "my-cool-portfolio" - description = "my-cool-portfolio" - selection_mode = "MANUAL" - dynamic "selected_projects" { - for_each = toset(data.github_repositories.repos.names) - content { - project_key = selected_projects.value - } - } -} -``` - -## Attributes Reference - -The following attributes are exported in addition to the arguments above: - -- qualifier - (Computed) Key of the portfolio (`VW` for views) -- projects - (Computed) List of projects in the portfolio (only when `selection_mode` is `MANUAL`) - -## Import - -Portfolios can be imported using their portfolio key - -```terraform -terraform import sonarqube_portfolio.main my_portfolio -``` diff --git a/docs/resources/sonarqube_project.md b/docs/resources/sonarqube_project.md deleted file mode 100644 index 0afeea20..00000000 --- a/docs/resources/sonarqube_project.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -page_title: "sonarqube_project Resource - terraform-provider-sonarqube" -subcategory: "" -description: |- - Provides a Sonarqube Project resource. This can be used to create and manage Sonarqube Project. ---- - -# sonarqube_project (Resource) - -Provides a Sonarqube Project resource. This can be used to create and manage Sonarqube Project. - -## Example: create a project - -```terraform -resource "sonarqube_project" "main" { - name = "SonarQube" - project = "my_project" - visibility = "public" -} -``` - -## Example: a project with associated settings - -```terraform -resource "sonarqube_project" "main" { - name = "SonarQube" - project = "my_project" - visibility = "public" - - setting { - key = "sonar.demo" - value = "sonarqube@example.org" - } -} -``` - -## Argument Reference - -The following arguments are supported: - -- name - (Required) The name of the Project to create -- project - (Required) Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon. -- visibility - (Optional) Whether the created project should be visible to everyone, or only specific user/groups. If no visibility is specified, the default project visibility of the organization will be used. Valid values are `public` and `private`. -- tags - (Optional) A list of tags to put on the project. -- setting - (Optional) The definition of a Setting to be used by this Portfolio as documented in the `setting` block below. - -A `setting` block supports: - -- key - (Required) Setting key -- value - (Optional) Single valued setting value -- values - (Optional) Multi-valued setting values -- field_values - (Optional) Multi-field setting values - -One of value, values, field*values \_must* be supplied - -## Attributes Reference - -The following attributes are exported: - -- project - (Required) Key of the project - -## Import - -Projects can be imported using their project key - -```terraform -terraform import sonarqube_project.main my_project -``` diff --git a/docs/resources/sonarqube_project_main_branch.md b/docs/resources/sonarqube_project_main_branch.md deleted file mode 100644 index 7a862f58..00000000 --- a/docs/resources/sonarqube_project_main_branch.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -page_title: "sonarqube_project_main_branch Resource - terraform-provider-sonarqube" -subcategory: "" -description: |- - Provides a Sonarqube Project main branch resource. This can be used to create and manage a Sonarqube Projects main branch. ---- - -# sonarqube_project_main_branch (Resource) - -Provides a Sonarqube Project main branch resource. This can be used to create and manage a Sonarqube Projects main branch. - -## Example: Change the name of the main branch - -```terraform -resource "sonarqube_project" "main" { - name = "SonarQube" - project = "my_project" - visibility = "public" -} -resource "sonarqube_project_main_branch" "mybranch" { - name = "release" - project = "my_project" -} -``` - -## Argument Reference - -The following arguments are supported: - -- name - (Required) The name you want the main branch to have. -- project - (Required) Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon. - -## Attributes Reference - -The following attributes are exported: - -- name - The name of the main branch -- project - Key of the project - -## Import - -Main branch can be imported using their ID - -```terraform -terraform import sonarqube_project_main_branch.mybranch project/name -``` diff --git a/docs/resources/sonarqube_qualitygate_usergroup_association.md b/docs/resources/sonarqube_qualitygate_usergroup_association.md deleted file mode 100644 index e1046bf6..00000000 --- a/docs/resources/sonarqube_qualitygate_usergroup_association.md +++ /dev/null @@ -1,79 +0,0 @@ ---- -page_title: "sonarqube_qualitygate_usergroup_association Resource - terraform-provider-sonarqube" -subcategory: "" -description: |- - Provides a Sonarqube Quality Gate Usergroup association resource. This can be used to associate a Quality Gate to an User or to a Group. - The feature is available on SonarQube 9.2 or newer. ---- - -# sonarqube_qualitygate_usergroup_association (Resource) - -Provides a Sonarqube Quality Gate Usergroup association resource. This can be used to associate a Quality Gate to an User or to a Group. -The feature is available on SonarQube 9.2 or newer. - -## Example: create a quality gate group association - -```terraform -resource "sonarqube_qualitygate" "main" { - name = "my_qualitygate" - - condition { - metric = "new_coverage" - op = "LT" - threshold = "30" - } -} - -resource "sonarqube_group" "qa_team" { - name = "QA-Team" - description = "Quality Assurence Team" -} - -resource "sonarqube_qualitygate_usergroup_association" "main" { - gatename = sonarqube_qualitygate.main.id - group_name = sonarqube_group.qa_team.name -} -``` - -## Example: create a quality gate user association - -```terraform -resource "sonarqube_qualitygate" "main" { - name = "my_qualitygate" - - condition { - metric = "new_coverage" - op = "LT" - threshold = "30" - } -} - -resource "sonarqube_user" "qa_user" { - login_name = "qa-user" - name = "qa-user" - password = "secret-sauce37!" -} - -resource "sonarqube_qualitygate_usergroup_association" "main" { - gatename = sonarqube_qualitygate.main.id - login_name = sonarqube_user.qa_user.id -} -``` - -## Argument Reference - -The following arguments are supported: - -- `gatename` - (Required) The name of the Quality Gate -- `group_name` - (Optional) The name of the Group to associate. Either `group_name` or `login_name` should be provided. -- `login_name` - (Optional) The name of the User to associate. Either `group_name` or `login_name` should be provided. - -## Attributes Reference - -The following attributes are exported: - -- `id` - A quality user/group composed ID for the association entry. - -## Import - -Import is not required because SonarQube overwrites existing associations. diff --git a/docs/resources/sonarqube_qualityprofile.md b/docs/resources/sonarqube_qualityprofile.md deleted file mode 100644 index 9e18b157..00000000 --- a/docs/resources/sonarqube_qualityprofile.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -page_title: "sonarqube_qualityprofile Resource - terraform-provider-sonarqube" -subcategory: "" -description: |- - Provides a Sonarqube Quality Profile resource. This can be used to create and manage Sonarqube Quality Profiles. ---- - -# sonarqube_qualityprofile (Resource) - -Provides a Sonarqube Quality Profile resource. This can be used to create and manage Sonarqube Quality Profiles. - -## Example: create a quality profile - -```terraform -resource "sonarqube_qualityprofile" "main" { - name = "example" - language = "js" - is_default = false - parent = "sonar way" -} -``` - -## Argument Reference - -The following arguments are supported: - -- name - (Required) The name of the Quality Profile to create. Maximum length 100 -- language - (Required) Quality profile language. Must be one of "cs", "css", "flex", "go", "java", "js", "jsp", "kotlin", "php", "py", "ruby", "scala", "ts", "vbnet", "web", "xml" -- is_default - (Optional) When set to true this will make the added Quality Profile default -- parent - (Optional) When a parent is provided the quality profile will inherit it's rules - -## Attributes Reference - -The following attributes are exported: - -- name - Name of the Sonarqube Quality Profile -- id - ID of the Sonarqube Quality Profile -- key - ID of the Sonarqube Quality Profile - -## Import - -Quality Profiles can be imported using their ID - -```terraform -terraform import sonarqube_qualityprofile.main AU-Tpxb--iU5OvuD2FLy -``` diff --git a/docs/resources/sonarqube_qualityprofile_activate_rule.md b/docs/resources/sonarqube_qualityprofile_activate_rule.md deleted file mode 100644 index b3a55f31..00000000 --- a/docs/resources/sonarqube_qualityprofile_activate_rule.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -page_title: "sonarqube_qualityprofile_activate_rule Resource - terraform-provider-sonarqube" -subcategory: "" -description: |- - Provides a Sonarqube Rules resource. This can be used to manage Sonarqube rules. ---- - -# sonarqube_qualityprofile_activate_rule (Resource) - -Provides a Sonarqube Rules resource. This can be used to manage Sonarqube rules. - -## Example: activate a rule - -```terraform - -resource "sonarqube_rule" "allowed_maven_dependencies" { - custom_key = "Only_use_allowed_Maven_dependencies" - markdown_description = "Description" - name = "Only use allowed Maven dependencies" - params = "FilePattern=**/pom.xml" - severity = "BLOCKER" - status = "READY" - template_key = "xml:XPathCheck" - type = "VULNERABILITY" -} - -resource "sonarqube_qualityprofile" "xml" { - name = "test way - xml" - language = "xml" - is_default = "false" - parent = "Sonar way" -} - -resource "sonarqube_qualityprofile_activate_rule" "xml_rule" { - key = sonarqube_qualityprofile.xml.key # .id also works - rule = sonarqube_rule.allowed_maven_dependencies.id - severity = "BLOCKER" -} - -``` - -## Argument Reference - -The following arguments are supported - -- key - (Required) Quality Profile key. Can be obtained through api/qualityprofiles/search -- params - (Optional) Parameters as semi-colon list of key=value. Ignored if parameter reset is true. -- reset - (Optional) Reset severity and parameters of activated rule. Set the values defined on parent profile or from rule default values. - - Possible values true false yes no (Default false) -- rule - Rule key -- severity - (Optional) Severity. Ignored if parameter reset is true. - - Possible values - INFO, MINOR, MAJOR, CRITICAL, BLOCKER - -## Attribute Reference - -The following attributes are exported: - -- key - the Key of the Rule. diff --git a/docs/resources/sonarqube_qualityprofile_project_association.md b/docs/resources/sonarqube_qualityprofile_project_association.md deleted file mode 100644 index 9d1b5d7c..00000000 --- a/docs/resources/sonarqube_qualityprofile_project_association.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -page_title: "sonarqube_qualityprofile_project_association Resource - terraform-provider-sonarqube" -subcategory: "" -description: |- - Provides a Sonarqube Quality Profile Project association resource. This can be used to associate a Quality Profile to a Project ---- - -# sonarqube_qualityprofile_project_association (Resource) - -Provides a Sonarqube Quality Profile Project association resource. This can be used to associate a Quality Profile to a Project - -## Example: create a quality profile project association - -```terraform -resource "sonarqube_qualityprofile" "main" { - name = "my_quality_profile" - language = "js" -} - -resource "sonarqube_project" "main" { - name = "SonarQube" - project = "my_project" - visibility = "public" -} - -resource "sonarqube_qualityprofile_project_association" "main" { - quality_profile = sonarqube_qualityprofile.main.name - project = sonarqube_project.main.project - language = "js" -} -``` - -## Argument Reference - -The following arguments are supported: - -- quality_profile - (Required) Name of the Quality Profile -- project - (Required) Name of the project -- language - (Required) Quality profile language. Must be a langauge in this list https://next.sonarqube.com/sonarqube/web_api/api/languages/list - -## Import - -Quality Profiles Project Associations can be imported using a combination of quality profile name, project name and language - -```terraform -terraform import sonarqube_qualityprofile_project_association.main my_quality_profile/SonarQube/js -``` diff --git a/docs/resources/sonarqube_rules.md b/docs/resources/sonarqube_rules.md deleted file mode 100644 index de835edb..00000000 --- a/docs/resources/sonarqube_rules.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -page_title: "sonarqube_rules Resource - terraform-provider-sonarqube" -subcategory: "" -description: |- - Provides a Sonarqube Rules resource. This can be used to manage Sonarqube rules. ---- - -# sonarqube_rules (Resource) - -Provides a Sonarqube Rules resource. This can be used to manage Sonarqube rules. - -## Example: create a rule - -```terraform -resource "sonarqube_rule" "rule" { - key = "rule_test" - markdown_description = "Description of my rule" - name = "rule test" - params = "FilePattern=**/pom.xml" - prevent_reactivation = "false" - severity = "CRITICAL" - status = "READY" - template_key = "xml:XPathCheck" - type = "VULNERABILITY" -} - -``` - -## Argument Reference - -The following arguments are supported - -- key - (Required) key of the custom rule should only contain : a-z, 0-9, \_ -- markdown_description - (Required) Rule description -- name - (Required) Rule name -- params - (Optional) Parameters as semi-colon list of =, for example 'params=key1=v1;key2=v2' (Only for custom rule) - - parameter order: expression=value;filePattern=value;message=value -- prevent_reactivation - (Optional) If set to true and if the rule has been deactivated (status 'REMOVED'), a status 409 will be returned - - Possible values - true, false, yes, no -- severity - (Optional) Rule severity - - Possible values - INFO, MINOR, MAJOR, CRITICAL, BLOCKER -- status - (Optional) Rule status - - Possible values - BETA, DEPRECATED, READY, REMOVED - - Default value READY -- template_key - Key of the template rule in order to create a custom rule (mandatory for custom rule) - - [Example values](https://docs.sonarqube.org/latest/user-guide/rules/#header-4) -- type - (Optional) Rule type - - Possible values - CODE_SMELL, BUG, VULNERABILITY, SECURITY_HOTSPOT - -## Attribute Reference - -The following attributes are exported: - -- key - The Key of the Rule. diff --git a/docs/resources/sonarqube_settings.md b/docs/resources/sonarqube_settings.md deleted file mode 100644 index 8d8c262d..00000000 --- a/docs/resources/sonarqube_settings.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -page_title: "sonarqube_settings Resource - terraform-provider-sonarqube" -subcategory: "" -description: |- - Provides a Sonarqube Settings resource. This can be used to manage Sonarqube settings. ---- - -# sonarqube_settings (Resource) - -Provides a Sonarqube Settings resource. This can be used to manage Sonarqube settings. - -## Example: create a setting with a single value - -```terraform -resource "sonarqube_setting" "single_setting" { - key = "sonar.demo" - value = "sonarqube@example.org" -} - -``` - -## Example: create a setting with multiple values - -```terraform -resource "sonarqube_setting" "multi_value_setting" { - key = "sonar.global.exclusions" - values = ["foo", "bar/**/*.*"] -} -``` - -## Example: create a setting with multiple field values - -```terraform -resource "sonarqube_setting" "multi_field_setting" { - key = "sonar.issue.ignore.multicriteria" - field_values = [ - { - "ruleKey" : "foo", - "resourceKey" : "bar" - }, - { - "ruleKey" : "foo2", - "resourceKey" : "bar2" - } - ] -} -``` - -## Argument Reference - -The following arguments are supported - -- key - (Required) Setting key -- value - (Optional) Single valued setting value -- values - (Optional) Multi-valued setting values -- field_values - (Optional) Multi-field setting values - -One of value, values, field*values \_must* be supplied - -## Attribute Reference - -The following attributes are exported: - -- key - The Key of the Setting. diff --git a/docs/resources/sonarqube_user.md b/docs/resources/sonarqube_user.md deleted file mode 100644 index 2357d9b3..00000000 --- a/docs/resources/sonarqube_user.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -page_title: "sonarqube_user Resource - terraform-provider-sonarqube" -subcategory: "" -description: |- - Provides a Sonarqube User resource. This can be used to manage Sonarqube Users. ---- - -# sonarqube_user (Resource) - -Provides a Sonarqube User resource. This can be used to manage Sonarqube Users. - -**Note**: By default Sonarqube only _deactivates_ a user on `destroy` but keeps its personal data in the database. Since release `9.7` it -is possible to automatically anonymize the data. This can be helpful to comply with regulations like [GDPR](https://en.wikipedia.org/wiki/General_Data_Protection_Regulation). -This behaviour can be activated with the `anonymize_user_on_delete` flag on the `provider` configuration. - -## Example: create a local user - -```terraform -resource "sonarqube_user" "user" { - login_name = "terraform-test" - name = "terraform-test" - password = "secret-sauce37!" -} -``` - -## Example: create a remote user - -```terraform -resource "sonarqube_user" "remote_user" { - login_name = "terraform-test" - name = "terraform-test" - email = "terraform-test@sonarqube.com" - is_local = false -} -``` - -## Argument Reference - -The following arguments are supported: - -- login_name - (Required) The login name of the User to create. Changing this forces a new resource to be created. -- name - (Required) The name of the User to create. Changing this forces a new resource to be created. -- email - (Optional) The email of the User to create. -- password - (Optional) The password of User to create. This is only used if the user is of type `local`. -- is_local - (Optional) `True` if the User should be of type `local`. Defaults to `true`. - -## Attributes Reference - -The following attributes are exported: - -- id - The ID of the User. - -## Import - -Users can be imported using their `login_name`: - -```terraform -terraform import sonarqube_user.user terraform-test -``` diff --git a/docs/resources/sonarqube_user_external_identity.md b/docs/resources/sonarqube_user_external_identity.md deleted file mode 100644 index 7526eff9..00000000 --- a/docs/resources/sonarqube_user_external_identity.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -page_title: "sonarqube_user_external_entity Resource - terraform-provider-sonarqube" -subcategory: "" -description: |- - Updates the *external identity* of a *non local* Sonarqube User. This can be used to set the *Identity Provider* which should be used to - authenticate a specific user. ---- - -# sonarqube_user_external_entity (Resource) - -Updates the _external identity_ of a _non local_ Sonarqube User. This can be used to set the _Identity Provider_ which should be used to -authenticate a specific user. - -The Sonarqube API currently does not provide an endpoint to read the _external identity_ setting of an user. - -## Example: change the external identity to SAML - -```terraform -resource "sonarqube_user" "remote_user" { - login_name = "terraform-test" - name = "terraform-test" - email = "terraform-test@sonarqube.com" - is_local = false -} - -resource "sonarqube_user_external_identity" "remote_user" { - login_name = sonarqube_user.remote_user.login_name - external_identity = "terraform-test@sonarqube.com" - external_provider = "saml" -} -``` - -## Argument Reference - -The following arguments are supported: - -- `login_name` - (Required) The login name of the User to update. Changing this forces a new resource to be created. -- `external_identity` - (Required) The identifier of the User used by the Authentication Provider. Changing this forces a new resource to be - created. -- `external_provider` - (Required) The key of the Authentication Provider. The Authentication Provider must be activated on Sonarqube. Changing - this forces a new resource to be created. diff --git a/docs/resources/sonarqube_user_token.md b/docs/resources/sonarqube_user_token.md deleted file mode 100644 index 04ab1f38..00000000 --- a/docs/resources/sonarqube_user_token.md +++ /dev/null @@ -1,78 +0,0 @@ ---- -page_title: "sonarqube_user_token Resource - terraform-provider-sonarqube" -subcategory: "" -description: |- - Provides a Sonarqube User token resource. This can be used to manage Sonarqube User tokens. ---- - -# sonarqube_user_token (Resource) - -Provides a Sonarqube User token resource. This can be used to manage Sonarqube User tokens. - -## Example: create a user, user token and output the token value - -```terraform -resource "sonarqube_user" "user" { - login_name = "terraform-test" - name = "terraform-test" - password = "secret-sauce37!" -} - -resource "sonarqube_user_token" "token" { - login_name = sonarqube_user.user.login_name - name = "my-token" -} - -output "user_token" { - value = sonarqube_user_token.token.token -} -``` - -## Example: create an expiring global analysis token and output the token value - -```terraform -resource "sonarqube_user_token" "token" { - name = "my-token" - type = "GLOBAL_ANALYSIS_TOKEN" - expiration_date = "2099-01-01" -} - -output "global_analysis_token" { - value = sonarqube_user_token.token.token -} -``` - -## Example: create a project, project analysis token, and output the token value - -```terraform -resource "sonarqube_user_token" "token" { - name = "my-token" - type = "PROJECT_ANALYSIS_TOKEN" - project_key = "my-project" -} - -output "project_analysis_token" { - value = sonarqube_user_token.token.token -} -``` - -## Argument Reference - -The following arguments are supported: - -- login_name - (Optional) The login name of the User for which the token should be created. If not set, the token is created for the authenticated user. Changing this forces a new resource to be created. -- name - (Required) The name of the Token to create. Changing this forces a new resource to be created. -- expiration_date - (Optional) The expiration date of the token being generated, in ISO 8601 format (YYYY-MM-DD). If not set, default to no expiration. -- type - (Optional) The kind of Token to create. Changing this forces a new resource to be created. Possible values are USER_TOKEN, GLOBAL_ANALYSIS_TOKEN, or PROJECT_ANALYSIS_TOKEN. Defaults to USER_TOKEN. If set to PROJECT_ANALYSIS_TOKEN, then the project_key must also be specified. -- project_key - (Optional) The key of the only project that can be analyzed by the PROJECT_ANALYSIS TOKEN being created. Changing this forces a new resource to be created. - -## Attributes Reference - -The following attributes are exported: - -- id - The ID of the Token. -- token - The Token value. - -## Import - -Import is not supported for this resource. diff --git a/docs/resources/sonarqube_webhook.md b/docs/resources/sonarqube_webhook.md deleted file mode 100644 index bc6231a0..00000000 --- a/docs/resources/sonarqube_webhook.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -page_title: "sonarqube_webhook Resource - terraform-provider-sonarqube" -subcategory: "" -description: |- - Provides a Sonarqube Webhook resource. This can be used to manage Sonarqube webhooks. ---- - -# sonarqube_webhook (Resource) - -Provides a Sonarqube Webhook resource. This can be used to manage Sonarqube webhooks. - -## Example: create a webhook - -```terraform -resource "sonarqube_webhook" "webhook" { - name = "terraform-webhook" - url = "https://my-webhook-destination.example.com" -} -``` - -## Example: create a webhook owned by a project - -```terraform -resource "sonarqube_project" "project" { - name = "project" - project = "project" - visibility = "public" -} - -resource "sonarqube_webhook" "webhook" { - name = "terraform-webhook" - url = "https://my-webhook-destination.example.com" - project = sonarqube_project.project.name -} -``` - -## Argument Reference - -The following arguments are supported: - -- name - (Required) The name of the webhook to create. This will be displayed in the Sonarqube administration console. -- url - (Required) The URL to send event payloads to. This must begin with either `https://` or `http://`. -- project - (Optional) The key of the project that will own the webhook. -- secret - (Optional) The secret to send with the event payload. - -## Attributes Reference - -The following attributes are exported: - -- id - The ID (key) of the webhook. - -## Import - -Webhooks can be imported using their ID (key): - -```bash -terraform import sonarqube_webhook.webhook AXnN9NuxdWLvsEEPOr2g -``` diff --git a/docs/resources/user.md b/docs/resources/user.md new file mode 100644 index 00000000..fc05b8f6 --- /dev/null +++ b/docs/resources/user.md @@ -0,0 +1,48 @@ +--- +page_title: "sonarqube_user Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube User resource. This can be used to manage Sonarqube Users. +--- + +# sonarqube_user (Resource) + +Provides a Sonarqube User resource. This can be used to manage Sonarqube Users. + +## Example Usage +### Example: create a local user +```terraform +resource "sonarqube_user" "user" { + login_name = "terraform-test" + name = "terraform-test" + password = "secret-sauce37!" +} +``` + +### Example: create a remote user +```terraform +resource "sonarqube_user" "remote_user" { + login_name = "terraform-test" + name = "terraform-test" + email = "terraform-test@sonarqube.com" + is_local = false +} +``` + + +## Schema + +### Required + +- `login_name` (String) The login name of the User to create. Changing this forces a new resource to be created. +- `name` (String) The name of the User to create. Changing this forces a new resource to be created. + +### Optional + +- `email` (String) The email of the User to create. +- `is_local` (Boolean) `True` if the User should be of type `local`. Defaults to `true`. +- `password` (String, Sensitive) The password of User to create. This is only used if the user is of type `local`. + +### Read-Only + +- `id` (String) The ID of this resource. diff --git a/docs/resources/user_external_identity.md b/docs/resources/user_external_identity.md new file mode 100644 index 00000000..73700c4b --- /dev/null +++ b/docs/resources/user_external_identity.md @@ -0,0 +1,48 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "sonarqube_user_external_identity Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Updates the external identity of a non local Sonarqube User. This can be used to set the Identity Provider which should be used to + authenticate a specific user. + The Sonarqube API currently does not provide an endpoint to read the external identity setting of an user. +--- + +# sonarqube_user_external_identity (Resource) + +Updates the _external identity_ of a _non local_ Sonarqube User. This can be used to set the _Identity Provider_ which should be used to +authenticate a specific user. + +The Sonarqube API currently does not provide an endpoint to read the _external identity_ setting of an user. + +## Example Usage + +```terraform +## Example: change the external identity to SAML + +resource "sonarqube_user" "remote_user" { + login_name = "terraform-test" + name = "terraform-test" + email = "terraform-test@sonarqube.com" + is_local = false +} + +resource "sonarqube_user_external_identity" "remote_user" { + login_name = sonarqube_user.remote_user.login_name + external_identity = "terraform-test@sonarqube.com" + external_provider = "saml" +} +``` + + +## Schema + +### Required + +- `external_identity` (String) The identifier of the User used by the Authentication Provider. Changing this forces a new resource to be created. +- `external_provider` (String) The key of the Authentication Provider. The Authentication Provider must be activated on Sonarqube. Changing this forces a new resource to be created. +- `login_name` (String) The login name of the User to update. Changing this forces a new resource to be created. + +### Read-Only + +- `id` (String) The ID of this resource. diff --git a/docs/resources/user_token.md b/docs/resources/user_token.md new file mode 100644 index 00000000..fd5668ba --- /dev/null +++ b/docs/resources/user_token.md @@ -0,0 +1,74 @@ +--- +page_title: "sonarqube_user_token Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube User token resource. This can be used to manage Sonarqube User tokens. +--- + +# sonarqube_user_token (Resource) + +Provides a Sonarqube User token resource. This can be used to manage Sonarqube User tokens. + +## Example Usage +### Example: create a user, user token and output the token value +```terraform +resource "sonarqube_user" "user" { + login_name = "terraform-test" + name = "terraform-test" + password = "secret-sauce37!" +} + +resource "sonarqube_user_token" "token" { + login_name = sonarqube_user.user.login_name + name = "my-token" +} + +output "user_token" { + value = sonarqube_user_token.token.token +} +``` + +### Example: create an expiring global analysis token and output the token value +```terraform +resource "sonarqube_user_token" "token" { + name = "my-token" + type = "GLOBAL_ANALYSIS_TOKEN" + expiration_date = "2099-01-01" +} + +output "global_analysis_token" { + value = sonarqube_user_token.token.token +} +``` + +### Example: create a project, project analysis token, and output the token value +```terraform +resource "sonarqube_user_token" "token" { + name = "my-token" + type = "PROJECT_ANALYSIS_TOKEN" + project_key = "my-project" +} + +output "project_analysis_token" { + value = sonarqube_user_token.token.token +} +``` + + +## Schema + +### Required + +- `name` (String) The name of the Token to create. Changing this forces a new resource to be created. + +### Optional + +- `expiration_date` (String) The expiration date of the token being generated, in ISO 8601 format (YYYY-MM-DD). If not set, default to no expiration. +- `login_name` (String) The login name of the User for which the token should be created. If not set, the token is created for the authenticated user. Changing this forces a new resource to be created. +- `project_key` (String) The key of the only project that can be analyzed by the PROJECT_ANALYSIS TOKEN being created. Changing this forces a new resource to be created. +- `type` (String) The kind of Token to create. Changing this forces a new resource to be created. Possible values are USER_TOKEN, GLOBAL_ANALYSIS_TOKEN, or PROJECT_ANALYSIS_TOKEN. Defaults to USER_TOKEN. If set to PROJECT_ANALYSIS_TOKEN, then the project_key must also be specified. + +### Read-Only + +- `id` (String) The ID of this resource. +- `token` (String, Sensitive) The token value. diff --git a/docs/resources/webhook.md b/docs/resources/webhook.md new file mode 100644 index 00000000..ecd1f97a --- /dev/null +++ b/docs/resources/webhook.md @@ -0,0 +1,51 @@ +--- +page_title: "sonarqube_webhook Resource - terraform-provider-sonarqube" +subcategory: "" +description: |- + Provides a Sonarqube Webhook resource. This can be used to manage Sonarqube webhooks. +--- + +# sonarqube_webhook (Resource) + +Provides a Sonarqube Webhook resource. This can be used to manage Sonarqube webhooks. + +## Example Usage +### Example: create a webhook +```terraform +resource "sonarqube_webhook" "webhook" { + name = "terraform-webhook" + url = "https://my-webhook-destination.example.com" +} +``` + +### Example: create a webhook owned by a project +```terraform +resource "sonarqube_project" "project" { + name = "project" + project = "project" + visibility = "public" +} + +resource "sonarqube_webhook" "webhook" { + name = "terraform-webhook" + url = "https://my-webhook-destination.example.com" + project = sonarqube_project.project.name +} +``` + + +## Schema + +### Required + +- `name` (String) The name of the webhook to create. This will be displayed in the Sonarqube administration console. +- `url` (String) The URL to send event payloads to. This must begin with either `https://` or `http://`. + +### Optional + +- `project` (String) The key of the project that will own the webhook. +- `secret` (String, Sensitive) The secret to send with the event payload. + +### Read-Only + +- `id` (String) The ID of this resource. diff --git a/examples/data-sources/sonarqube_group/data-source.tf b/examples/data-sources/sonarqube_group/data-source.tf new file mode 100644 index 00000000..4067d4a4 --- /dev/null +++ b/examples/data-sources/sonarqube_group/data-source.tf @@ -0,0 +1,3 @@ +data "sonarqube_group" "group" { + name = "terraform-test" +} diff --git a/examples/data-sources/sonarqube_portfolio/data-source.tf b/examples/data-sources/sonarqube_portfolio/data-source.tf new file mode 100644 index 00000000..ca0bf955 --- /dev/null +++ b/examples/data-sources/sonarqube_portfolio/data-source.tf @@ -0,0 +1,3 @@ +data "sonarqube_portfolio" "portfolio" { + key = "portfolio-key" +} diff --git a/examples/data-sources/sonarqube_project/data-source.tf b/examples/data-sources/sonarqube_project/data-source.tf new file mode 100644 index 00000000..5a1846e0 --- /dev/null +++ b/examples/data-sources/sonarqube_project/data-source.tf @@ -0,0 +1,3 @@ +data "sonarqube_project" "project" { + project = "projet-key-id" +} diff --git a/examples/data-sources/sonarqube_qualitygate/data-source.tf b/examples/data-sources/sonarqube_qualitygate/data-source.tf new file mode 100644 index 00000000..a41e3f2b --- /dev/null +++ b/examples/data-sources/sonarqube_qualitygate/data-source.tf @@ -0,0 +1,3 @@ +data "sonarqube_qualitygate" "main" { + name = "example" +} diff --git a/examples/data-sources/sonarqube_qualityprofile/data-source.tf b/examples/data-sources/sonarqube_qualityprofile/data-source.tf new file mode 100644 index 00000000..85c9212d --- /dev/null +++ b/examples/data-sources/sonarqube_qualityprofile/data-source.tf @@ -0,0 +1,3 @@ +data "sonarqube_qualityprofile" "main" { + name = "example" +} diff --git a/examples/data-sources/sonarqube_rule/data-source.tf b/examples/data-sources/sonarqube_rule/data-source.tf new file mode 100644 index 00000000..5479c7f5 --- /dev/null +++ b/examples/data-sources/sonarqube_rule/data-source.tf @@ -0,0 +1,3 @@ +data "sonarqube_rule" "rule" { + key = "squid:forbidSonar" +} diff --git a/examples/data-sources/sonarqube_user/data-source.tf b/examples/data-sources/sonarqube_user/data-source.tf new file mode 100644 index 00000000..00a24669 --- /dev/null +++ b/examples/data-sources/sonarqube_user/data-source.tf @@ -0,0 +1,3 @@ +data "sonarqube_user" "user" { + login_name = "terraform-test" +} diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf new file mode 100644 index 00000000..91f3a4af --- /dev/null +++ b/examples/provider/provider.tf @@ -0,0 +1,30 @@ +## Example: Authenticate with username and password + +terraform { + required_providers { + sonarqube = { + source = "jdamata/sonarqube" + } + } +} + +provider "sonarqube" { + user = "admin" + pass = "admin" + host = "http://127.0.0.1:9000" +} + +## Example: Authenticate with token + +terraform { + required_providers { + sonarqube = { + source = "jdamata/sonarqube" + } + } +} + +provider "sonarqube" { + token = "d4at55a6f7r199bd707h39625685510880gbf7ff" + host = "http://127.0.0.1:9000" +} diff --git a/examples/resources/sonarqube_alm_azure/resource.tf b/examples/resources/sonarqube_alm_azure/resource.tf new file mode 100644 index 00000000..3cde1b32 --- /dev/null +++ b/examples/resources/sonarqube_alm_azure/resource.tf @@ -0,0 +1,5 @@ +resource "sonarqube_alm_azure" "az1" { + key = "az1" + personal_access_token = "my_pat" + url = "https://dev.azure.com/my-org" +} diff --git a/examples/resources/sonarqube_alm_github/resource.tf b/examples/resources/sonarqube_alm_github/resource.tf new file mode 100644 index 00000000..d93741e6 --- /dev/null +++ b/examples/resources/sonarqube_alm_github/resource.tf @@ -0,0 +1,9 @@ +resource "sonarqube_alm_github" "github-alm" { + app_id = "12345" + client_id = "56789" + client_secret = "secret" + key = "myalm" + private_key = "myprivate_key" + url = "https://api.github.com" + webhook_secret = "mysecret" +} diff --git a/examples/resources/sonarqube_alm_gitlab/resource.tf b/examples/resources/sonarqube_alm_gitlab/resource.tf new file mode 100644 index 00000000..877a6808 --- /dev/null +++ b/examples/resources/sonarqube_alm_gitlab/resource.tf @@ -0,0 +1,5 @@ +resource "sonarqube_alm_gitlab" "gitlab-alm" { + key = "myalm" + personal_access_token = "my_personal_access_token" + url = "https://gitlab.com/api/v4" +} diff --git a/examples/resources/sonarqube_azure_binding/resource.tf b/examples/resources/sonarqube_azure_binding/resource.tf new file mode 100644 index 00000000..87d732e7 --- /dev/null +++ b/examples/resources/sonarqube_azure_binding/resource.tf @@ -0,0 +1,18 @@ +resource "sonarqube_alm_azure" "az1" { + key = "az1" + personal_access_token = "my_pat" + url = "https://dev.azure.com/my-org" +} + +resource "sonarqube_project" "main" { + name = "SonarQube" + project = "main" + visibility = "public" +} + +resource "sonarqube_azure_binding" "main" { + alm_setting = sonarqube_alm_azure.az1.key + project = sonarqube_project.main.project + project_name = "my_azure_project" + repository_name = "my_repo" +} diff --git a/examples/resources/sonarqube_github_binding/resource.tf b/examples/resources/sonarqube_github_binding/resource.tf new file mode 100644 index 00000000..02e939da --- /dev/null +++ b/examples/resources/sonarqube_github_binding/resource.tf @@ -0,0 +1,20 @@ +resource "sonarqube_alm_github" "github-alm" { + app_id = "12345" + client_id = "56789" + client_secret = "secret" + key = "myalm" + private_key = "myprivate_key" + url = "https://api.github.com" + webhook_secret = "mysecret" +} + +resource "sonarqube_project" "main" { + name = "SonarQube" + project = "my_project" + visibility = "public" +} +resource "sonarqube_github_binding" "github-binding" { + alm_setting = sonarqube_alm_github.github-alm.key + project = "my_project" + repository = "myorg/myrepo" +} diff --git a/examples/resources/sonarqube_gitlab_binding/resource.tf b/examples/resources/sonarqube_gitlab_binding/resource.tf new file mode 100644 index 00000000..af00e710 --- /dev/null +++ b/examples/resources/sonarqube_gitlab_binding/resource.tf @@ -0,0 +1,17 @@ +resource "sonarqube_alm_gitlab" "gitlab-alm" { + key = "myalm" + personal_access_token = "my_personal_access_token" + url = "https://gitlab.com/api/v4" +} + +resource "sonarqube_project" "main" { + name = "SonarQube" + project = "my_project" + visibility = "public" +} + +resource "sonarqube_gitlab_binding" "gitlab-binding" { + alm_setting = sonarqube_alm_gitlab.gitlab-alm.key + project = "my_project" + repository = "123" +} diff --git a/examples/resources/sonarqube_group/resource.tf b/examples/resources/sonarqube_group/resource.tf new file mode 100644 index 00000000..7a89843e --- /dev/null +++ b/examples/resources/sonarqube_group/resource.tf @@ -0,0 +1,4 @@ +resource "sonarqube_group" "project_users" { + name = "Project-Users" + description = "This is a group" +} diff --git a/examples/resources/sonarqube_group_member/resource.tf b/examples/resources/sonarqube_group_member/resource.tf new file mode 100644 index 00000000..9e698848 --- /dev/null +++ b/examples/resources/sonarqube_group_member/resource.tf @@ -0,0 +1,15 @@ +resource "sonarqube_user" "user" { + login_name = "terraform-test" + name = "terraform-test" + password = "secret-sauce37!" +} + +resource "sonarqube_group" "project_users" { + name = "Project-Users" + description = "This is a group" +} + +resource "sonarqube_group_member" "project_users_member" { + name = sonarqube_group.project_users.name + login_name = sonarqube_user.user.login_name +} diff --git a/examples/resources/sonarqube_new_code_periods/global.tf b/examples/resources/sonarqube_new_code_periods/global.tf new file mode 100644 index 00000000..2365b7e5 --- /dev/null +++ b/examples/resources/sonarqube_new_code_periods/global.tf @@ -0,0 +1,4 @@ +resource "sonarqube_new_code_periods" "code_period" { + type = "NUMBER_OF_DAYS" + value = "7" +} diff --git a/examples/resources/sonarqube_new_code_periods/project.tf b/examples/resources/sonarqube_new_code_periods/project.tf new file mode 100644 index 00000000..0f5344bf --- /dev/null +++ b/examples/resources/sonarqube_new_code_periods/project.tf @@ -0,0 +1,8 @@ +resource "sonarqube_project" "reference" { + name = "my-project" +} + +resource "sonarqube_new_code_periods" "reference" { + project = sonarqube_project.reference.project + type = "REFERENCE_BRANCH" + value = "main" diff --git a/examples/resources/sonarqube_permission_template/resource.tf b/examples/resources/sonarqube_permission_template/resource.tf new file mode 100644 index 00000000..983b9bf1 --- /dev/null +++ b/examples/resources/sonarqube_permission_template/resource.tf @@ -0,0 +1,5 @@ +resource "sonarqube_permission_template" "template" { + name = "Internal-Projects" + description = "These are internal projects" + project_key_pattern = "internal.*" +} diff --git a/examples/resources/sonarqube_permissions/global-admin.tf b/examples/resources/sonarqube_permissions/global-admin.tf new file mode 100644 index 00000000..0e63df2d --- /dev/null +++ b/examples/resources/sonarqube_permissions/global-admin.tf @@ -0,0 +1,4 @@ +resource "sonarqube_permissions" "my_global_admins" { + group_name = "my-admins" + permissions = ["admin"] +} diff --git a/examples/resources/sonarqube_permissions/project-admin.tf b/examples/resources/sonarqube_permissions/project-admin.tf new file mode 100644 index 00000000..24a16cc4 --- /dev/null +++ b/examples/resources/sonarqube_permissions/project-admin.tf @@ -0,0 +1,5 @@ +resource "sonarqube_permissions" "my_project_admins" { + group_name = "my-project-admins" + project_key = "my-project" + permissions = ["admin"] +} diff --git a/examples/resources/sonarqube_permissions/project-template.tf b/examples/resources/sonarqube_permissions/project-template.tf new file mode 100644 index 00000000..8896bd8f --- /dev/null +++ b/examples/resources/sonarqube_permissions/project-template.tf @@ -0,0 +1,5 @@ +resource "sonarqube_permissions" "internal_admins" { + group_name = "my-internal-admins" + template_id = sonarqube_permission_template.template.id + permissions = ["admin"] +} diff --git a/examples/resources/sonarqube_permissions/project-user.tf b/examples/resources/sonarqube_permissions/project-user.tf new file mode 100644 index 00000000..058c8a4d --- /dev/null +++ b/examples/resources/sonarqube_permissions/project-user.tf @@ -0,0 +1,5 @@ +resource "sonarqube_permissions" "john_project_read" { + login_name = "johndoe" + project_key = "my-project" + permissions = ["codeviewer", "user"] +} diff --git a/examples/resources/sonarqube_plugin/resource.tf b/examples/resources/sonarqube_plugin/resource.tf new file mode 100644 index 00000000..088a09fe --- /dev/null +++ b/examples/resources/sonarqube_plugin/resource.tf @@ -0,0 +1,3 @@ +resource "sonarqube_plugin" "main" { + key = "cloudformation" +} diff --git a/examples/resources/sonarqube_portfolio/resource.tf b/examples/resources/sonarqube_portfolio/resource.tf new file mode 100644 index 00000000..16f96951 --- /dev/null +++ b/examples/resources/sonarqube_portfolio/resource.tf @@ -0,0 +1,5 @@ +resource "sonarqube_portfolio" "main" { + key = "portfolio-key" + name = "portfolio-name" + description = "portfolio-description" +} diff --git a/examples/resources/sonarqube_project/project-settings.tf b/examples/resources/sonarqube_project/project-settings.tf new file mode 100644 index 00000000..2cc41c0c --- /dev/null +++ b/examples/resources/sonarqube_project/project-settings.tf @@ -0,0 +1,10 @@ +resource "sonarqube_project" "main" { + name = "SonarQube" + project = "my_project" + visibility = "public" + + setting { + key = "sonar.demo" + value = "sonarqube@example.org" + } +} diff --git a/examples/resources/sonarqube_project/project.tf b/examples/resources/sonarqube_project/project.tf new file mode 100644 index 00000000..6a6f2e22 --- /dev/null +++ b/examples/resources/sonarqube_project/project.tf @@ -0,0 +1,5 @@ +resource "sonarqube_project" "main" { + name = "SonarQube" + project = "my_project" + visibility = "public" +} diff --git a/examples/resources/sonarqube_project_main_branch/resource.tf b/examples/resources/sonarqube_project_main_branch/resource.tf new file mode 100644 index 00000000..b56216c6 --- /dev/null +++ b/examples/resources/sonarqube_project_main_branch/resource.tf @@ -0,0 +1,9 @@ +resource "sonarqube_project" "main" { + name = "SonarQube" + project = "my_project" + visibility = "public" +} +resource "sonarqube_project_main_branch" "mybranch" { + name = "release" + project = "my_project" +} diff --git a/examples/resources/sonarqube_qualitygate/resource.tf b/examples/resources/sonarqube_qualitygate/resource.tf new file mode 100644 index 00000000..f725fd3c --- /dev/null +++ b/examples/resources/sonarqube_qualitygate/resource.tf @@ -0,0 +1,16 @@ +resource "sonarqube_qualitygate" "main" { + name = "example" + is_default = true + + condition { + metric = "new_coverage" + op = "LT" + threshold = "50" + } + + condition { + metric = "vulnerabilities" + threshold = "10" + op = "GT" + } +} diff --git a/examples/resources/sonarqube_qualitygate_project_association/resource.tf b/examples/resources/sonarqube_qualitygate_project_association/resource.tf new file mode 100644 index 00000000..92b6cff3 --- /dev/null +++ b/examples/resources/sonarqube_qualitygate_project_association/resource.tf @@ -0,0 +1,22 @@ +## Example: create a quality gate project association + +resource "sonarqube_qualitygate" "main" { + name = "my_qualitygate" + + condition { + metric = "new_coverage" + op = "LT" + threshold = "30" + } +} + +resource "sonarqube_project" "main" { + name = "SonarQube" + project = "my_project" + visibility = "public" +} + +resource "sonarqube_qualitygate_project_association" "main" { + gatename = sonarqube_qualitygate.main.id + projectkey = sonarqube_project.main.project +} diff --git a/examples/resources/sonarqube_qualitygate_usergroup_association/user-association.tf b/examples/resources/sonarqube_qualitygate_usergroup_association/user-association.tf new file mode 100644 index 00000000..ee7a6a59 --- /dev/null +++ b/examples/resources/sonarqube_qualitygate_usergroup_association/user-association.tf @@ -0,0 +1,20 @@ +resource "sonarqube_qualitygate" "main" { + name = "my_qualitygate" + + condition { + metric = "new_coverage" + op = "LT" + threshold = "30" + } +} + +resource "sonarqube_user" "qa_user" { + login_name = "qa-user" + name = "qa-user" + password = "secret-sauce37!" +} + +resource "sonarqube_qualitygate_usergroup_association" "main" { + gatename = sonarqube_qualitygate.main.id + login_name = sonarqube_user.qa_user.id +} diff --git a/examples/resources/sonarqube_qualitygate_usergroup_association/usergroup-association.tf b/examples/resources/sonarqube_qualitygate_usergroup_association/usergroup-association.tf new file mode 100644 index 00000000..5c2889fd --- /dev/null +++ b/examples/resources/sonarqube_qualitygate_usergroup_association/usergroup-association.tf @@ -0,0 +1,19 @@ +resource "sonarqube_qualitygate" "main" { + name = "my_qualitygate" + + condition { + metric = "new_coverage" + op = "LT" + threshold = "30" + } +} + +resource "sonarqube_group" "qa_team" { + name = "QA-Team" + description = "Quality Assurence Team" +} + +resource "sonarqube_qualitygate_usergroup_association" "main" { + gatename = sonarqube_qualitygate.main.id + group_name = sonarqube_group.qa_team.name +} diff --git a/examples/resources/sonarqube_qualityprofile/resource.tf b/examples/resources/sonarqube_qualityprofile/resource.tf new file mode 100644 index 00000000..42982c7d --- /dev/null +++ b/examples/resources/sonarqube_qualityprofile/resource.tf @@ -0,0 +1,6 @@ +resource "sonarqube_qualityprofile" "main" { + name = "example" + language = "js" + is_default = false + parent = "sonar way" +} diff --git a/examples/resources/sonarqube_qualityprofile_activate_rule/resource.tf b/examples/resources/sonarqube_qualityprofile_activate_rule/resource.tf new file mode 100644 index 00000000..f36261c7 --- /dev/null +++ b/examples/resources/sonarqube_qualityprofile_activate_rule/resource.tf @@ -0,0 +1,23 @@ +resource "sonarqube_rule" "allowed_maven_dependencies" { + custom_key = "Only_use_allowed_Maven_dependencies" + markdown_description = "Description" + name = "Only use allowed Maven dependencies" + params = "FilePattern=**/pom.xml" + severity = "BLOCKER" + status = "READY" + template_key = "xml:XPathCheck" + type = "VULNERABILITY" +} + +resource "sonarqube_qualityprofile" "xml" { + name = "test way - xml" + language = "xml" + is_default = "false" + parent = "Sonar way" +} + +resource "sonarqube_qualityprofile_activate_rule" "xml_rule" { + key = sonarqube_qualityprofile.xml.key # .id also works + rule = sonarqube_rule.allowed_maven_dependencies.id + severity = "BLOCKER" +} diff --git a/examples/resources/sonarqube_qualityprofile_project_association/resource.tf b/examples/resources/sonarqube_qualityprofile_project_association/resource.tf new file mode 100644 index 00000000..39b77d8d --- /dev/null +++ b/examples/resources/sonarqube_qualityprofile_project_association/resource.tf @@ -0,0 +1,16 @@ +resource "sonarqube_qualityprofile" "main" { + name = "my_quality_profile" + language = "js" +} + +resource "sonarqube_project" "main" { + name = "SonarQube" + project = "my_project" + visibility = "public" +} + +resource "sonarqube_qualityprofile_project_association" "main" { + quality_profile = sonarqube_qualityprofile.main.name + project = sonarqube_project.main.project + language = "js" +} diff --git a/examples/resources/sonarqube_rules/resource.tf b/examples/resources/sonarqube_rules/resource.tf new file mode 100644 index 00000000..2a85fa2d --- /dev/null +++ b/examples/resources/sonarqube_rules/resource.tf @@ -0,0 +1,11 @@ +resource "sonarqube_rule" "rule" { + key = "rule_test" + markdown_description = "Description of my rule" + name = "rule test" + params = "FilePattern=**/pom.xml" + prevent_reactivation = "false" + severity = "CRITICAL" + status = "READY" + template_key = "xml:XPathCheck" + type = "VULNERABILITY" +} diff --git a/examples/resources/sonarqube_setting/multi-field-values.tf b/examples/resources/sonarqube_setting/multi-field-values.tf new file mode 100644 index 00000000..e97740fb --- /dev/null +++ b/examples/resources/sonarqube_setting/multi-field-values.tf @@ -0,0 +1,13 @@ +resource "sonarqube_setting" "multi_field_setting" { + key = "sonar.issue.ignore.multicriteria" + field_values = [ + { + "ruleKey" : "foo", + "resourceKey" : "bar" + }, + { + "ruleKey" : "foo2", + "resourceKey" : "bar2" + } + ] +} diff --git a/examples/resources/sonarqube_setting/multi-value.tf b/examples/resources/sonarqube_setting/multi-value.tf new file mode 100644 index 00000000..cf1aa4e6 --- /dev/null +++ b/examples/resources/sonarqube_setting/multi-value.tf @@ -0,0 +1,4 @@ +resource "sonarqube_setting" "multi_value_setting" { + key = "sonar.global.exclusions" + values = ["foo", "bar/**/*.*"] +} diff --git a/examples/resources/sonarqube_user/local.tf b/examples/resources/sonarqube_user/local.tf new file mode 100644 index 00000000..8a73775c --- /dev/null +++ b/examples/resources/sonarqube_user/local.tf @@ -0,0 +1,5 @@ +resource "sonarqube_user" "user" { + login_name = "terraform-test" + name = "terraform-test" + password = "secret-sauce37!" +} diff --git a/examples/resources/sonarqube_user/remote.tf b/examples/resources/sonarqube_user/remote.tf new file mode 100644 index 00000000..4b59a43e --- /dev/null +++ b/examples/resources/sonarqube_user/remote.tf @@ -0,0 +1,6 @@ +resource "sonarqube_user" "remote_user" { + login_name = "terraform-test" + name = "terraform-test" + email = "terraform-test@sonarqube.com" + is_local = false +} diff --git a/examples/resources/sonarqube_user_external_identity/resource.tf b/examples/resources/sonarqube_user_external_identity/resource.tf new file mode 100644 index 00000000..eb7175b1 --- /dev/null +++ b/examples/resources/sonarqube_user_external_identity/resource.tf @@ -0,0 +1,14 @@ +## Example: change the external identity to SAML + +resource "sonarqube_user" "remote_user" { + login_name = "terraform-test" + name = "terraform-test" + email = "terraform-test@sonarqube.com" + is_local = false +} + +resource "sonarqube_user_external_identity" "remote_user" { + login_name = sonarqube_user.remote_user.login_name + external_identity = "terraform-test@sonarqube.com" + external_provider = "saml" +} diff --git a/examples/resources/sonarqube_user_token/global-analysis-token.tf b/examples/resources/sonarqube_user_token/global-analysis-token.tf new file mode 100644 index 00000000..b6c32ff9 --- /dev/null +++ b/examples/resources/sonarqube_user_token/global-analysis-token.tf @@ -0,0 +1,9 @@ +resource "sonarqube_user_token" "token" { + name = "my-token" + type = "GLOBAL_ANALYSIS_TOKEN" + expiration_date = "2099-01-01" +} + +output "global_analysis_token" { + value = sonarqube_user_token.token.token +} diff --git a/examples/resources/sonarqube_user_token/project-analysis-token.tf b/examples/resources/sonarqube_user_token/project-analysis-token.tf new file mode 100644 index 00000000..2bd59aee --- /dev/null +++ b/examples/resources/sonarqube_user_token/project-analysis-token.tf @@ -0,0 +1,9 @@ +resource "sonarqube_user_token" "token" { + name = "my-token" + type = "PROJECT_ANALYSIS_TOKEN" + project_key = "my-project" +} + +output "project_analysis_token" { + value = sonarqube_user_token.token.token +} diff --git a/examples/resources/sonarqube_user_token/user-token.tf b/examples/resources/sonarqube_user_token/user-token.tf new file mode 100644 index 00000000..5afdfd45 --- /dev/null +++ b/examples/resources/sonarqube_user_token/user-token.tf @@ -0,0 +1,14 @@ +resource "sonarqube_user" "user" { + login_name = "terraform-test" + name = "terraform-test" + password = "secret-sauce37!" +} + +resource "sonarqube_user_token" "token" { + login_name = sonarqube_user.user.login_name + name = "my-token" +} + +output "user_token" { + value = sonarqube_user_token.token.token +} diff --git a/examples/resources/sonarqube_webhook/project-webhook.tf b/examples/resources/sonarqube_webhook/project-webhook.tf new file mode 100644 index 00000000..ce184124 --- /dev/null +++ b/examples/resources/sonarqube_webhook/project-webhook.tf @@ -0,0 +1,11 @@ +resource "sonarqube_project" "project" { + name = "project" + project = "project" + visibility = "public" +} + +resource "sonarqube_webhook" "webhook" { + name = "terraform-webhook" + url = "https://my-webhook-destination.example.com" + project = sonarqube_project.project.name +} diff --git a/examples/resources/sonarqube_webhook/webhook.tf b/examples/resources/sonarqube_webhook/webhook.tf new file mode 100644 index 00000000..77840c3b --- /dev/null +++ b/examples/resources/sonarqube_webhook/webhook.tf @@ -0,0 +1,4 @@ +resource "sonarqube_webhook" "webhook" { + name = "terraform-webhook" + url = "https://my-webhook-destination.example.com" +} diff --git a/sonarqube/data_source_sonarqube_group.go b/sonarqube/data_source_sonarqube_group.go index 441cbb46..787aa2dc 100644 --- a/sonarqube/data_source_sonarqube_group.go +++ b/sonarqube/data_source_sonarqube_group.go @@ -6,15 +6,18 @@ import ( func dataSourceSonarqubeGroup() *schema.Resource { return &schema.Resource{ - Read: dataSourceSonarqubeGroupRead, + Description: "Use this data source to get a Sonarqube Group resource", + Read: dataSourceSonarqubeGroupRead, Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The name of the group.", }, "description": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The group description.", }, }, } diff --git a/sonarqube/data_source_sonarqube_portfolio.go b/sonarqube/data_source_sonarqube_portfolio.go index 4edbb386..d5202877 100644 --- a/sonarqube/data_source_sonarqube_portfolio.go +++ b/sonarqube/data_source_sonarqube_portfolio.go @@ -6,35 +6,43 @@ import ( func dataSourceSonarqubePortfolio() *schema.Resource { return &schema.Resource{ - Read: dataSourceSonarqubePortfolioRead, + Description: "Use this data source to get a Sonarqube portfolio resource", + Read: dataSourceSonarqubePortfolioRead, Schema: map[string]*schema.Schema{ "key": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The key of the portfolio", }, "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Name of the portfolio", }, "description": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Description of the portfolio", }, "qualifier": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "`VW` (portfolios always have this qualifier)", }, "visibility": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Portfolio visibility", }, "selection_mode": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "How the Portfolio is populated. Possible values are `NONE`, `MANUAL`, `TAGS`, `REGEXP` or `REST`. [See docs](https://docs.sonarqube.org/9.8/project-administration/managing-portfolios/#populating-portfolios) for how Portfolio population works", }, "branch": { // Only active for TAGS, REGEXP and REST - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Which branch is analyzed", }, "tags": { // Only active for TAGS Type: schema.TypeList, @@ -42,10 +50,12 @@ func dataSourceSonarqubePortfolio() *schema.Resource { Elem: &schema.Schema{ Type: schema.TypeString, }, + Description: "The list of tags used to populate the Portfolio. Only active when `selection_mode` is `TAGS`", }, "regexp": { // Only active for REGEXP - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The regular expression used to populate the portfolio. Only active when `selection_mode` is `REGEXP`", }, }, } diff --git a/sonarqube/data_source_sonarqube_project.go b/sonarqube/data_source_sonarqube_project.go index 58e6e074..c994afed 100644 --- a/sonarqube/data_source_sonarqube_project.go +++ b/sonarqube/data_source_sonarqube_project.go @@ -6,19 +6,23 @@ import ( func dataSourceSonarqubeProject() *schema.Resource { return &schema.Resource{ - Read: dataSourceSonarqubeProjectRead, + Description: "Use this data source to get a Sonarqube project resource", + Read: dataSourceSonarqubeProjectRead, Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Name of the project", }, "project": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The project key of the project", }, "visibility": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Project visibility", }, }, } diff --git a/sonarqube/data_source_sonarqube_qualitygate.go b/sonarqube/data_source_sonarqube_qualitygate.go index 0fa5d836..352f83fa 100644 --- a/sonarqube/data_source_sonarqube_qualitygate.go +++ b/sonarqube/data_source_sonarqube_qualitygate.go @@ -6,19 +6,23 @@ import ( func dataSourceSonarqubeQualityGate() *schema.Resource { return &schema.Resource{ - Read: dataSourceSonarqubeQualityGateRead, + Description: "Use this data source to get a Sonarqube qualitygate resource", + Read: dataSourceSonarqubeQualityGateRead, Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The name of the Quality Gate.", }, "copy_from": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Origin of the Quality Gate", }, "is_default": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Quality Gate default.", }, "condition": { Type: schema.TypeList, @@ -43,6 +47,7 @@ func dataSourceSonarqubeQualityGate() *schema.Resource { }, }, }, + Description: "List of Quality Gate conditions.", }, }, } diff --git a/sonarqube/data_source_sonarqube_qualityprofile.go b/sonarqube/data_source_sonarqube_qualityprofile.go index 300727f7..75b01218 100644 --- a/sonarqube/data_source_sonarqube_qualityprofile.go +++ b/sonarqube/data_source_sonarqube_qualityprofile.go @@ -6,23 +6,28 @@ import ( func dataSourceSonarqubeQualityProfile() *schema.Resource { return &schema.Resource{ - Read: dataSourceSonarqubeQualityProfileRead, + Description: "Use this data source to get a Sonarqube qualityprofile resource", + Read: dataSourceSonarqubeQualityProfileRead, Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The name of the Quality Profile", }, "key": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The key of the Quality Profile", }, "language": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Quality Profile language", }, "is_default": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Quality Profile default", }, }, } diff --git a/sonarqube/data_source_sonarqube_rule.go b/sonarqube/data_source_sonarqube_rule.go index ae9901b9..469e6ba5 100644 --- a/sonarqube/data_source_sonarqube_rule.go +++ b/sonarqube/data_source_sonarqube_rule.go @@ -6,35 +6,43 @@ import ( func dataSourceSonarqubeRule() *schema.Resource { return &schema.Resource{ - Read: dataSourceSonarqubeRuleRead, + Description: "Use this data source to get a Sonarqube rule resource", + Read: dataSourceSonarqubeRuleRead, Schema: map[string]*schema.Schema{ "key": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The key of the sonarqube rule. Should be :. https://next.sonarqube.com/sonarqube/web_api/api/rules?query=api%2Frules%2Fcreate", }, "markdown_description": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Rule description", }, "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Rule name", }, "severity": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Rule severity", }, "status": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Rule status", }, "template_key": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Key of the template rule", }, "type": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Rule type", }, }, } diff --git a/sonarqube/data_source_sonarqube_user.go b/sonarqube/data_source_sonarqube_user.go index 9a298f2f..b43d4233 100644 --- a/sonarqube/data_source_sonarqube_user.go +++ b/sonarqube/data_source_sonarqube_user.go @@ -6,23 +6,28 @@ import ( func dataSourceSonarqubeUser() *schema.Resource { return &schema.Resource{ - Read: dataSourceSonarqubeUserRead, + Description: "Use this data source to get a Sonarqube User resource", + Read: dataSourceSonarqubeUserRead, Schema: map[string]*schema.Schema{ "login_name": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The login name of the user", }, "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the user", }, "email": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The email of the user", }, "is_local": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether the user is local", }, }, } diff --git a/sonarqube/resource_sonarqube_alm_azure.go b/sonarqube/resource_sonarqube_alm_azure.go index 9f65d259..c6df2d51 100644 --- a/sonarqube/resource_sonarqube_alm_azure.go +++ b/sonarqube/resource_sonarqube_alm_azure.go @@ -22,6 +22,8 @@ type GetAlmAzure struct { // Returns the resource represented by this file. func resourceSonarqubeAlmAzure() *schema.Resource { return &schema.Resource{ + Description: `Provides a Sonarqube Azure Devops Alm/Devops Platform Integration resource. This can be used to create and manage a Alm/Devops +Platform Integration for Azure Devops.`, Create: resourceSonarqubeAlmAzureCreate, Read: resourceSonarqubeAlmAzureRead, Update: resourceSonarqubeAlmAzureUpdate, @@ -114,8 +116,8 @@ func resourceSonarqubeAlmAzureRead(d *schema.ResourceData, m interface{}) error } } return fmt.Errorf("resourceSonarqubeAzureBindingRead: Failed to find azure binding: %+v", d.Id()) - } + func resourceSonarqubeAlmAzureUpdate(d *schema.ResourceData, m interface{}) error { sonarQubeURL := m.(*ProviderConfiguration).sonarQubeURL sonarQubeURL.Path = strings.TrimSuffix(sonarQubeURL.Path, "/") + "/api/alm_settings/update_azure" diff --git a/sonarqube/resource_sonarqube_alm_github.go b/sonarqube/resource_sonarqube_alm_github.go index 817fe5a0..3f668d2b 100644 --- a/sonarqube/resource_sonarqube_alm_github.go +++ b/sonarqube/resource_sonarqube_alm_github.go @@ -23,6 +23,8 @@ type GetAlmGithub struct { // Returns the resource represented by this file. func resourceSonarqubeAlmGithub() *schema.Resource { return &schema.Resource{ + Description: `Provides a Sonarqube GitHub Alm/Devops Platform Integration resource. This can be used to create and manage a Alm/Devops +Platform Integration for GitHub.`, Create: resourceSonarqubeAlmGithubCreate, Read: resourceSonarqubeAlmGithubRead, Update: resourceSonarqubeAlmGithubUpdate, @@ -31,39 +33,46 @@ func resourceSonarqubeAlmGithub() *schema.Resource { // Define the fields of this schema. Schema: map[string]*schema.Schema{ "app_id": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "GitHub App ID. Maximum length: 80", }, "client_id": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "GitHub App Client ID. Maximum length: 80", }, "client_secret": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "GitHub App Client Secret. Maximum length: 160", }, "key": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "Unique key of the GitHUb instance setting. Maximum length: 200", }, "private_key": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "GitHub App private key. Maximum length: 2500", }, "url": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "GitHub API URL. Maximum length: 2000", }, "webhook_secret": { - Type: schema.TypeString, - Optional: true, - ForceNew: false, + Type: schema.TypeString, + Optional: true, + ForceNew: false, + Description: "GitHub App Webhook Secret. Maximum length: 160", }, }, } @@ -134,8 +143,8 @@ func resourceSonarqubeAlmGithubRead(d *schema.ResourceData, m interface{}) error } } return fmt.Errorf("resourceSonarqubeGithubBindingRead: Failed to find github binding: %+v", d.Id()) - } + func resourceSonarqubeAlmGithubUpdate(d *schema.ResourceData, m interface{}) error { sonarQubeURL := m.(*ProviderConfiguration).sonarQubeURL sonarQubeURL.Path = strings.TrimSuffix(sonarQubeURL.Path, "/") + "/api/alm_settings/update_github" diff --git a/sonarqube/resource_sonarqube_alm_gitlab.go b/sonarqube/resource_sonarqube_alm_gitlab.go index a86dab4d..8fd587ce 100644 --- a/sonarqube/resource_sonarqube_alm_gitlab.go +++ b/sonarqube/resource_sonarqube_alm_gitlab.go @@ -23,6 +23,8 @@ type GetAlmGitlab struct { // Returns the resource represented by this file. func resourceSonarqubeAlmGitlab() *schema.Resource { return &schema.Resource{ + Description: `Provides a Sonarqube GitLab Alm/Devops Platform Integration resource. This can be used to create and manage a Alm/Devops +Platform Integration for GitLab.`, Create: resourceSonarqubeAlmGitlabCreate, Read: resourceSonarqubeAlmGitlabRead, Update: resourceSonarqubeAlmGitlabUpdate, @@ -35,17 +37,20 @@ func resourceSonarqubeAlmGitlab() *schema.Resource { Required: true, ForceNew: true, ValidateDiagFunc: validation.ToDiagFunc(validation.StringLenBetween(1, 200)), + Description: "Unique key of the GitLab instance setting. Maximum length: 200", }, "personal_access_token": { Type: schema.TypeString, Required: true, Sensitive: true, ValidateDiagFunc: validation.ToDiagFunc(validation.StringLenBetween(1, 2000)), + Description: "GitLab App personal access token with the `read_api` scope. See [this doc](https://docs.sonarqube.org/latest/devops-platform-integration/gitlab-integration/#importing-your-gitlab-projects-into-sonarqube) for more information. Maximum length: 2000", }, "url": { Type: schema.TypeString, Required: true, ValidateDiagFunc: validation.ToDiagFunc(validation.StringLenBetween(1, 2000)), + Description: "GitLab API URL. Maximum length: 2000", }, }, } @@ -111,8 +116,8 @@ func resourceSonarqubeAlmGitlabRead(d *schema.ResourceData, m interface{}) error } } return fmt.Errorf("resourceSonarqubeGitlabBindingRead: Failed to find gitlab binding: %+v", d.Id()) - } + func resourceSonarqubeAlmGitlabUpdate(d *schema.ResourceData, m interface{}) error { sonarQubeURL := m.(*ProviderConfiguration).sonarQubeURL sonarQubeURL.Path = strings.TrimSuffix(sonarQubeURL.Path, "/") + "/api/alm_settings/update_gitlab" diff --git a/sonarqube/resource_sonarqube_azure_binding.go b/sonarqube/resource_sonarqube_azure_binding.go index c29a723e..6b8d006d 100644 --- a/sonarqube/resource_sonarqube_azure_binding.go +++ b/sonarqube/resource_sonarqube_azure_binding.go @@ -24,6 +24,8 @@ type GetAzureBinding struct { // Returns the resource represented by this file. func resourceSonarqubeAzureBinding() *schema.Resource { return &schema.Resource{ + Description: `Provides a Sonarqube Azure Devops binding resource. This can be used to create and manage the binding between an +Azure Devops repository and a SonarQube project`, Create: resourceSonarqubeAzureBindingCreate, Read: resourceSonarqubeAzureBindingRead, Delete: resourceSonarqubeAzureBindingDelete, diff --git a/sonarqube/resource_sonarqube_github_binding.go b/sonarqube/resource_sonarqube_github_binding.go index ab4c9692..36fe8aa6 100644 --- a/sonarqube/resource_sonarqube_github_binding.go +++ b/sonarqube/resource_sonarqube_github_binding.go @@ -24,6 +24,8 @@ type GetBinding struct { // Returns the resource represented by this file. func resourceSonarqubeGithubBinding() *schema.Resource { return &schema.Resource{ + Description: `Provides a Sonarqube GitHub binding resource. This can be used to create and manage the binding between a +GitHub repository and a SonarQube project`, Create: resourceSonarqubeGithubBindingCreate, Read: resourceSonarqubeGithubBindingRead, Delete: resourceSonarqubeGithubBindingDelete, @@ -33,31 +35,36 @@ func resourceSonarqubeGithubBinding() *schema.Resource { // Define the fields of this schema. Schema: map[string]*schema.Schema{ "alm_setting": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "GitHub ALM setting key", }, "monorepo": { - Type: schema.TypeString, - Optional: true, - Default: "false", - ForceNew: true, + Type: schema.TypeString, + Optional: true, + Default: "false", + ForceNew: true, + Description: "Is this project part of a monorepo. Default value: false", }, "project": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "Project key", }, "repository": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "The full name of your GitHub repository, including the organization, case-sensitive. Maximum length: 256", }, "summary_comment_enabled": { - Type: schema.TypeString, - Optional: true, - Default: "true", - ForceNew: true, + Type: schema.TypeString, + Optional: true, + Default: "true", + ForceNew: true, + Description: "Enable/disable summary in PR discussion tab. Default value: true", }, }, } diff --git a/sonarqube/resource_sonarqube_gitlab_binding.go b/sonarqube/resource_sonarqube_gitlab_binding.go index 94edf92a..ead6bc61 100644 --- a/sonarqube/resource_sonarqube_gitlab_binding.go +++ b/sonarqube/resource_sonarqube_gitlab_binding.go @@ -14,6 +14,8 @@ import ( // Returns the resource represented by this file. func resourceSonarqubeGitlabBinding() *schema.Resource { return &schema.Resource{ + Description: `Provides a Sonarqube GitLab binding resource. This can be used to create and manage the binding between a +GitLab repository and a SonarQube project`, Create: resourceSonarqubeGitlabBindingCreate, // You can update any project binding with the same API call as the CREATE Update: resourceSonarqubeGitlabBindingCreate, @@ -25,22 +27,26 @@ func resourceSonarqubeGitlabBinding() *schema.Resource { // Define the fields of this schema. Schema: map[string]*schema.Schema{ "alm_setting": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "GitLab ALM setting key", }, "monorepo": { - Type: schema.TypeString, - Optional: true, - Default: "false", + Type: schema.TypeString, + Optional: true, + Default: "false", + Description: "Is this project part of a monorepo. Default value: false", }, "project": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "SonarQube project key. Changing this will force a new resource to be created", }, "repository": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The GitLab project ID", }, }, } diff --git a/sonarqube/resource_sonarqube_group.go b/sonarqube/resource_sonarqube_group.go index ad51fba7..a096db20 100644 --- a/sonarqube/resource_sonarqube_group.go +++ b/sonarqube/resource_sonarqube_group.go @@ -35,10 +35,11 @@ type Group struct { // Returns the resource represented by this file. func resourceSonarqubeGroup() *schema.Resource { return &schema.Resource{ - Create: resourceSonarqubeGroupCreate, - Read: resourceSonarqubeGroupRead, - Update: resourceSonarqubeGroupUpdate, - Delete: resourceSonarqubeGroupDelete, + Description: "Provides a Sonarqube Group resource. This can be used to create and manage Sonarqube Groups.", + Create: resourceSonarqubeGroupCreate, + Read: resourceSonarqubeGroupRead, + Update: resourceSonarqubeGroupUpdate, + Delete: resourceSonarqubeGroupDelete, Importer: &schema.ResourceImporter{ State: resourceSonarqubeGroupImport, }, @@ -46,12 +47,14 @@ func resourceSonarqubeGroup() *schema.Resource { // Define the fields of this schema. Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The name of the Group to create. Changing this forces a new resource to be created.", }, "description": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: "Description of the Group.", }, }, } diff --git a/sonarqube/resource_sonarqube_group_member.go b/sonarqube/resource_sonarqube_group_member.go index e0f76f7c..6d5ece2d 100644 --- a/sonarqube/resource_sonarqube_group_member.go +++ b/sonarqube/resource_sonarqube_group_member.go @@ -26,9 +26,10 @@ type GetGroupMembersResponse struct { // Returns the resource represented by this file. func resourceSonarqubeGroupMember() *schema.Resource { return &schema.Resource{ - Create: resourceSonarqubeGroupMemberCreate, - Read: resourceSonarqubeGroupMemberRead, - Delete: resourceSonarqubeGroupMemberDelete, + Description: "Provides a Sonarqube Group Member resource. This can be used to add or remove user to or from Sonarqube Groups.", + Create: resourceSonarqubeGroupMemberCreate, + Read: resourceSonarqubeGroupMemberRead, + Delete: resourceSonarqubeGroupMemberDelete, Importer: &schema.ResourceImporter{ State: resourceSonarqubeGroupMemberImport, }, @@ -36,14 +37,16 @@ func resourceSonarqubeGroupMember() *schema.Resource { // Define the fields of this schema. Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "The name of the Group to add a member to. Changing this forces a new resource to be created.", }, "login_name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "The `login_name` of the User to add as a member. Changing this forces a new resource to be created.", }, }, } diff --git a/sonarqube/resource_sonarqube_new_code_periods.go b/sonarqube/resource_sonarqube_new_code_periods.go index 25e1862c..f9c0e918 100644 --- a/sonarqube/resource_sonarqube_new_code_periods.go +++ b/sonarqube/resource_sonarqube_new_code_periods.go @@ -35,10 +35,11 @@ const ( // Returns the resource represented by this file. func resourceSonarqubeNewCodePeriodsBinding() *schema.Resource { return &schema.Resource{ - Create: resourceSonarqubeNewCodePeriodsCreate, - Read: resourceSonarqubeNewCodePeriodsRead, - Update: resourceSonarqubeNewCodePeriodsCreate, - Delete: resourceSonarqubeNewCodePeriodsDelete, + Description: "Provides a Sonarqube New Code Periods resource. This can be used to manage Sonarqube New Code Periods.", + Create: resourceSonarqubeNewCodePeriodsCreate, + Read: resourceSonarqubeNewCodePeriodsRead, + Update: resourceSonarqubeNewCodePeriodsCreate, + Delete: resourceSonarqubeNewCodePeriodsDelete, // Define the fields of this schema. Schema: map[string]*schema.Schema{ @@ -47,20 +48,24 @@ func resourceSonarqubeNewCodePeriodsBinding() *schema.Resource { Optional: true, ForceNew: true, RequiredWith: []string{"project"}, + Description: "The name of a branch of a project for which the new code period will be configured. Changing this will force a new resource to be created. Setting this also requires setting the 'project' argument.", }, "project": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: "The key of a project for which the new code period will be configured. Changing this will force a new resource to be created.", }, "type": { Type: schema.TypeString, Required: true, ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{string(SpecificAnalysis), string(PreviousVersion), string(NumberOfDays), string(ReferenceBranch)}, false)), + Description: "The kind of new code period to use. Supported values are SPECIFIC_ANALYSIS, PREVIOUS_VERSION, NUMBER_OF_DAYS, or REFERENCE_BRANCH.", }, "value": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: "The desired value of the new code period. Varies based on the 'type'. For SPECIFIC_ANALYIS, the value must be the UUID of a previous analysis. For NUMBER_OF_DAYS it must be a numeric string. For REFERENCE_BRANCH it should be the name of branch on the project. For PREVIOUS_VERSION it must **not** be set.", }, }, } diff --git a/sonarqube/resource_sonarqube_permissions.go b/sonarqube/resource_sonarqube_permissions.go index 6c83ac5b..457dec78 100644 --- a/sonarqube/resource_sonarqube_permissions.go +++ b/sonarqube/resource_sonarqube_permissions.go @@ -28,9 +28,10 @@ type GroupPermission struct { // Returns the resource represented by this file. func resourceSonarqubePermissions() *schema.Resource { return &schema.Resource{ - Create: resourceSonarqubePermissionsCreate, - Read: resourceSonarqubePermissionsRead, - Delete: resourceSonarqubePermissionsDelete, + Description: "Provides a Sonarqube Permissions resource. This can be used to manage global and project permissions.", + Create: resourceSonarqubePermissionsCreate, + Read: resourceSonarqubePermissionsRead, + Delete: resourceSonarqubePermissionsDelete, // Define the fields of this schema. Schema: map[string]*schema.Schema{ @@ -39,30 +40,35 @@ func resourceSonarqubePermissions() *schema.Resource { Optional: true, ForceNew: true, ExactlyOneOf: []string{"login_name", "group_name"}, + Description: "The name of the user that should get the specified permissions. Changing this forces a new resource to be created. Cannot be used with `group_name`", }, "group_name": { Type: schema.TypeString, Optional: true, ForceNew: true, ExactlyOneOf: []string{"login_name", "group_name"}, + Description: "The name of the Group that should get the specified permissions. Changing this forces a new resource to be created. Cannot be used with `login_name`", }, "project_key": { Type: schema.TypeString, ForceNew: true, Optional: true, ConflictsWith: []string{"template_id", "template_name"}, + Description: "Specify if you want to apply project level permissions. Changing this forces a new resource to be created. Cannot be used with `template_id & template_name`", }, "template_id": { Type: schema.TypeString, ForceNew: true, Optional: true, ConflictsWith: []string{"project_key", "template_name"}, + Description: "Specify if you want to apply the permissions to a permission template. Changing this forces a new resource to be created. Cannot be used with `project_key & template_name`", }, "template_name": { Type: schema.TypeString, ForceNew: true, Optional: true, ConflictsWith: []string{"project_key", "template_id"}, + Description: "Specify if you want to apply the permissions to a permission template. Changing this forces a new resource to be created. Cannot be used with `project_key & template_id`", }, "permissions": { Type: schema.TypeList, @@ -72,13 +78,13 @@ func resourceSonarqubePermissions() *schema.Resource { Elem: &schema.Schema{ Type: schema.TypeString, }, + Description: "A list of permissions that should be applied. Changing this forces a new resource to be created. Possible values are: `admin`, `codeviewer`, `issueadmin`, `securityhotspotadmin`, `scan`, `user`.", }, }, } } func resourceSonarqubePermissionsCreate(d *schema.ResourceData, m interface{}) error { - sonarQubeURL := m.(*ProviderConfiguration).sonarQubeURL permissions := expandPermissions(d) diff --git a/sonarqube/resource_sonarqube_permissions_template.go b/sonarqube/resource_sonarqube_permissions_template.go index 2b61f87e..6a5c1806 100644 --- a/sonarqube/resource_sonarqube_permissions_template.go +++ b/sonarqube/resource_sonarqube_permissions_template.go @@ -33,6 +33,8 @@ type PermissionTemplate struct { // Returns the resource represented by this file. func resourceSonarqubePermissionTemplate() *schema.Resource { return &schema.Resource{ + Description: `Provides a Sonarqube Permission template resource. This can be used to create and manage Sonarqube Permission +templates.`, Create: resourceSonarqubePermissionTemplateCreate, Read: resourceSonarqubePermissionTemplateRead, Update: resourceSonarqubePermissionTemplateUpdate, @@ -44,21 +46,25 @@ func resourceSonarqubePermissionTemplate() *schema.Resource { // Define the fields of this schema. Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "The name of the Permission template to create. Do not use names with `/`. If needed, use `replace(var.permission_template_name, \"/\", \"_\")`. Changing this forces a new resource to be created.", }, "description": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: "Description of the Template.", }, "project_key_pattern": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: "The project key pattern. Must be a valid Java regular expression.", }, "default": { - Type: schema.TypeBool, - Optional: true, + Type: schema.TypeBool, + Optional: true, + Description: "Set the template as the default. This can only be set for one template.", }, }, } @@ -150,7 +156,6 @@ func resourceSonarqubePermissionTemplateRead(d *schema.ResourceData, m interface } return fmt.Errorf("resourceSonarqubePermissionTemplateRead: Failed to find template with ID: %+v", d.Id()) - } func resourceSonarqubePermissionTemplateUpdate(d *schema.ResourceData, m interface{}) error { diff --git a/sonarqube/resource_sonarqube_plugins.go b/sonarqube/resource_sonarqube_plugins.go index f4549e70..48a0547c 100644 --- a/sonarqube/resource_sonarqube_plugins.go +++ b/sonarqube/resource_sonarqube_plugins.go @@ -38,9 +38,10 @@ type Plugin struct { // Returns the resource represented by this file. func resourceSonarqubePlugin() *schema.Resource { return &schema.Resource{ - Create: resourceSonarqubePluginCreate, - Read: resourceSonarqubePluginRead, - Delete: resourceSonarqubePluginDelete, + Description: "Provides a Sonarqube Plugin resource. This can be used to create and manage Sonarqube Plugins.", + Create: resourceSonarqubePluginCreate, + Read: resourceSonarqubePluginRead, + Delete: resourceSonarqubePluginDelete, Importer: &schema.ResourceImporter{ State: resourceSonarqubePluginImport, }, @@ -48,9 +49,10 @@ func resourceSonarqubePlugin() *schema.Resource { // Define the fields of this schema. Schema: map[string]*schema.Schema{ "key": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "The key identifying the plugin to uninstall", }, }, } diff --git a/sonarqube/resource_sonarqube_portfolio.go b/sonarqube/resource_sonarqube_portfolio.go index 53806241..eaab879f 100644 --- a/sonarqube/resource_sonarqube_portfolio.go +++ b/sonarqube/resource_sonarqube_portfolio.go @@ -46,10 +46,11 @@ const ( // Returns the resource represented by this file. func resourceSonarqubePortfolio() *schema.Resource { return &schema.Resource{ - Create: resourceSonarqubePortfolioCreate, - Read: resourceSonarqubePortfolioRead, - Update: resourceSonarqubePortfolioUpdate, - Delete: resourceSonarqubePortfolioDelete, + Description: "Provides a Sonarqube Portfolio resource. This can be used to create and manage Sonarqube Portfolio. Note that the SonarQube API for Portfolios is called ``views``", + Create: resourceSonarqubePortfolioCreate, + Read: resourceSonarqubePortfolioRead, + Update: resourceSonarqubePortfolioUpdate, + Delete: resourceSonarqubePortfolioDelete, Importer: &schema.ResourceImporter{ State: resourceSonarqubePortfolioImport, }, @@ -63,19 +64,22 @@ func resourceSonarqubePortfolio() *schema.Resource { // Define the fields of this schema. Schema: map[string]*schema.Schema{ "key": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "The key of the Portfolio to create", }, "name": { - Type: schema.TypeString, - Required: true, - ForceNew: false, + Type: schema.TypeString, + Required: true, + ForceNew: false, + Description: "The name of the Portfolio to create", }, "description": { - Type: schema.TypeString, - Required: true, - ForceNew: false, + Type: schema.TypeString, + Required: true, + ForceNew: false, + Description: "A description of the Portfolio to create", }, "qualifier": { Type: schema.TypeString, @@ -87,6 +91,7 @@ func resourceSonarqubePortfolio() *schema.Resource { Default: "public", ForceNew: true, // TODO: There currently isn't an API to update this in-place, even though it's possible in the UI ValidateFunc: validation.StringInSlice([]string{"public", "private"}, false), + Description: "Whether the created portfolio should be visible to everyone, or only specific user/groups. If no visibility is specified, the default portfolio visibility will be `public`.", }, "selection_mode": { Type: schema.TypeString, @@ -94,6 +99,7 @@ func resourceSonarqubePortfolio() *schema.Resource { Default: NONE, ForceNew: false, ValidateFunc: validation.StringInSlice([]string{NONE, MANUAL, TAGS, REGEXP, REST}, false), + Description: "How to populate the Portfolio to create. Possible values are `NONE`, `MANUAL`, `TAGS`, `REGEXP` or `REST`. [See docs](https://docs.sonarqube.org/9.8/project-administration/managing-portfolios/#populating-portfolios) for how Portfolio population works", }, "branch": { // Only active for TAGS, REGEXP and REST Type: schema.TypeString, @@ -109,6 +115,7 @@ func resourceSonarqubePortfolio() *schema.Resource { Elem: &schema.Schema{ Type: schema.TypeString, }, + Description: "List of Project tags to populate the Portfolio from. Only active when `selection_mode` is `TAGS`", }, "regexp": { // Only active for REGEXP Type: schema.TypeString, @@ -116,6 +123,7 @@ func resourceSonarqubePortfolio() *schema.Resource { ForceNew: false, ConflictsWith: []string{"selected_projects", "tags"}, ValidateFunc: validation.StringIsValidRegExp, + Description: "A regular expression that is used to match Projects with a matching name OR key. If they match, they are added to the Portfolio", }, "selected_projects": { Type: schema.TypeSet, @@ -139,6 +147,7 @@ func resourceSonarqubePortfolio() *schema.Resource { }, }, }, + Description: "Block set of projects to add to the portfolio. Only active when `selection_mode` is `MANUAL`. See [below for nested schema](#selected_projects)", }, }, }, @@ -190,7 +199,6 @@ func validatePortfolioResource(d *schema.ResourceDiff) error { default: return fmt.Errorf("resourceSonarqubePortfolioCreate: selection_mode needs to be set to one of NONE, MANUAL, TAGS, REGEXP, REST") } - } func portfolioSetSelectionMode(d *schema.ResourceData, m interface{}, sonarQubeURL url.URL) error { @@ -423,7 +431,6 @@ func resourceSonarqubePortfolioImport(d *schema.ResourceData, m interface{}) ([] } func updateResourceDataFromPortfolioReadResponse(d *schema.ResourceData, portfolioReadResponse *Portfolio) { - d.SetId(portfolioReadResponse.Key) d.Set("key", portfolioReadResponse.Key) d.Set("name", portfolioReadResponse.Name) @@ -446,7 +453,6 @@ func updateResourceDataFromPortfolioReadResponse(d *schema.ResourceData, portfol if len(portfolioReadResponse.SelectedProjects) > 0 { d.Set("selected_projects", flattenReadPortfolioSelectedProjectsResponse(&portfolioReadResponse.SelectedProjects)) } - } func readPortfolioFromApi(d *schema.ResourceData, m interface{}) (*Portfolio, error) { diff --git a/sonarqube/resource_sonarqube_project.go b/sonarqube/resource_sonarqube_project.go index b61d7fff..05aede85 100644 --- a/sonarqube/resource_sonarqube_project.go +++ b/sonarqube/resource_sonarqube_project.go @@ -42,10 +42,11 @@ type CreateProjectResponse struct { // Returns the resource represented by this file. func resourceSonarqubeProject() *schema.Resource { return &schema.Resource{ - Create: resourceSonarqubeProjectCreate, - Read: resourceSonarqubeProjectRead, - Update: resourceSonarqubeProjectUpdate, - Delete: resourceSonarqubeProjectDelete, + Description: "Provides a Sonarqube Project resource. This can be used to create and manage Sonarqube Project.", + Create: resourceSonarqubeProjectCreate, + Read: resourceSonarqubeProjectRead, + Update: resourceSonarqubeProjectUpdate, + Delete: resourceSonarqubeProjectDelete, Importer: &schema.ResourceImporter{ State: resourceSonarqubeProjectImport, }, @@ -53,18 +54,21 @@ func resourceSonarqubeProject() *schema.Resource { // Define the fields of this schema. Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "The name of the Project to create", }, "project": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.", }, "visibility": { - Type: schema.TypeString, - Optional: true, - Default: "public", + Type: schema.TypeString, + Optional: true, + Default: "public", + Description: "Whether the created project should be visible to everyone, or only specific user/groups. If no visibility is specified, the default project visibility of the organization will be used. Valid values are `public` and `private`.", }, "tags": { Type: schema.TypeList, @@ -73,6 +77,7 @@ func resourceSonarqubeProject() *schema.Resource { Elem: &schema.Schema{ Type: schema.TypeString, }, + Description: "A list of tags to put on the project.", }, "setting": { Type: schema.TypeList, @@ -109,6 +114,7 @@ func resourceSonarqubeProject() *schema.Resource { }, }, }, + Description: "The definition of a Setting to be used by this Portfolio as documented in the `setting` block below.", }, }, }, @@ -252,7 +258,6 @@ func resourceSonarqubeProjectRead(d *schema.ResourceData, m interface{}) error { } func resourceSonarqubeProjectUpdate(d *schema.ResourceData, m interface{}) error { - // handle default updates (api/users/update) if d.HasChange("visibility") { sonarQubeURL := m.(*ProviderConfiguration).sonarQubeURL diff --git a/sonarqube/resource_sonarqube_project_main_branch.go b/sonarqube/resource_sonarqube_project_main_branch.go index 0bf0a794..f24b9416 100644 --- a/sonarqube/resource_sonarqube_project_main_branch.go +++ b/sonarqube/resource_sonarqube_project_main_branch.go @@ -29,23 +29,26 @@ type Branches struct { // Returns the resource represented by this file. func resourceSonarqubeProjectMainBranch() *schema.Resource { return &schema.Resource{ - Create: resourceSonarqubeProjectMainBranchCreate, - Read: resourceSonarqubeProjectMainBranchRead, - Delete: resourceSonarqubeProjectMainBranchDelete, + Description: "Provides a Sonarqube Project main branch resource. This can be used to create and manage a Sonarqube Projects main branch.", + Create: resourceSonarqubeProjectMainBranchCreate, + Read: resourceSonarqubeProjectMainBranchRead, + Delete: resourceSonarqubeProjectMainBranchDelete, Importer: &schema.ResourceImporter{ State: resourceSonarqubeProjectMainBranchImport, }, // Define the fields of this schema. Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "The name you want the main branch to have.", }, "project": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.", }, }, } @@ -113,7 +116,6 @@ func resourceSonarqubeProjectMainBranchRead(d *schema.ResourceData, m interface{ } } return fmt.Errorf("resourceSonarqubeProjectMainBranchRead: Failed to find project main branch: %+v", d.Id()) - } // TODO make the delete function read the default branch name of the sonarQube instance instead of assuming diff --git a/sonarqube/resource_sonarqube_qualitygate.go b/sonarqube/resource_sonarqube_qualitygate.go index b3b5024a..f890f496 100644 --- a/sonarqube/resource_sonarqube_qualitygate.go +++ b/sonarqube/resource_sonarqube_qualitygate.go @@ -47,10 +47,11 @@ type CreateQualityGateResponse struct { // Returns the resource represented by this file. func resourceSonarqubeQualityGate() *schema.Resource { return &schema.Resource{ - Create: resourceSonarqubeQualityGateCreate, - Read: resourceSonarqubeQualityGateRead, - Update: resourceSonarqubeQualityGateUpdate, - Delete: resourceSonarqubeQualityGateDelete, + Description: "Provides a Sonarqube Quality Gate resource. This can be used to create and manage Sonarqube Quality Gates and their Conditions.", + Create: resourceSonarqubeQualityGateCreate, + Read: resourceSonarqubeQualityGateRead, + Update: resourceSonarqubeQualityGateUpdate, + Delete: resourceSonarqubeQualityGateDelete, Importer: &schema.ResourceImporter{ State: resourceSonarqubeQualityGateImport, }, @@ -58,14 +59,16 @@ func resourceSonarqubeQualityGate() *schema.Resource { // Define the fields of this schema. Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The name of the Quality Gate to create. Maximum length 100", }, "copy_from": { Type: schema.TypeString, Optional: true, ForceNew: true, ConflictsWith: []string{"condition"}, + Description: "Name of an existing Quality Gate to copy from", }, "is_default": { Type: schema.TypeBool, @@ -86,14 +89,33 @@ func resourceSonarqubeQualityGate() *schema.Resource { "metric": { Type: schema.TypeString, Required: true, + Description: `Condition metric. + + Only metrics of the following types are allowed: + + - INT + - MILLISEC + - RATING + - WORK_DUR + - FLOAT + - PERCENT + - LEVEL. + + The following metrics are forbidden: + + - alert_status + - security_hotspots + - new_security_hotspots`, }, "op": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "Condition operator. Possible values are: LT and GT", }, "threshold": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "Condition error threshold (For ratings: A=1, B=2, C=3, D=4)", }, }, }, @@ -355,7 +377,6 @@ func readQualityGateFromApi(d *schema.ResourceData, m interface{}) (*GetQualityG } func synchronizeConditions(d *schema.ResourceData, m interface{}, apiQualityGateConditions *[]ReadQualityGateConditionsResponse) (bool, error) { - changed := false qualityGateConditions := d.Get("condition").([]interface{}) @@ -448,7 +469,6 @@ func updateResourceDataFromQualityGateReadResponse(d *schema.ResourceData, quali } func createCondition(qualityGateName string, metric string, op string, threshold string, m interface{}) (string, error) { - sonarQubeURL := m.(*ProviderConfiguration).sonarQubeURL sonarQubeURL.Path = strings.TrimSuffix(sonarQubeURL.Path, "/") + "/api/qualitygates/create_condition" @@ -482,7 +502,6 @@ func createCondition(qualityGateName string, metric string, op string, threshold } func updateCondition(id, metric, op, threshold string, m interface{}) error { - sonarQubeURL := m.(*ProviderConfiguration).sonarQubeURL sonarQubeURL.Path = strings.TrimSuffix(sonarQubeURL.Path, "/") + "/api/qualitygates/update_condition" diff --git a/sonarqube/resource_sonarqube_qualitygate_project_association.go b/sonarqube/resource_sonarqube_qualitygate_project_association.go index a16ee15b..5840c44c 100644 --- a/sonarqube/resource_sonarqube_qualitygate_project_association.go +++ b/sonarqube/resource_sonarqube_qualitygate_project_association.go @@ -22,9 +22,10 @@ type GetQualityGateAssociation struct { // Returns the resource represented by this file. func resourceSonarqubeQualityGateProjectAssociation() *schema.Resource { return &schema.Resource{ - Create: resourceSonarqubeQualityGateProjectAssociationCreate, - Read: resourceSonarqubeQualityGateProjectAssociationRead, - Delete: resourceSonarqubeQualityGateProjectAssociationDelete, + Description: "Provides a Sonarqube Quality Gate Project association resource. This can be used to associate a Quality Gate to a Project", + Create: resourceSonarqubeQualityGateProjectAssociationCreate, + Read: resourceSonarqubeQualityGateProjectAssociationRead, + Delete: resourceSonarqubeQualityGateProjectAssociationDelete, Importer: &schema.ResourceImporter{ State: resourceSonarqubeQualityGateProjectAssociationImport, }, @@ -37,14 +38,16 @@ func resourceSonarqubeQualityGateProjectAssociation() *schema.Resource { ForceNew: true, }, "gatename": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: "The name of the Quality Gate", }, "projectkey": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.", }, }, } diff --git a/sonarqube/resource_sonarqube_qualitygate_usergroup_association.go b/sonarqube/resource_sonarqube_qualitygate_usergroup_association.go index 70b48db6..a66a8750 100644 --- a/sonarqube/resource_sonarqube_qualitygate_usergroup_association.go +++ b/sonarqube/resource_sonarqube_qualitygate_usergroup_association.go @@ -29,6 +29,8 @@ type GetQualityGateUsergroupAssociationProjects struct { // Returns the resource represented by this file. func resourceSonarqubeQualityGateUsergroupAssociation() *schema.Resource { return &schema.Resource{ + Description: `Provides a Sonarqube Quality Gate Usergroup association resource. This can be used to associate a Quality Gate to an User or to a Group. +The feature is available on SonarQube 9.2 or newer.`, Create: resourceSonarqubeQualityGateUsergroupAssociationCreate, Read: resourceSonarqubeQualityGateUsergroupAssociationRead, Delete: resourceSonarqubeQualityGateUsergroupAssociationDelete, @@ -40,17 +42,20 @@ func resourceSonarqubeQualityGateUsergroupAssociation() *schema.Resource { Optional: true, ForceNew: true, ExactlyOneOf: []string{"login_name", "group_name"}, + Description: "The name of the User to associate. Either `group_name` or `login_name` should be provided.", }, "group_name": { Type: schema.TypeString, Optional: true, ForceNew: true, ExactlyOneOf: []string{"login_name", "group_name"}, + Description: "The name of the Group to associate. Either `group_name` or `login_name` should be provided.", }, "gatename": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "The name of the Quality Gate", }, }, } diff --git a/sonarqube/resource_sonarqube_qualityprofile.go b/sonarqube/resource_sonarqube_qualityprofile.go index 48a22259..13aa3dce 100644 --- a/sonarqube/resource_sonarqube_qualityprofile.go +++ b/sonarqube/resource_sonarqube_qualityprofile.go @@ -60,9 +60,10 @@ type GetQualityProfileActions struct { // Returns the resource represented by this file. func resourceSonarqubeQualityProfile() *schema.Resource { return &schema.Resource{ - Create: resourceSonarqubeQualityProfileCreate, - Read: resourceSonarqubeQualityProfileRead, - Delete: resourceSonarqubeQualityProfileDelete, + Description: "Provides a Sonarqube Quality Profile resource. This can be used to create and manage Sonarqube Quality Profiles.", + Create: resourceSonarqubeQualityProfileCreate, + Read: resourceSonarqubeQualityProfileRead, + Delete: resourceSonarqubeQualityProfileDelete, Importer: &schema.ResourceImporter{ State: resourceSonarqubeQualityProfileImport, }, @@ -73,33 +74,34 @@ func resourceSonarqubeQualityProfile() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, - Description: "Quality profile name", + Description: "The name of the Quality Profile to create. Maximum length 100", ValidateDiagFunc: validation.ToDiagFunc( validation.StringLenBetween(0, 100), ), }, "key": { Type: schema.TypeString, - Description: "Quality profile key", + Description: "ID of the Sonarqube Quality Profile", Computed: true, }, "language": { Type: schema.TypeString, Required: true, ForceNew: true, - Description: "Quality profile language", + Description: "Quality profile language. Must be one of \"cs\", \"css\", \"flex\", \"go\", \"java\", \"js\", \"jsp\", \"kotlin\", \"php\", \"py\", \"ruby\", \"scala\", \"ts\", \"vbnet\", \"web\", \"xml\"", }, "is_default": { Type: schema.TypeBool, Optional: true, - Description: "Is the default profile", + Description: "When set to true this will make the added Quality Profile default", Default: false, ForceNew: true, }, "parent": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: "When a parent is provided the quality profile will inherit it's rules", }, }, } @@ -195,7 +197,6 @@ func resourceSonarqubeQualityProfileDelete(d *schema.ResourceData, m interface{} }.Encode() err := setDefaultQualityProfile(d, m, false) - if err != nil { return err } @@ -213,7 +214,6 @@ func resourceSonarqubeQualityProfileDelete(d *schema.ResourceData, m interface{} defer resp.Body.Close() return nil - } func resourceSonarqubeQualityProfileImport(d *schema.ResourceData, m interface{}) ([]*schema.ResourceData, error) { diff --git a/sonarqube/resource_sonarqube_qualityprofile_activate_rule.go b/sonarqube/resource_sonarqube_qualityprofile_activate_rule.go index f8efc1f2..07e514b9 100644 --- a/sonarqube/resource_sonarqube_qualityprofile_activate_rule.go +++ b/sonarqube/resource_sonarqube_qualityprofile_activate_rule.go @@ -25,9 +25,10 @@ type GetActiveRules struct { func resourceSonarqubeQualityProfileRule() *schema.Resource { return &schema.Resource{ - Create: resourceSonarqubeQualityProfileRuleCreate, - Delete: resourceSonarqubeQualityProfileRuleDelete, - Read: resourceSonarqubeQualityProfileRuleRead, + Description: "Provides a Sonarqube Rules resource. This can be used to manage Sonarqube rules.", + Create: resourceSonarqubeQualityProfileRuleCreate, + Delete: resourceSonarqubeQualityProfileRuleDelete, + Read: resourceSonarqubeQualityProfileRuleRead, Importer: &schema.ResourceImporter{ State: resourceSonarqubeQualityProfileRuleImporter, }, @@ -49,11 +50,12 @@ func resourceSonarqubeQualityProfileRule() *schema.Resource { }, }, "reset": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "Reset severity and parameters of activated rule. Set the values defined on parent profile or from rule default values.", - Default: "false", + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: `Reset severity and parameters of activated rule. Set the values defined on parent profile or from rule default values. + - Possible values true false yes no (Default false)`, + Default: "false", ValidateDiagFunc: validation.ToDiagFunc( validation.StringInSlice( []string{"true", "false", "yes", "no"}, @@ -68,10 +70,11 @@ func resourceSonarqubeQualityProfileRule() *schema.Resource { Description: "Rule key", }, "severity": { - Type: schema.TypeString, - Optional: true, - Description: "Rule severity", - ForceNew: true, + Type: schema.TypeString, + Optional: true, + Description: `Severity. Ignored if parameter reset is true. + - Possible values - INFO, MINOR, MAJOR, CRITICAL, BLOCKER`, + ForceNew: true, ValidateDiagFunc: validation.ToDiagFunc( validation.StringInSlice( []string{"INFO", "MINOR", "MAJOR", "CRITICAL", "BLOCKER"}, @@ -148,7 +151,6 @@ func resourceSonarqubeQualityProfileRuleRead(d *schema.ResourceData, m interface http.StatusOK, "resourceSonarqubeQualityProfileRuleRead", ) - if err != nil { return err } diff --git a/sonarqube/resource_sonarqube_qualityprofile_project_association.go b/sonarqube/resource_sonarqube_qualityprofile_project_association.go index 9425687b..87559c35 100644 --- a/sonarqube/resource_sonarqube_qualityprofile_project_association.go +++ b/sonarqube/resource_sonarqube_qualityprofile_project_association.go @@ -28,9 +28,10 @@ type GetQualityProfileProjectAssociationResults struct { // Returns the resource represented by this file. func resourceSonarqubeQualityProfileProjectAssociation() *schema.Resource { return &schema.Resource{ - Create: resourceSonarqubeQualityProfileProjectAssociationCreate, - Read: resourceSonarqubeQualityProfileProjectAssociationRead, - Delete: resourceSonarqubeQualityProfileProjectAssociationDelete, + Description: "Provides a Sonarqube Quality Profile Project association resource. This can be used to associate a Quality Profile to a Project", + Create: resourceSonarqubeQualityProfileProjectAssociationCreate, + Read: resourceSonarqubeQualityProfileProjectAssociationRead, + Delete: resourceSonarqubeQualityProfileProjectAssociationDelete, Importer: &schema.ResourceImporter{ State: resourceSonarqubeQualityProfileProjectAssociationImport, }, @@ -41,7 +42,7 @@ func resourceSonarqubeQualityProfileProjectAssociation() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, - Description: "Quality profile name", + Description: "Name of the Quality Profile", ValidateDiagFunc: validation.ToDiagFunc( validation.StringLenBetween(0, 100), ), @@ -50,7 +51,7 @@ func resourceSonarqubeQualityProfileProjectAssociation() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, - Description: "Project key", + Description: "Name of the project", ValidateDiagFunc: validation.ToDiagFunc( validation.StringLenBetween(0, 100), ), @@ -59,7 +60,7 @@ func resourceSonarqubeQualityProfileProjectAssociation() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, - Description: "Quality profile language", + Description: "Quality profile language. Must be a langauge in this list https://next.sonarqube.com/sonarqube/web_api/api/languages/list", }, }, } @@ -173,7 +174,6 @@ func resourceSonarqubeQualityProfileProjectAssociationRead(d *schema.ResourceDat } return fmt.Errorf("resourceSonarqubeQualityProfileProjectAssociationRead: Failed to find project association: %+v", d.Id()) - } func resourceSonarqubeQualityProfileProjectAssociationDelete(d *schema.ResourceData, m interface{}) error { @@ -198,7 +198,6 @@ func resourceSonarqubeQualityProfileProjectAssociationDelete(d *schema.ResourceD defer resp.Body.Close() return nil - } func resourceSonarqubeQualityProfileProjectAssociationImport(d *schema.ResourceData, m interface{}) ([]*schema.ResourceData, error) { diff --git a/sonarqube/resource_sonarqube_rules.go b/sonarqube/resource_sonarqube_rules.go index 8c6db62c..f43d6499 100644 --- a/sonarqube/resource_sonarqube_rules.go +++ b/sonarqube/resource_sonarqube_rules.go @@ -54,10 +54,11 @@ type CreateRuleResponse struct { func resourceSonarqubeRule() *schema.Resource { return &schema.Resource{ - Create: resourceSonarqubeRuleCreate, - Read: resourceSonarqubeRuleRead, - Update: resourceSonarqubeRuleUpdate, - Delete: resourceSonarqubeRuleDelete, + Description: "Provides a Sonarqube Rules resource. This can be used to manage Sonarqube rules.", + Create: resourceSonarqubeRuleCreate, + Read: resourceSonarqubeRuleRead, + Update: resourceSonarqubeRuleUpdate, + Delete: resourceSonarqubeRuleDelete, Importer: &schema.ResourceImporter{ State: resourceSonarqubeRuleImporter, }, @@ -67,7 +68,7 @@ func resourceSonarqubeRule() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, - Description: "Key of the custom rule", + Description: "key of the custom rule should only contain : a-z, 0-9, \\_", ValidateDiagFunc: validation.ToDiagFunc( validation.StringLenBetween(0, 200), ), @@ -87,18 +88,20 @@ func resourceSonarqubeRule() *schema.Resource { ), }, "params": { - Type: schema.TypeString, - Optional: true, - Description: "Parameters as semi-colon list of =, for example 'params=key1=v1;key2=v2' (Only for custom rule)", + Type: schema.TypeString, + Optional: true, + Description: `Parameters as semi-colon list of =, for example 'params=key1=v1;key2=v2' (Only for custom rule) + - parameter order: expression=value;filePattern=value;message=value`, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "prevent_reactivation": { - Type: schema.TypeString, - Optional: true, - Description: "If set to true and if the rule has been deactivated (status 'REMOVED'), a status 409 will be returned", - Default: "false", + Type: schema.TypeString, + Optional: true, + Description: `If set to true and if the rule has been deactivated (status 'REMOVED'), a status 409 will be returned + - Possible values - true, false, yes, no`, + Default: "false", ValidateDiagFunc: validation.ToDiagFunc( validation.StringInSlice( []string{"true", "false", "yes", "no"}, @@ -107,9 +110,10 @@ func resourceSonarqubeRule() *schema.Resource { ), }, "severity": { - Type: schema.TypeString, - Optional: true, - Description: "Rule severity", + Type: schema.TypeString, + Optional: true, + Description: `Rule severity + - Possible values - INFO, MINOR, MAJOR, CRITICAL, BLOCKER`, ValidateDiagFunc: validation.ToDiagFunc( validation.StringInSlice( []string{"INFO", "MINOR", "MAJOR", "CRITICAL", "BLOCKER"}, @@ -118,10 +122,12 @@ func resourceSonarqubeRule() *schema.Resource { ), }, "status": { - Type: schema.TypeString, - Optional: true, - Description: "Rule status", - Default: "READY", + Type: schema.TypeString, + Optional: true, + Description: `Rule status + - Possible values - BETA, DEPRECATED, READY, REMOVED + - Default value - READY`, + Default: "READY", ValidateDiagFunc: validation.ToDiagFunc( validation.StringInSlice( []string{"BETA", "DEPRECATED", "READY", "REMOVED"}, @@ -130,14 +136,16 @@ func resourceSonarqubeRule() *schema.Resource { ), }, "template_key": { - Type: schema.TypeString, - Required: true, - Description: "Key of the template rule in order to create a custom rule (mandatory for custom rule)", + Type: schema.TypeString, + Required: true, + Description: `Key of the template rule in order to create a custom rule (mandatory for custom rule) + - [Example values](https://docs.sonarqube.org/latest/user-guide/rules/#header-4)`, }, "type": { - Type: schema.TypeString, - Optional: true, - Description: "Rule type", + Type: schema.TypeString, + Optional: true, + Description: `Rule type + - Possible values - CODE_SMELL, BUG, VULNERABILITY, SECURITY_HOTSPOT`, ValidateDiagFunc: validation.ToDiagFunc( validation.StringInSlice( []string{"CODE_SMELL", "BUG", "VULNERABILITY", "SECURITY_HOTSPOT"}, diff --git a/sonarqube/resource_sonarqube_setting.go b/sonarqube/resource_sonarqube_setting.go index c9125a9f..5c77a511 100644 --- a/sonarqube/resource_sonarqube_setting.go +++ b/sonarqube/resource_sonarqube_setting.go @@ -41,10 +41,11 @@ func (a Setting) ToMap() map[string]interface{} { func resourceSonarqubeSettings() *schema.Resource { return &schema.Resource{ - Create: resourceSonarqubeSettingsCreate, - Read: resourceSonarqubeSettingsRead, - Update: resourceSonarqubeSettingsUpdate, - Delete: resourceSonarqubeSettingsDelete, + Description: "Provides a Sonarqube Settings resource. This can be used to manage Sonarqube settings.", + Create: resourceSonarqubeSettingsCreate, + Read: resourceSonarqubeSettingsRead, + Update: resourceSonarqubeSettingsUpdate, + Delete: resourceSonarqubeSettingsDelete, Importer: &schema.ResourceImporter{ State: resourceSonarqubeSettingsImporter, }, @@ -193,6 +194,7 @@ func resourceSonarqubeSettingsUpdate(d *schema.ResourceData, m interface{}) erro return resourceSonarqubeSettingsRead(d, m) } + func getCreateOrUpdateQueryRawQuery(key []string, d *schema.ResourceData) string { // build the base query RawQuery := url.Values{ @@ -430,7 +432,6 @@ func removeComponentSettings(component string, newSettings []interface{}, apiPro http.StatusNoContent, "deleteSetting", ) - if err != nil { return fmt.Errorf("removeComponentSettings: Failed to delete setting %s: %+v", component, err) } diff --git a/sonarqube/resource_sonarqube_user.go b/sonarqube/resource_sonarqube_user.go index 004054e5..9419e1ab 100644 --- a/sonarqube/resource_sonarqube_user.go +++ b/sonarqube/resource_sonarqube_user.go @@ -35,10 +35,11 @@ type CreateUserResponse struct { // Returns the resource represented by this file. func resourceSonarqubeUser() *schema.Resource { return &schema.Resource{ - Create: resourceSonarqubeUserCreate, - Read: resourceSonarqubeUserRead, - Update: resourceSonarqubeUserUpdate, - Delete: resourceSonarqubeUserDelete, + Description: "Provides a Sonarqube User resource. This can be used to manage Sonarqube Users.", + Create: resourceSonarqubeUserCreate, + Read: resourceSonarqubeUserRead, + Update: resourceSonarqubeUserUpdate, + Delete: resourceSonarqubeUserDelete, Importer: &schema.ResourceImporter{ State: resourceSonarqubeUserImport, }, @@ -46,29 +47,34 @@ func resourceSonarqubeUser() *schema.Resource { // Define the fields of this schema. Schema: map[string]*schema.Schema{ "login_name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "The login name of the User to create. Changing this forces a new resource to be created.", }, "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "The name of the User to create. Changing this forces a new resource to be created.", }, "email": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: "The email of the User to create.", }, "password": { - Type: schema.TypeString, - Optional: true, - Sensitive: true, + Type: schema.TypeString, + Optional: true, + Sensitive: true, + Description: "The password of User to create. This is only used if the user is of type `local`.", }, "is_local": { - Type: schema.TypeBool, - Optional: true, - Default: true, - ForceNew: true, + Type: schema.TypeBool, + Optional: true, + Default: true, + ForceNew: true, + Description: "`True` if the User should be of type `local`. Defaults to `true`.", }, }, } diff --git a/sonarqube/resource_sonarqube_user_external_identity.go b/sonarqube/resource_sonarqube_user_external_identity.go index d57541e0..098d73bc 100644 --- a/sonarqube/resource_sonarqube_user_external_identity.go +++ b/sonarqube/resource_sonarqube_user_external_identity.go @@ -13,6 +13,10 @@ import ( // Returns the resource represented by this file. func resourceSonarqubeUserExternalIdentity() *schema.Resource { return &schema.Resource{ + Description: `Updates the _external identity_ of a _non local_ Sonarqube User. This can be used to set the _Identity Provider_ which should be used to +authenticate a specific user. + +The Sonarqube API currently does not provide an endpoint to read the _external identity_ setting of an user.`, Create: resourceSonarqubeUserExternalIdentityCreate, Read: resourceSonarqubeUserExternalIdentityRead, Delete: resourceSonarqubeUserExternalIdentityDelete, @@ -20,19 +24,22 @@ func resourceSonarqubeUserExternalIdentity() *schema.Resource { // Define the fields of this schema. Schema: map[string]*schema.Schema{ "login_name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "The login name of the User to update. Changing this forces a new resource to be created.", }, "external_identity": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "The identifier of the User used by the Authentication Provider. Changing this forces a new resource to be created.", }, "external_provider": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "The key of the Authentication Provider. The Authentication Provider must be activated on Sonarqube. Changing this forces a new resource to be created.", }, }, } @@ -77,12 +84,10 @@ func resourceSonarqubeUserExternalIdentityCreate(d *schema.ResourceData, m inter } func resourceSonarqubeUserExternalIdentityRead(d *schema.ResourceData, m interface{}) error { - return nil } func resourceSonarqubeUserExternalIdentityDelete(d *schema.ResourceData, m interface{}) error { - return nil } diff --git a/sonarqube/resource_sonarqube_user_token.go b/sonarqube/resource_sonarqube_user_token.go index 6bf1c84e..47188e8b 100644 --- a/sonarqube/resource_sonarqube_user_token.go +++ b/sonarqube/resource_sonarqube_user_token.go @@ -47,9 +47,10 @@ const ( // Returns the resource represented by this file. func resourceSonarqubeUserToken() *schema.Resource { return &schema.Resource{ - Create: resourceSonarqubeUserTokenCreate, - Read: resourceSonarqubeUserTokenRead, - Delete: resourceSonarqubeUserTokenDelete, + Description: "Provides a Sonarqube User token resource. This can be used to manage Sonarqube User tokens.", + Create: resourceSonarqubeUserTokenCreate, + Read: resourceSonarqubeUserTokenRead, + Delete: resourceSonarqubeUserTokenDelete, // Define the fields of this schema. Schema: map[string]*schema.Schema{ @@ -58,22 +59,26 @@ func resourceSonarqubeUserToken() *schema.Resource { Required: true, ForceNew: true, ValidateDiagFunc: validation.ToDiagFunc(validation.StringLenBetween(1, 100)), + Description: "The name of the Token to create. Changing this forces a new resource to be created.", }, "login_name": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: "The login name of the User for which the token should be created. If not set, the token is created for the authenticated user. Changing this forces a new resource to be created.", }, "expiration_date": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Computed: true, + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Computed: true, + Description: "The expiration date of the token being generated, in ISO 8601 format (YYYY-MM-DD). If not set, default to no expiration.", }, "token": { - Type: schema.TypeString, - Computed: true, - Sensitive: true, + Type: schema.TypeString, + Computed: true, + Sensitive: true, + Description: "The token value.", }, "type": { Type: schema.TypeString, @@ -81,11 +86,13 @@ func resourceSonarqubeUserToken() *schema.Resource { Default: UserToken, ForceNew: true, ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{string(UserToken), string(GlobalAnalysisToken), string(ProjectAnalysisToken)}, false)), + Description: "The kind of Token to create. Changing this forces a new resource to be created. Possible values are USER_TOKEN, GLOBAL_ANALYSIS_TOKEN, or PROJECT_ANALYSIS_TOKEN. Defaults to USER_TOKEN. If set to PROJECT_ANALYSIS_TOKEN, then the project_key must also be specified.", }, "project_key": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: "The key of the only project that can be analyzed by the PROJECT_ANALYSIS TOKEN being created. Changing this forces a new resource to be created.", }, }, } diff --git a/sonarqube/resource_sonarqube_webhook.go b/sonarqube/resource_sonarqube_webhook.go index b2ef27d0..006c7c65 100644 --- a/sonarqube/resource_sonarqube_webhook.go +++ b/sonarqube/resource_sonarqube_webhook.go @@ -29,10 +29,11 @@ type ListWebhooksResponse struct { // Returns the resource represented by this file. func resourceSonarqubeWebhook() *schema.Resource { return &schema.Resource{ - Create: resourceSonarqubeWebhookCreate, - Read: resourceSonarqubeWebhookRead, - Update: resourceSonarqubeWebhookUpdate, - Delete: resourceSonarqubeWebhookDelete, + Description: "Provides a Sonarqube Webhook resource. This can be used to manage Sonarqube webhooks.", + Create: resourceSonarqubeWebhookCreate, + Read: resourceSonarqubeWebhookRead, + Update: resourceSonarqubeWebhookUpdate, + Delete: resourceSonarqubeWebhookDelete, Importer: &schema.ResourceImporter{ State: resourceSonarqubeWebhookImport, }, @@ -40,18 +41,21 @@ func resourceSonarqubeWebhook() *schema.Resource { // Define the fields of this schema. Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The name of the webhook to create. This will be displayed in the Sonarqube administration console.", }, "url": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The URL to send event payloads to. This must begin with either `https://` or `http://`.", }, "secret": { - Type: schema.TypeString, - Sensitive: true, - Optional: true, - Computed: true, + Type: schema.TypeString, + Sensitive: true, + Optional: true, + Computed: true, + Description: "The secret to send with the event payload.", }, "project": { Type: schema.TypeString, diff --git a/templates/debugging.md b/templates/debugging.md new file mode 100644 index 00000000..d224d22f --- /dev/null +++ b/templates/debugging.md @@ -0,0 +1,52 @@ +# Debugging the Provider + +You can debug the provider using a tool similar to [delve](https://github.com/go-delve/delve) as described in the Hashicorp article [Debugger-Based Debugging](https://developer.hashicorp.com/terraform/plugin/debugging#debugger-based-debugging). + +## Starting a debug session + +### Visual Studio Code + +Using [Visual Studio Code](https://code.visualstudio.com/) with the [Go extension](https://marketplace.visualstudio.com/items?itemName=golang.go) installed, you would add a configuration similar to this to your `launch.json` file: + +```json +{ + "name": "Debug Terraform Provider", + "type": "go", + "request": "launch", + "mode": "debug", + "program": "${workspaceFolder}", + "env": { + + }, + "args": [ + "-debug" + ], + "showLog": true +} +``` + +Start the process using this configuration and then follow the instructions provided in the debug console: + +```shell +Provider started. To attach Terraform CLI, set the TF_REATTACH_PROVIDERS environment variable with the following: + + Command Prompt: set "TF_REATTACH_PROVIDERS={"registry.terraform.io/jdamata/sonarqube":{"Protocol":"grpc","ProtocolVersion":5,"Pid":2748,"Test":true,"Addr":{"Network":"tcp","String":"127.0.0.1:56560"}}}" + + PowerShell: $env:TF_REATTACH_PROVIDERS='{"registry.terraform.io/jdamata/sonarqube":{"Protocol":"grpc","ProtocolVersion":5,"Pid":2748,"Test":true,"Addr":{"Network":"tcp","String":"127.0.0.1:56560"}}}' +``` + +### Delve CLI + +With the delve CLI you would start a delve debugging session: + +```shell +dlv exec --accept-multiclient --continue --headless ./terraform-provider-example -- -debug +``` + +and copy the line starting `TF_REATTACH_PROVIDERS` from your provider's output, again setting it according to your command prompt/shell. + +## Attaching to the debug session + +In order to use the debug instance of the provider, set `TF_REATTACH_PROVIDERS` as described previously, set some breakpoints in the provider, and start your terraform script as normal. + +Happy debugging! diff --git a/templates/index.md.tmpl b/templates/index.md.tmpl new file mode 100644 index 00000000..5aa59a67 --- /dev/null +++ b/templates/index.md.tmpl @@ -0,0 +1,60 @@ +--- +page_title: "Provider: sonarqube" +subcategory: "" +description: |- + The sonarqube provider is used to configure sonarqube. The provider needs to be configured with a url, and either with user and password or token. +--- + +# Provider configuration + +The sonarqube provider is used to configure sonarqube. The provider needs to be configured with a url, and either with user and password or token. + +## Example: Authenticate with username and password + +```terraform +terraform { + required_providers { + sonarqube = { + source = "jdamata/sonarqube" + } + } +} + +provider "sonarqube" { + user = "admin" + pass = "admin" + host = "http://127.0.0.1:9000" +} +``` + +## Example: Authenticate with token + +```terraform +terraform { + required_providers { + sonarqube = { + source = "jdamata/sonarqube" + } + } +} + +provider "sonarqube" { + token = "d4at55a6f7r199bd707h39625685510880gbf7ff" + host = "http://127.0.0.1:9000" +} +``` + +## Argument Reference + +The following arguments are supported: + +- `user` - (Optional) Sonarqube user. This can also be set via the `SONARQUBE_USER` environment variable. +- `pass` - (Optional) Sonarqube pass. This can also be set via the `SONARQUBE_PASS` environment variable. +- `token` - (Optional) Sonarqube token. This can also be set via the `SONARQUBE_TOKEN` environment variable. +- `host` - (Required) Sonarqube url. This can be also be set via the `SONARQUBE_HOST` environment variable. +- `installed_version` - (Optional) The version of the Sonarqube server. When specified, the provider will avoid requesting this from the + server during the initialization process. This can be helpful when using the same Terraform code to install Sonarqube and configure it. +- `tls_insecure_skip_verify` - (Optional) Allows ignoring insecure certificates when set to true. Defaults to false. Disabling TLS verification + is dangerous and should only be done for local testing. +- `anonymize_user_on_delete` - (Optional) Allows anonymizing users on destroy. Requires Sonarqube version >= `9.7`. This can be helpful + to comply with regulations like [GDPR](https://en.wikipedia.org/wiki/General_Data_Protection_Regulation). diff --git a/templates/resources/new_code_periods.md.tmpl b/templates/resources/new_code_periods.md.tmpl new file mode 100644 index 00000000..e9021d56 --- /dev/null +++ b/templates/resources/new_code_periods.md.tmpl @@ -0,0 +1,20 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +## Example Usage + +### Example: Set the global new code period to a number of days +{{ tffile "examples/resources/sonarqube_new_code_periods/global.tf" }} + +### Example: create a project and set its new code period to a reference branch +{{ tffile "examples/resources/sonarqube_new_code_periods/project.tf" }} + +{{ .SchemaMarkdown | trimspace }} diff --git a/templates/resources/permissions.md.tmpl b/templates/resources/permissions.md.tmpl new file mode 100644 index 00000000..d1677fad --- /dev/null +++ b/templates/resources/permissions.md.tmpl @@ -0,0 +1,26 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +## Example Usage + +### Example: Set global admin permissions for a group called "my-admins" +{{ tffile "examples/resources/sonarqube_permissions/global-admin.tf" }} + +### Example: Set project admin permissions for a group called "my-project-admins" +{{ tffile "examples/resources/sonarqube_permissions/project-admin.tf" }} + +### Example: Set project admin permissions for a group called "my-project-admins on a permission template" +{{ tffile "examples/resources/sonarqube_permissions/project-template.tf" }} + +### Example: Set codeviewer & user permissions on project level for a user called "johndoe" +{{ tffile "examples/resources/sonarqube_permissions/project-user.tf" }} + +{{ .SchemaMarkdown | trimspace }} diff --git a/templates/resources/project.md.tmpl b/templates/resources/project.md.tmpl new file mode 100644 index 00000000..8378113d --- /dev/null +++ b/templates/resources/project.md.tmpl @@ -0,0 +1,20 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + + +## Example Usage +### Example: create a project +{{ tffile "examples/resources/sonarqube_project/project.tf" }} + +### Example: a project with associated settings +{{ tffile "examples/resources/sonarqube_project/project-settings.tf" }} + +{{ .SchemaMarkdown | trimspace }} diff --git a/templates/resources/qualitygate.md.tmpl b/templates/resources/qualitygate.md.tmpl new file mode 100644 index 00000000..bc438349 --- /dev/null +++ b/templates/resources/qualitygate.md.tmpl @@ -0,0 +1,31 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + + +## Example Usage + +{{ tffile "examples/resources/sonarqube_qualitygate/resource.tf" }} + +**Disclaimer: Operator Requirement for Grade Rating Conditions** + +When working with grade rating conditions, (A-D), it is important to note that the "GT" (greater than) operator must be used for the `op` field. This is due to SonarQube's API design. More information can be found in this [issue](https://github.com/jdamata/terraform-provider-sonarqube/issues/171). + +For example, if you are using a grade rating metric such as `new_reliability_rating`, where A represents the highest rating and subsequent letters represent lower ratings, you need to supply the `op` field with "GT" via the provider. Using "LT" will return an error from SonarQube's API: + +```terraform + condition { + metric = "new_reliability_rating" + op = "GT" + threshold = "1" + } +``` + +{{ .SchemaMarkdown | trimspace }} diff --git a/templates/resources/qualitygate_usergroup_association.md.tmpl b/templates/resources/qualitygate_usergroup_association.md.tmpl new file mode 100644 index 00000000..7a514734 --- /dev/null +++ b/templates/resources/qualitygate_usergroup_association.md.tmpl @@ -0,0 +1,19 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +## Example Usage +### Example: create a quality gate user association +{{ tffile "examples/resources/sonarqube_qualitygate_usergroup_association/user-association.tf" }} + +### Example: create a quality gate group association +{{ tffile "examples/resources/sonarqube_qualitygate_usergroup_association/usergroup-association.tf" }} + +{{ .SchemaMarkdown | trimspace }} diff --git a/templates/resources/setting.md.tmpl b/templates/resources/setting.md.tmpl new file mode 100644 index 00000000..02a18d37 --- /dev/null +++ b/templates/resources/setting.md.tmpl @@ -0,0 +1,19 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +## Example Usage +### Example: create a setting with multiple values +{{ tffile "examples/resources/sonarqube_setting/multi-value.tf" }} + +### Example: create a setting with multiple field values +{{ tffile "examples/resources/sonarqube_setting/multi-field-values.tf" }} + +{{ .SchemaMarkdown | trimspace }} diff --git a/templates/resources/user.md.tmpl b/templates/resources/user.md.tmpl new file mode 100644 index 00000000..f4495269 --- /dev/null +++ b/templates/resources/user.md.tmpl @@ -0,0 +1,19 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +## Example Usage +### Example: create a local user +{{ tffile "examples/resources/sonarqube_user/local.tf" }} + +### Example: create a remote user +{{ tffile "examples/resources/sonarqube_user/remote.tf" }} + +{{ .SchemaMarkdown | trimspace }} diff --git a/templates/resources/user_token.md.tmpl b/templates/resources/user_token.md.tmpl new file mode 100644 index 00000000..7fe89da5 --- /dev/null +++ b/templates/resources/user_token.md.tmpl @@ -0,0 +1,22 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +## Example Usage +### Example: create a user, user token and output the token value +{{ tffile "examples/resources/sonarqube_user_token/user-token.tf" }} + +### Example: create an expiring global analysis token and output the token value +{{ tffile "examples/resources/sonarqube_user_token/global-analysis-token.tf" }} + +### Example: create a project, project analysis token, and output the token value +{{ tffile "examples/resources/sonarqube_user_token/project-analysis-token.tf" }} + +{{ .SchemaMarkdown | trimspace }} diff --git a/templates/resources/webhook.md.tmpl b/templates/resources/webhook.md.tmpl new file mode 100644 index 00000000..f34aa968 --- /dev/null +++ b/templates/resources/webhook.md.tmpl @@ -0,0 +1,19 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +## Example Usage +### Example: create a webhook +{{ tffile "examples/resources/sonarqube_webhook/webhook.tf" }} + +### Example: create a webhook owned by a project +{{ tffile "examples/resources/sonarqube_webhook/project-webhook.tf" }} + +{{ .SchemaMarkdown | trimspace }} From 9eba9128f3fe4c1c863ffad406cb111f9b8d9bca Mon Sep 17 00:00:00 2001 From: Lorne Date: Thu, 17 Oct 2024 14:56:54 +0100 Subject: [PATCH 03/24] workflow --- .github/workflows/tfplugindocs-check.yml | 49 ++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/tfplugindocs-check.yml diff --git a/.github/workflows/tfplugindocs-check.yml b/.github/workflows/tfplugindocs-check.yml new file mode 100644 index 00000000..b4995f27 --- /dev/null +++ b/.github/workflows/tfplugindocs-check.yml @@ -0,0 +1,49 @@ +name: Check if tfplugindocs result matches /docs + +on: + push: + branches: + - main + - "release/**" + pull_request: + paths: + - .github/workflows/tfplugindocs-check.yml + - go.sum + - Makefile + - sonarqube/** + - main.go + - examples/** + - docs/** + - templates/** + +jobs: + tfplugindocs_check: + name: tfplugindocs check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 + with: + go-version-file: tools/go.mod + - name: GOCACHE + run: | + echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV + - uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1 + continue-on-error: true + timeout-minutes: 2 + with: + # TODO: Replace with supported mechanism when it is supported + # https://github.com/actions/setup-go/issues/54 + path: ${{ env.GOCACHE }} + key: ${{ runner.os }}-GOCACHE-${{ hashFiles('go.sum') }}-${{ hashFiles('internal/**') }} + - uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1 + continue-on-error: true + timeout-minutes: 2 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }} + - run: | + make tools + make docs + git add -N docs/ + git diff --exit-code From 799530815dffbc162fc7648429cc1901fd42889b Mon Sep 17 00:00:00 2001 From: Lorne Date: Thu, 17 Oct 2024 16:04:17 +0100 Subject: [PATCH 04/24] test workflow --- docs/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index 93dff5ff..83303e2a 100644 --- a/docs/index.md +++ b/docs/index.md @@ -4,7 +4,7 @@ description: |- The sonarqube provider is used to configure sonarqube. The provider needs to be configured with a url, and either with user and password or token. --- -# Provider configuration +# Provider Configuration The sonarqube provider is used to configure sonarqube. The provider needs to be configured with a url, and either with user and password or token. From 89949b55001d16ed83a0134f2399733eec1a6743 Mon Sep 17 00:00:00 2001 From: Lorne Date: Thu, 17 Oct 2024 16:05:57 +0100 Subject: [PATCH 05/24] fix default branch name in workflow --- .github/workflows/tfplugindocs-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tfplugindocs-check.yml b/.github/workflows/tfplugindocs-check.yml index b4995f27..499796d5 100644 --- a/.github/workflows/tfplugindocs-check.yml +++ b/.github/workflows/tfplugindocs-check.yml @@ -3,7 +3,7 @@ name: Check if tfplugindocs result matches /docs on: push: branches: - - main + - master - "release/**" pull_request: paths: From 0cb7e22eda95cc793be376e23260f8cfbe9b58cf Mon Sep 17 00:00:00 2001 From: Lorne Date: Thu, 17 Oct 2024 16:09:05 +0100 Subject: [PATCH 06/24] workflow change go mod location --- .github/workflows/tfplugindocs-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tfplugindocs-check.yml b/.github/workflows/tfplugindocs-check.yml index 499796d5..db7ed414 100644 --- a/.github/workflows/tfplugindocs-check.yml +++ b/.github/workflows/tfplugindocs-check.yml @@ -24,7 +24,7 @@ jobs: - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: - go-version-file: tools/go.mod + go-version-file: ./go.mod - name: GOCACHE run: | echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV From 943d4fa98cc2ccaf1243c2095036ad2bad6fd19e Mon Sep 17 00:00:00 2001 From: Lorne Date: Thu, 17 Oct 2024 16:15:36 +0100 Subject: [PATCH 07/24] makefile --- Makefile | 9 +++++++++ docs/index.md | 4 ++-- templates/index.md.tmpl | 1 - 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index d05ce52e..8b41da68 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,15 @@ SONARQUBE_START_SLEEP?=60 all: fmt vet build +tools: + $(GO_VER) install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs + +docs: + rm -f docs/data-sources/*.md + rm -f docs/resources/*.md + rm -f docs/*.md + @tfplugindocs generate + build: go build -a -tags netgo -o terraform-provider-sonarqube diff --git a/docs/index.md b/docs/index.md index 83303e2a..2aad5d6d 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,10 +1,10 @@ --- page_title: "Provider: sonarqube" description: |- - The sonarqube provider is used to configure sonarqube. The provider needs to be configured with a url, and either with user and password or token. + The sonarqube provider is used to configure sonarqube. The provider needs to be configured with a url, and either with user and password or token. --- -# Provider Configuration +# Provider configuration The sonarqube provider is used to configure sonarqube. The provider needs to be configured with a url, and either with user and password or token. diff --git a/templates/index.md.tmpl b/templates/index.md.tmpl index 5aa59a67..2aad5d6d 100644 --- a/templates/index.md.tmpl +++ b/templates/index.md.tmpl @@ -1,6 +1,5 @@ --- page_title: "Provider: sonarqube" -subcategory: "" description: |- The sonarqube provider is used to configure sonarqube. The provider needs to be configured with a url, and either with user and password or token. --- From 228f798ee71fe8481196b07d4eec5f034d6e8062 Mon Sep 17 00:00:00 2001 From: Lorne Date: Thu, 17 Oct 2024 16:16:39 +0100 Subject: [PATCH 08/24] makefile goversion --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8b41da68..b51fbdd8 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ SONARQUBE_START_SLEEP?=60 all: fmt vet build tools: - $(GO_VER) install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs + $(GOVERSION) install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs docs: rm -f docs/data-sources/*.md From f5ff4c4254dfbcc1c6cae8046835e6bef7fee5d9 Mon Sep 17 00:00:00 2001 From: Lorne Date: Thu, 17 Oct 2024 16:18:59 +0100 Subject: [PATCH 09/24] set GO_VER in makefile --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b51fbdd8..8551df2a 100644 --- a/Makefile +++ b/Makefile @@ -3,13 +3,14 @@ export TF_LOG=DEBUG SRC=$(shell find . -name '*.go') SONARQUBE_IMAGE?=sonarqube:latest SONARQUBE_START_SLEEP?=60 +GO_VER ?= go .PHONY: all vet build test all: fmt vet build tools: - $(GOVERSION) install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs + $(GO_VER) install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs docs: rm -f docs/data-sources/*.md From 9b1903bad1495308b97a001c54510d1600b7016b Mon Sep 17 00:00:00 2001 From: Lorne Date: Thu, 17 Oct 2024 16:27:55 +0100 Subject: [PATCH 10/24] fix makefile --- Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8551df2a..bee6e7b8 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,12 @@ GO_VER ?= go all: fmt vet build tools: - $(GO_VER) install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs + @if ! [ -x "$$(command -v tfplugindocs)" ]; then \ + echo "Installing tfplugindocs..."; \ + $(GO_VER) get github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs && $(GO_VER) install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs; \ + else \ + echo "tfplugindocs is already installed."; \ + fi docs: rm -f docs/data-sources/*.md From 73a126e343b8ec6ba3eb5273858f5b62d0b75cf2 Mon Sep 17 00:00:00 2001 From: Lorne Date: Thu, 17 Oct 2024 17:26:21 +0100 Subject: [PATCH 11/24] build tools --- Makefile | 7 +-- tools/go.mod | 51 +++++++++++++++++++ tools/go.sum | 140 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 192 insertions(+), 6 deletions(-) create mode 100644 tools/go.mod create mode 100644 tools/go.sum diff --git a/Makefile b/Makefile index bee6e7b8..d9a58001 100644 --- a/Makefile +++ b/Makefile @@ -10,12 +10,7 @@ GO_VER ?= go all: fmt vet build tools: - @if ! [ -x "$$(command -v tfplugindocs)" ]; then \ - echo "Installing tfplugindocs..."; \ - $(GO_VER) get github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs && $(GO_VER) install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs; \ - else \ - echo "tfplugindocs is already installed."; \ - fi + cd tools && $(GO_VER) install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs docs: rm -f docs/data-sources/*.md diff --git a/tools/go.mod b/tools/go.mod new file mode 100644 index 00000000..d26261ff --- /dev/null +++ b/tools/go.mod @@ -0,0 +1,51 @@ +module github.com/jdamata/terraform-provider-sonarqube/tools + +go 1.22.3 + +require ( + github.com/BurntSushi/toml v1.2.1 // indirect + github.com/Kunde21/markdownfmt/v3 v3.1.0 // indirect + github.com/Masterminds/goutils v1.1.1 // indirect + github.com/Masterminds/semver/v3 v3.2.0 // indirect + github.com/Masterminds/sprig/v3 v3.2.3 // indirect + github.com/ProtonMail/go-crypto v1.1.0-alpha.2 // indirect + github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect + github.com/armon/go-radix v1.0.0 // indirect + github.com/bgentry/speakeasy v0.1.0 // indirect + github.com/bmatcuk/doublestar/v4 v4.6.1 // indirect + github.com/cloudflare/circl v1.3.7 // indirect + github.com/fatih/color v1.16.0 // indirect + github.com/google/uuid v1.3.0 // indirect + github.com/hashicorp/cli v1.1.6 // indirect + github.com/hashicorp/errwrap v1.1.0 // indirect + github.com/hashicorp/go-checkpoint v0.5.0 // indirect + github.com/hashicorp/go-cleanhttp v0.5.2 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/hashicorp/go-uuid v1.0.3 // indirect + github.com/hashicorp/go-version v1.7.0 // indirect + github.com/hashicorp/hc-install v0.7.0 // indirect + github.com/hashicorp/terraform-exec v0.21.0 // indirect + github.com/hashicorp/terraform-json v0.22.1 // indirect + github.com/hashicorp/terraform-plugin-docs v0.19.4 // indirect + github.com/huandu/xstrings v1.3.3 // indirect + github.com/imdario/mergo v0.3.15 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mattn/go-runewidth v0.0.9 // indirect + github.com/mitchellh/copystructure v1.2.0 // indirect + github.com/mitchellh/reflectwalk v1.0.2 // indirect + github.com/posener/complete v1.2.3 // indirect + github.com/shopspring/decimal v1.3.1 // indirect + github.com/spf13/cast v1.5.0 // indirect + github.com/yuin/goldmark v1.7.1 // indirect + github.com/yuin/goldmark-meta v1.1.0 // indirect + github.com/zclconf/go-cty v1.14.4 // indirect + go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect + golang.org/x/crypto v0.21.0 // indirect + golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect + golang.org/x/mod v0.17.0 // indirect + golang.org/x/sys v0.18.0 // indirect + golang.org/x/text v0.15.0 // indirect + gopkg.in/yaml.v2 v2.3.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/tools/go.sum b/tools/go.sum new file mode 100644 index 00000000..49429cac --- /dev/null +++ b/tools/go.sum @@ -0,0 +1,140 @@ +github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak= +github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/Kunde21/markdownfmt/v3 v3.1.0 h1:KiZu9LKs+wFFBQKhrZJrFZwtLnCCWJahL+S+E/3VnM0= +github.com/Kunde21/markdownfmt/v3 v3.1.0/go.mod h1:tPXN1RTyOzJwhfHoon9wUr4HGYmWgVxSQN6VBJDkrVc= +github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= +github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= +github.com/Masterminds/semver/v3 v3.2.0 h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7YgDP83g= +github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= +github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA= +github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM= +github.com/ProtonMail/go-crypto v1.1.0-alpha.2 h1:bkyFVUP+ROOARdgCiJzNQo2V2kiB97LyUpzH9P6Hrlg= +github.com/ProtonMail/go-crypto v1.1.0-alpha.2/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= +github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= +github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= +github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= +github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bmatcuk/doublestar/v4 v4.6.1 h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwNy7PA4I= +github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= +github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= +github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= +github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/hashicorp/cli v1.1.6 h1:CMOV+/LJfL1tXCOKrgAX0uRKnzjj/mpmqNXloRSy2K8= +github.com/hashicorp/cli v1.1.6/go.mod h1:MPon5QYlgjjo0BSoAiN0ESeT5fRzDjVRp+uioJ0piz4= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= +github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU= +github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg= +github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= +github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= +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= +github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= +github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/hc-install v0.7.0 h1:Uu9edVqjKQxxuD28mR5TikkKDd/p55S8vzPC1659aBk= +github.com/hashicorp/hc-install v0.7.0/go.mod h1:ELmmzZlGnEcqoUMKUuykHaPCIR1sYLYX+KSggWSKZuA= +github.com/hashicorp/terraform-exec v0.21.0 h1:uNkLAe95ey5Uux6KJdua6+cv8asgILFVWkd/RG0D2XQ= +github.com/hashicorp/terraform-exec v0.21.0/go.mod h1:1PPeMYou+KDUSSeRE9szMZ/oHf4fYUmB923Wzbq1ICg= +github.com/hashicorp/terraform-json v0.22.1 h1:xft84GZR0QzjPVWs4lRUwvTcPnegqlyS7orfb5Ltvec= +github.com/hashicorp/terraform-json v0.22.1/go.mod h1:JbWSQCLFSXFFhg42T7l9iJwdGXBYV8fmmD6o/ML4p3A= +github.com/hashicorp/terraform-plugin-docs v0.19.4 h1:G3Bgo7J22OMtegIgn8Cd/CaSeyEljqjH3G39w28JK4c= +github.com/hashicorp/terraform-plugin-docs v0.19.4/go.mod h1:4pLASsatTmRynVzsjEhbXZ6s7xBlUw/2Kt0zfrq8HxA= +github.com/huandu/xstrings v1.3.3 h1:/Gcsuc1x8JVbJ9/rlye4xZnVAbEkGauT8lbebqcQws4= +github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= +github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= +github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM= +github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= +github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= +github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= +github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= +github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= +github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo= +github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= +github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= +github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= +github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/yuin/goldmark v1.7.1 h1:3bajkSilaCbjdKVsKdZjZCLBNPL9pYzrCakKaf4U49U= +github.com/yuin/goldmark v1.7.1/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= +github.com/yuin/goldmark-meta v1.1.0 h1:pWw+JLHGZe8Rk0EGsMVssiNb/AaPMHfSRszZeUeiOUc= +github.com/yuin/goldmark-meta v1.1.0/go.mod h1:U4spWENafuA7Zyg+Lj5RqK/MF+ovMYtBvXi1lBb2VP0= +github.com/zclconf/go-cty v1.14.4 h1:uXXczd9QDGsgu0i/QFR/hzI5NYCHLf6NQw/atrbnhq8= +github.com/zclconf/go-cty v1.14.4/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= +go.abhg.dev/goldmark/frontmatter v0.2.0 h1:P8kPG0YkL12+aYk2yU3xHv4tcXzeVnN+gU0tJ5JnxRw= +go.abhg.dev/goldmark/frontmatter v0.2.0/go.mod h1:XqrEkZuM57djk7zrlRUB02x8I5J0px76YjkOzhB4YlU= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= +golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME= +golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From 697a3c12f97af6fed26fa83231af1e2358433bb3 Mon Sep 17 00:00:00 2001 From: Lorne Date: Thu, 17 Oct 2024 17:35:00 +0100 Subject: [PATCH 12/24] update readme --- README.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d774ea6d..3cc403af 100644 --- a/README.md +++ b/README.md @@ -11,15 +11,16 @@ Terraform provider for managing Sonarqube configuration This is a community provider and is not supported by Hashicorp. ## Installation + This provider has been published to the Terraform Registry at https://registry.terraform.io/providers/jdamata/sonarqube. Please visit the registry for documentation and installation instructions. ## Developing the Provider Working on this provider requires the following: -* [Terraform](https://www.terraform.io/downloads.html) -* [Go](http://www.golang.org) -* [Docker Engine](https://docs.docker.com/engine/install/) +- [Terraform](https://www.terraform.io/downloads.html) +- [Go](http://www.golang.org) +- [Docker Engine](https://docs.docker.com/engine/install/) You will also need to correctly setup a [GOPATH](http://golang.org/doc/code.html#GOPATH), as well as adding `${GOPATH}/bin` to your `$PATH`. @@ -31,6 +32,14 @@ In order to run the full suite of Acceptance tests, run `make -i testacc`. These $ make -i testacc ``` +## Generate documentation + +Documentation is generated using `tfplugindocs`. To generate documentation, run the following command before committing changes: + +```sh +$ make docs +``` + ## Debugging the Provider See [debugging.md](docs/debugging.md) From 2769fcacc47bb2a4d1149990921bfa916370b042 Mon Sep 17 00:00:00 2001 From: Lorne Date: Fri, 18 Oct 2024 09:33:15 +0100 Subject: [PATCH 13/24] tidy up tfplugindocks-check workflow --- .github/workflows/tfplugindocs-check.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tfplugindocs-check.yml b/.github/workflows/tfplugindocs-check.yml index db7ed414..4f538bd8 100644 --- a/.github/workflows/tfplugindocs-check.yml +++ b/.github/workflows/tfplugindocs-check.yml @@ -1,10 +1,9 @@ -name: Check if tfplugindocs result matches /docs +name: tfplugindocs check on: push: branches: - master - - "release/**" pull_request: paths: - .github/workflows/tfplugindocs-check.yml @@ -24,7 +23,7 @@ jobs: - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: - go-version-file: ./go.mod + go-version-file: tools/go.mod - name: GOCACHE run: | echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV @@ -32,8 +31,6 @@ jobs: continue-on-error: true timeout-minutes: 2 with: - # TODO: Replace with supported mechanism when it is supported - # https://github.com/actions/setup-go/issues/54 path: ${{ env.GOCACHE }} key: ${{ runner.os }}-GOCACHE-${{ hashFiles('go.sum') }}-${{ hashFiles('internal/**') }} - uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1 From 43f8856457f1dd856811c0ada2c6dccf2b2bd942 Mon Sep 17 00:00:00 2001 From: Lorne Date: Fri, 18 Oct 2024 09:35:53 +0100 Subject: [PATCH 14/24] add tfplugindocs-generate workflow --- .github/workflows/tfplugindocs-generate.yml | 48 +++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/tfplugindocs-generate.yml diff --git a/.github/workflows/tfplugindocs-generate.yml b/.github/workflows/tfplugindocs-generate.yml new file mode 100644 index 00000000..aa8b99b1 --- /dev/null +++ b/.github/workflows/tfplugindocs-generate.yml @@ -0,0 +1,48 @@ +name: tfplugindocs generate + +on: + pull_request: + paths: + - .github/workflows/tfplugindocs-check.yml + - Makefile + - docs/** + - examples/** + - templates/** + - sonarqube/** + +jobs: + tfplugindocs_generate: + name: tfplugindocs generate + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.1 + with: + persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token + fetch-depth: 0 # otherwise, you will failed to push refs to dest repo + - uses: actions/setup-go@v5.0.2 + with: + go-version-file: tools/go.mod + - name: GOCACHE + run: | + echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV + - uses: actions/cache@v4.0.2 + continue-on-error: true + timeout-minutes: 2 + with: + path: ${{ env.GOCACHE }} + key: ${{ runner.os }}-GOCACHE-${{ hashFiles('go.sum') }}-${{ hashFiles('internal/**') }} + - uses: actions/cache@v4.0.2 + continue-on-error: true + timeout-minutes: 2 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }} + - run: | + make tools + make docs + - uses: actions-js/push@v1.5 + name: Github commit and push + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.head_ref }} + message: "[bot][skip ci] docs: tfplugindocs generate" From c913ec6c37ed69b116f39d2e09dc1e4ec0915f86 Mon Sep 17 00:00:00 2001 From: Lorne Date: Mon, 21 Oct 2024 15:03:23 +0100 Subject: [PATCH 15/24] testing workflow for doc generation on PR --- Makefile | 5 +-- README.md | 7 +++-- docs/debugging.md => debugging.md | 0 templates/debugging.md | 52 ------------------------------- 4 files changed, 6 insertions(+), 58 deletions(-) rename docs/debugging.md => debugging.md (100%) delete mode 100644 templates/debugging.md diff --git a/Makefile b/Makefile index d9a58001..5682135b 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ SONARQUBE_IMAGE?=sonarqube:latest SONARQUBE_START_SLEEP?=60 GO_VER ?= go -.PHONY: all vet build test +.PHONY: all vet build test tools docs all: fmt vet build @@ -13,9 +13,6 @@ tools: cd tools && $(GO_VER) install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs docs: - rm -f docs/data-sources/*.md - rm -f docs/resources/*.md - rm -f docs/*.md @tfplugindocs generate build: diff --git a/README.md b/README.md index 3cc403af..22143c3f 100644 --- a/README.md +++ b/README.md @@ -34,12 +34,15 @@ $ make -i testacc ## Generate documentation -Documentation is generated using `tfplugindocs`. To generate documentation, run the following command before committing changes: +Documentation is generated using `tfplugindocs`. These are auto-generated when creating a PR to the project. + +If you wish to generate documentation locally to verify it's accuracy, run the following commands: ```sh +$ make tools $ make docs ``` ## Debugging the Provider -See [debugging.md](docs/debugging.md) +See [debugging.md](debugging.md) diff --git a/docs/debugging.md b/debugging.md similarity index 100% rename from docs/debugging.md rename to debugging.md diff --git a/templates/debugging.md b/templates/debugging.md deleted file mode 100644 index d224d22f..00000000 --- a/templates/debugging.md +++ /dev/null @@ -1,52 +0,0 @@ -# Debugging the Provider - -You can debug the provider using a tool similar to [delve](https://github.com/go-delve/delve) as described in the Hashicorp article [Debugger-Based Debugging](https://developer.hashicorp.com/terraform/plugin/debugging#debugger-based-debugging). - -## Starting a debug session - -### Visual Studio Code - -Using [Visual Studio Code](https://code.visualstudio.com/) with the [Go extension](https://marketplace.visualstudio.com/items?itemName=golang.go) installed, you would add a configuration similar to this to your `launch.json` file: - -```json -{ - "name": "Debug Terraform Provider", - "type": "go", - "request": "launch", - "mode": "debug", - "program": "${workspaceFolder}", - "env": { - - }, - "args": [ - "-debug" - ], - "showLog": true -} -``` - -Start the process using this configuration and then follow the instructions provided in the debug console: - -```shell -Provider started. To attach Terraform CLI, set the TF_REATTACH_PROVIDERS environment variable with the following: - - Command Prompt: set "TF_REATTACH_PROVIDERS={"registry.terraform.io/jdamata/sonarqube":{"Protocol":"grpc","ProtocolVersion":5,"Pid":2748,"Test":true,"Addr":{"Network":"tcp","String":"127.0.0.1:56560"}}}" - - PowerShell: $env:TF_REATTACH_PROVIDERS='{"registry.terraform.io/jdamata/sonarqube":{"Protocol":"grpc","ProtocolVersion":5,"Pid":2748,"Test":true,"Addr":{"Network":"tcp","String":"127.0.0.1:56560"}}}' -``` - -### Delve CLI - -With the delve CLI you would start a delve debugging session: - -```shell -dlv exec --accept-multiclient --continue --headless ./terraform-provider-example -- -debug -``` - -and copy the line starting `TF_REATTACH_PROVIDERS` from your provider's output, again setting it according to your command prompt/shell. - -## Attaching to the debug session - -In order to use the debug instance of the provider, set `TF_REATTACH_PROVIDERS` as described previously, set some breakpoints in the provider, and start your terraform script as normal. - -Happy debugging! From 73d80a3770e669dd1c166420ea9d8dab9a94cb80 Mon Sep 17 00:00:00 2001 From: Lorne Date: Mon, 21 Oct 2024 15:52:41 +0100 Subject: [PATCH 16/24] testing a change without doc updates locally --- sonarqube/resource_sonarqube_plugins.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonarqube/resource_sonarqube_plugins.go b/sonarqube/resource_sonarqube_plugins.go index 48a0547c..7696cb0f 100644 --- a/sonarqube/resource_sonarqube_plugins.go +++ b/sonarqube/resource_sonarqube_plugins.go @@ -52,7 +52,7 @@ func resourceSonarqubePlugin() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, - Description: "The key identifying the plugin to uninstall", + Description: "The key identifying the plugin to uninstall.", }, }, } From 935e9a261ba444aa8444d9dff31666a181221a62 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 21 Oct 2024 14:54:50 +0000 Subject: [PATCH 17/24] [bot][skip ci] docs: tfplugindocs generate --- docs/resources/plugin.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/resources/plugin.md b/docs/resources/plugin.md index af3a8f5d..d180a703 100644 --- a/docs/resources/plugin.md +++ b/docs/resources/plugin.md @@ -23,7 +23,7 @@ resource "sonarqube_plugin" "main" { ### Required -- `key` (String) The key identifying the plugin to uninstall +- `key` (String) The key identifying the plugin to uninstall. ### Read-Only From 310e29987524c5e30c9e1f8c5e8ddec5a8cdfdbe Mon Sep 17 00:00:00 2001 From: Lorne Date: Mon, 21 Oct 2024 16:14:53 +0100 Subject: [PATCH 18/24] fixing workflow ordering --- .github/workflows/tfplugindocs-check.yml | 12 +----------- .github/workflows/tfplugindocs-generate.yml | 2 +- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/workflows/tfplugindocs-check.yml b/.github/workflows/tfplugindocs-check.yml index 4f538bd8..1f9f9531 100644 --- a/.github/workflows/tfplugindocs-check.yml +++ b/.github/workflows/tfplugindocs-check.yml @@ -4,17 +4,7 @@ on: push: branches: - master - pull_request: - paths: - - .github/workflows/tfplugindocs-check.yml - - go.sum - - Makefile - - sonarqube/** - - main.go - - examples/** - - docs/** - - templates/** - + jobs: tfplugindocs_check: name: tfplugindocs check diff --git a/.github/workflows/tfplugindocs-generate.yml b/.github/workflows/tfplugindocs-generate.yml index aa8b99b1..b2a35a33 100644 --- a/.github/workflows/tfplugindocs-generate.yml +++ b/.github/workflows/tfplugindocs-generate.yml @@ -18,7 +18,7 @@ jobs: - uses: actions/checkout@v4.1.1 with: persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token - fetch-depth: 0 # otherwise, you will failed to push refs to dest repo + fetch-depth: 0 # otherwise, you will fail to push refs to dest repo - uses: actions/setup-go@v5.0.2 with: go-version-file: tools/go.mod From 4aac04635fd01b592bdd69655c03d4e9dd2fd9db Mon Sep 17 00:00:00 2001 From: Lorne Date: Mon, 21 Oct 2024 16:21:32 +0100 Subject: [PATCH 19/24] period to test codegen PR --- sonarqube/resource_sonarqube_permissions.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonarqube/resource_sonarqube_permissions.go b/sonarqube/resource_sonarqube_permissions.go index 457dec78..a630193f 100644 --- a/sonarqube/resource_sonarqube_permissions.go +++ b/sonarqube/resource_sonarqube_permissions.go @@ -40,7 +40,7 @@ func resourceSonarqubePermissions() *schema.Resource { Optional: true, ForceNew: true, ExactlyOneOf: []string{"login_name", "group_name"}, - Description: "The name of the user that should get the specified permissions. Changing this forces a new resource to be created. Cannot be used with `group_name`", + Description: "The name of the user that should get the specified permissions. Changing this forces a new resource to be created. Cannot be used with `group_name`.", }, "group_name": { Type: schema.TypeString, From a962e8c0db2ec0f7526ee1a193277b45fb20ad1e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 21 Oct 2024 15:22:45 +0000 Subject: [PATCH 20/24] [bot][skip ci] docs: tfplugindocs generate --- docs/resources/permissions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/resources/permissions.md b/docs/resources/permissions.md index 22493f17..1f81bb84 100644 --- a/docs/resources/permissions.md +++ b/docs/resources/permissions.md @@ -56,7 +56,7 @@ resource "sonarqube_permissions" "john_project_read" { ### Optional - `group_name` (String) The name of the Group that should get the specified permissions. Changing this forces a new resource to be created. Cannot be used with `login_name` -- `login_name` (String) The name of the user that should get the specified permissions. Changing this forces a new resource to be created. Cannot be used with `group_name` +- `login_name` (String) The name of the user that should get the specified permissions. Changing this forces a new resource to be created. Cannot be used with `group_name`. - `project_key` (String) Specify if you want to apply project level permissions. Changing this forces a new resource to be created. Cannot be used with `template_id & template_name` - `template_id` (String) Specify if you want to apply the permissions to a permission template. Changing this forces a new resource to be created. Cannot be used with `project_key & template_name` - `template_name` (String) Specify if you want to apply the permissions to a permission template. Changing this forces a new resource to be created. Cannot be used with `project_key & template_id` From cf7b3aeb0d8ac605869f6a745e78c3e349fa47fe Mon Sep 17 00:00:00 2001 From: Lorne Date: Mon, 21 Oct 2024 16:29:09 +0100 Subject: [PATCH 21/24] stop skip CI --- .github/workflows/tfplugindocs-generate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tfplugindocs-generate.yml b/.github/workflows/tfplugindocs-generate.yml index b2a35a33..34b8dde3 100644 --- a/.github/workflows/tfplugindocs-generate.yml +++ b/.github/workflows/tfplugindocs-generate.yml @@ -45,4 +45,4 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} branch: ${{ github.head_ref }} - message: "[bot][skip ci] docs: tfplugindocs generate" + message: "[bot] docs: tfplugindocs generate" From 060156a2b2ae05d503ab0e683b6c81938d46f8fb Mon Sep 17 00:00:00 2001 From: Lorne Date: Mon, 21 Oct 2024 16:52:10 +0100 Subject: [PATCH 22/24] remove .DS_Store from tracking --- .DS_Store | Bin 8196 -> 0 bytes .gitignore | 3 +++ 2 files changed, 3 insertions(+) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 1ee7ba0e80adad4ebe9bd2535cfc86f95aced8f2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeHMU2GIp6h7ayzzh>%S}PRnxLYd}OAQ49#UI%IMSfaZXlsA?sk=J^9i7gUo!M=x zQR|aN)WjE!|8GQnK#k(xtN)4dfmEWzM2v|~yl4a;OpNEwoe~P|qe^6Ma__h2+;h(K zp8d|;oGlTdrD&}uswN_pr$9sJWsV{C#k_1Nv8Id>>`zpnBUGdu*=}%|b)rZzkYpgq zK$3wZ14#z1gbeVVErvSJy)So@HOWAdfvYkD;{A~3DKHb`l*H)O!AsNvFqX4A8vL32 zfXF8uV!uI z2c>ns;Ja?OA2^}odxHa^JrRmM5op%dz);{9!qzC*fWz^nRi$`F*O+h)?zIa6qoy5S zvOIOunp-y9c2}l-N9UgDrA9@iUZpSVFFApebM3xy#|lRVvq9eWEXO-M-Dmu_Hh-gJS zX02JTs{4e#wP5oq)p~>3s2N$cH{c`75bN~ynh|Kd4>(@zx>4V(8kW}QW^=YHqixae zRE=F)e@UKLDy#Husy2}KM@RWEfz-8_ZL0C5dQd#LBO8QWW41T*C$*T{RdpyB$rkLc zanCNycyy?0^fj_xxU^eN=og}F?5;J&$9r3O%(;)d*CxIx+ab2cK%2hM!7{!%fQWLe%PC7_qG)YJ4IeLxWqZ9N# zeMaBVDf)qapzEYDqZW3uR!<8v2X>YnX8cJAu9 zVvFwkC8Er(t-5a6^7N{PbsKNLyZHhcC3k1&dT|*<%%4>+5%VK%w0Hs4!X^xA2j_wf`%*iA`{TzHAvamJ_}XT0zaL;jp*Q{j_| YaY`aL=>1SI!=a{ounySkUZ0Vcxv>i_@% diff --git a/.gitignore b/.gitignore index ff5db650..409555ed 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,6 @@ coverage.txt # dist directory for local testingg dist/ .vscode/settings.json + +.DS_Store + From 3b570668d96355848466e8b96abce96858448b00 Mon Sep 17 00:00:00 2001 From: Lorne Date: Tue, 22 Oct 2024 15:10:27 +0100 Subject: [PATCH 23/24] move actions to use SHA for consistency --- .github/workflows/tfplugindocs-generate.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tfplugindocs-generate.yml b/.github/workflows/tfplugindocs-generate.yml index 34b8dde3..2743f417 100644 --- a/.github/workflows/tfplugindocs-generate.yml +++ b/.github/workflows/tfplugindocs-generate.yml @@ -15,23 +15,23 @@ jobs: name: tfplugindocs generate runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4.1.1 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 with: persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token fetch-depth: 0 # otherwise, you will fail to push refs to dest repo - - uses: actions/setup-go@v5.0.2 + - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: go-version-file: tools/go.mod - name: GOCACHE run: | echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV - - uses: actions/cache@v4.0.2 + - uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1 continue-on-error: true timeout-minutes: 2 with: path: ${{ env.GOCACHE }} key: ${{ runner.os }}-GOCACHE-${{ hashFiles('go.sum') }}-${{ hashFiles('internal/**') }} - - uses: actions/cache@v4.0.2 + - uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1 continue-on-error: true timeout-minutes: 2 with: @@ -40,7 +40,7 @@ jobs: - run: | make tools make docs - - uses: actions-js/push@v1.5 + - uses: actions-js/push@5a7cbd780d82c0c937b5977586e641b2fd94acc5 #v1.5 name: Github commit and push with: github_token: ${{ secrets.GITHUB_TOKEN }} From b1b6b2643175408697ab5ee1b5307c6d4ffc0ebe Mon Sep 17 00:00:00 2001 From: Lorne Stalker Date: Tue, 22 Oct 2024 15:23:27 +0100 Subject: [PATCH 24/24] testing workflow after changing actions to SHAs (#4) * testing workflow after changing actions to SHAs * [bot] docs: tfplugindocs generate --------- Co-authored-by: github-actions[bot] --- docs/resources/qualitygate.md | 8 ++++---- sonarqube/resource_sonarqube_qualitygate.go | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/resources/qualitygate.md b/docs/resources/qualitygate.md index d8ae3456..809b0eb9 100644 --- a/docs/resources/qualitygate.md +++ b/docs/resources/qualitygate.md @@ -50,13 +50,13 @@ For example, if you are using a grade rating metric such as `new_reliability_rat ### Required -- `name` (String) The name of the Quality Gate to create. Maximum length 100 +- `name` (String) The name of the Quality Gate to create. Maximum length 100. ### Optional -- `condition` (Block List) A list of conditions that the gate uses (see [below for nested schema](#nestedblock--condition)) -- `copy_from` (String) Name of an existing Quality Gate to copy from -- `is_default` (Boolean) When set to true this Quality Gate is set as default +- `condition` (Block List) A list of conditions that the gate uses. (see [below for nested schema](#nestedblock--condition)) +- `copy_from` (String) Name of an existing Quality Gate to copy from. +- `is_default` (Boolean) When set to true this Quality Gate is set as default. ### Read-Only diff --git a/sonarqube/resource_sonarqube_qualitygate.go b/sonarqube/resource_sonarqube_qualitygate.go index f890f496..289db591 100644 --- a/sonarqube/resource_sonarqube_qualitygate.go +++ b/sonarqube/resource_sonarqube_qualitygate.go @@ -61,25 +61,25 @@ func resourceSonarqubeQualityGate() *schema.Resource { "name": { Type: schema.TypeString, Required: true, - Description: "The name of the Quality Gate to create. Maximum length 100", + Description: "The name of the Quality Gate to create. Maximum length 100.", }, "copy_from": { Type: schema.TypeString, Optional: true, ForceNew: true, ConflictsWith: []string{"condition"}, - Description: "Name of an existing Quality Gate to copy from", + Description: "Name of an existing Quality Gate to copy from.", }, "is_default": { Type: schema.TypeBool, Optional: true, - Description: "When set to true this Quality Gate is set as default", + Description: "When set to true this Quality Gate is set as default.", Default: false, }, "condition": { Type: schema.TypeList, Optional: true, - Description: "A list of conditions that the gate uses", + Description: "A list of conditions that the gate uses.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "id": {