Skip to content

Commit

Permalink
Merge pull request #211 from felixlut/portfolio-manual-selection
Browse files Browse the repository at this point in the history
Portfolio manual selection
  • Loading branch information
jdamata authored Oct 18, 2023
2 parents 1fd2cf0 + e18f261 commit c8754ed
Show file tree
Hide file tree
Showing 4 changed files with 684 additions and 110 deletions.
30 changes: 30 additions & 0 deletions docs/resources/sonarqube_portfolio.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,40 @@ The following arguments are supported:
- 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
Expand Down
Loading

0 comments on commit c8754ed

Please sign in to comment.