Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terraform Provider Documentation Alignment #280

Merged
merged 30 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
cd2594f
tf provider documentation update
lornest Oct 16, 2024
858d190
generate documentation using tfplugindocs
lornest Oct 17, 2024
9eba912
workflow
lornest Oct 17, 2024
7995308
test workflow
lornest Oct 17, 2024
89949b5
fix default branch name in workflow
lornest Oct 17, 2024
0cb7e22
workflow change go mod location
lornest Oct 17, 2024
943d4fa
makefile
lornest Oct 17, 2024
228f798
makefile goversion
lornest Oct 17, 2024
f5ff4c4
set GO_VER in makefile
lornest Oct 17, 2024
9b1903b
fix makefile
lornest Oct 17, 2024
73a126e
build tools
lornest Oct 17, 2024
697a3c1
update readme
lornest Oct 17, 2024
2769fca
tidy up tfplugindocks-check workflow
lornest Oct 18, 2024
43f8856
add tfplugindocs-generate workflow
lornest Oct 18, 2024
c913ec6
testing workflow for doc generation on PR
lornest Oct 21, 2024
5077e62
Merge pull request #1 from lornest/testing-workflow
lornest Oct 21, 2024
73d80a3
testing a change without doc updates locally
lornest Oct 21, 2024
4d27035
Merge 73d80a3770e669dd1c166420ea9d8dab9a94cb80 into 5077e620428f7c67f…
lornest Oct 21, 2024
935e9a2
[bot][skip ci] docs: tfplugindocs generate
github-actions[bot] Oct 21, 2024
a1130c5
Merge pull request #2 from lornest/test-doc-gen-with-changes
lornest Oct 21, 2024
310e299
fixing workflow ordering
lornest Oct 21, 2024
0636717
Merge branch 'jdamata:master' into master
lornest Oct 21, 2024
4aac046
period to test codegen PR
lornest Oct 21, 2024
60693cd
Merge 4aac04635fd01b592bdd69655c03d4e9dd2fd9db into 063671708126c5523…
lornest Oct 21, 2024
a962e8c
[bot][skip ci] docs: tfplugindocs generate
github-actions[bot] Oct 21, 2024
cf7b3ae
stop skip CI
lornest Oct 21, 2024
79af100
Merge pull request #3 from lornest/final-test
lornest Oct 21, 2024
060156a
remove .DS_Store from tracking
lornest Oct 21, 2024
3b57066
move actions to use SHA for consistency
lornest Oct 22, 2024
b1b6b26
testing workflow after changing actions to SHAs (#4)
lornest Oct 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
jdamata marked this conversation as resolved.
Show resolved Hide resolved
Binary file not shown.
49 changes: 49 additions & 0 deletions .github/workflows/tfplugindocs-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Check if tfplugindocs result matches /docs
jdamata marked this conversation as resolved.
Show resolved Hide resolved

on:
push:
branches:
jdamata marked this conversation as resolved.
Show resolved Hide resolved
- master
- "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
jdamata marked this conversation as resolved.
Show resolved Hide resolved
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: ./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
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,21 @@ 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:
cd tools && $(GO_VER) install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs

docs:
jdamata marked this conversation as resolved.
Show resolved Hide resolved
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

Expand Down
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand All @@ -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)
31 changes: 31 additions & 0 deletions docs/data-sources/group.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
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

## Example Usage

```terraform
data "sonarqube_group" "group" {
name = "terraform-test"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) The name of the group.

### Read-Only

- `description` (String) The group description.
- `id` (String) The ID of this resource.
38 changes: 38 additions & 0 deletions docs/data-sources/portfolio.md
Original file line number Diff line number Diff line change
@@ -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 generated by tfplugindocs -->
## 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
32 changes: 32 additions & 0 deletions docs/data-sources/project.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
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

## Example Usage

```terraform
data "sonarqube_project" "project" {
project = "projet-key-id"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `project` (String) The project key of the project

### Read-Only

- `id` (String) The ID of this resource.
- `name` (String) Name of the project
- `visibility` (String) Project visibility
43 changes: 43 additions & 0 deletions docs/data-sources/qualitygate.md
Original file line number Diff line number Diff line change
@@ -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 generated by tfplugindocs -->
## 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.

<a id="nestedatt--condition"></a>
### Nested Schema for `condition`

Read-Only:

- `id` (String)
- `metric` (String)
- `op` (String)
- `threshold` (String)
33 changes: 33 additions & 0 deletions docs/data-sources/qualityprofile.md
Original file line number Diff line number Diff line change
@@ -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 generated by tfplugindocs -->
## 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
36 changes: 36 additions & 0 deletions docs/data-sources/rule.md
Original file line number Diff line number Diff line change
@@ -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 generated by tfplugindocs -->
## Schema

### Required

- `key` (String) The key of the sonarqube rule. Should be <repo>:<name>. 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
26 changes: 0 additions & 26 deletions docs/data-sources/sonarqube_group.md

This file was deleted.

30 changes: 0 additions & 30 deletions docs/data-sources/sonarqube_portfolio.md

This file was deleted.

Loading