Skip to content

Commit

Permalink
Feat: Updated Docs (#412)
Browse files Browse the repository at this point in the history
This PR is to bring the docs into line with the recommended style from
hashicorp, using their tool
[tfplugindocs](https://github.com/hashicorp/terraform-plugin-docs)

I tried to keep the docs feeling mostly the same well being within
"spec", please let me know if any of the new docs are out of date. I
mostly tried to keep what was still valid arguments and the descriptions
for those arguments.

---------

Signed-off-by: Allen Conlon <allen@conlon.dev>
  • Loading branch information
a1994sc authored Mar 4, 2024
1 parent 10e5b08 commit cb9cdb2
Show file tree
Hide file tree
Showing 86 changed files with 3,736 additions and 570 deletions.
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 @@
# source https://github.com/hashicorp/terraform-provider-awscc/blob/main/.github/workflows/tfplugindocs-check.yml

name: Check if tfplugindocs result matches /docs

on:
push:
branches:
- main
- "release/**"
pull_request:
paths:
- .github/workflows/tfplugindocs-check.yml
- go.sum
- Makefile
- client/**
- main.go
- docs/**

jobs:
tfplugindocs_check:
name: tfplugindocs check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1
- uses: actions/setup-go@v5.0.0
with:
go-version-file: tools/go.mod
- name: GOCACHE
run: |
echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV
- uses: actions/cache@v4.0.0
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@v4.0.0
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
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
ACCTEST_PARALLELISM ?= 20
GO_VER ?= go

default: tools

.PHONY: tools docs default

all: tools docs

tools:
cd tools && $(GO_VER) install github.com/golangci/golangci-lint/cmd/golangci-lint
cd tools && $(GO_VER) install github.com/pavius/impi/cmd/impi
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
@tfplugindocs generate
48 changes: 32 additions & 16 deletions docs/data-sources/groups.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
# Data Source: harbor_groups
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "harbor_groups Data Source - terraform-provider-harbor"
subcategory: ""
description: |-
---

# harbor_groups (Data Source)

<!-- schema generated by tfplugindocs -->

## Example Usage
```hcl

```terraform
data "harbor_groups" "example" {
group_name = "example-group"
}
Expand All @@ -11,24 +22,29 @@ output "group_ids" {
}
```

## Argument Reference
The following arguments are supported:
## Schema

* `group_name` - (Optional) The name of the group to filter by.
* `ldap_group_dn` - (Optional) The LDAP group DN to filter by.
### Optional

## Attributes Reference
In addition to all arguments, the following attributes are exported:
- `group_name` (String) The name of the group to filter by.
- `ldap_group_dn` (String) The LDAP group DN to filter by.

* `groups` - (Computed) A list of groups matching the previous arguments. Each `group` object provides the attributes documented below.
### Read-Only

---
- `groups` (List of Object) (see [below for nested schema](#nestedatt--groups))
- `id` (String) The ID of this resource.

<a id="nestedatt--groups"></a>

### Nested Schema for `groups`

A list of groups matching the previous arguments. Each `group` object provides the attributes documented below.

**group** object exports the following:
Read-Only:

* `id` - The ID of the group.
* `group_name` - The name of the group.
* `group_type` - The type of the group.
* `ldap_group_dn` - The LDAP group DN of the group.
- `group_name` (String) The name of the group.
- `group_type` (Number) The type of the group.
- `id` (Number) The ID of the group.
- `ldap_group_dn` (String) The LDAP group DN of the group.

This data source retrieves a list of Harbor groups and filters them based on the `group_name` and `ldap_group_dn` arguments. It returns a list of `group` objects, each containing the `id`, `group_name`, `group_type`, and `ldap_group_dn` attributes of a group that matches the filter criteria.
This data source retrieves a list of Harbor groups and filters them based on the `group_name` and `ldap_group_dn` arguments. It returns a list of `group` objects, each containing the `id`, `group_name`, `group_type`, and `ldap_group_dn` attributes of a group that matches the filter criteria.
35 changes: 22 additions & 13 deletions docs/data-sources/project.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
# Data Source: harbor_project
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "harbor_project Data Source - terraform-provider-harbor"
subcategory: ""
description: |-
---

# harbor_project (Data Source)

<!-- schema generated by tfplugindocs -->

## Example Usage
```hcl

```terraform
data "harbor_project" "main" {
name = "library"
}
Expand All @@ -11,18 +22,16 @@ output "project_id" {
}
```

## Argument Reference
The following arguments are supported:

* **name** - (Required) The name of the project.

## Attributes Reference
In addition to all argument, the following attributes are exported:
## Schema

* **project_id** - The id of the project within harbor.
### Required

* **public** - If the project has public accessibility.
- `name` (String) The name of the project.

* **vulnerability_scanning** - If the images is scanned for vulnerabilities when push to harbor.
### Read-Only

* **type** - The type of the project : Project or ProxyCache.
- `id` (String) The ID of this resource.
- `project_id` (Number) The id of the project within harbor.
- `public` (Boolean) If the project has public accessibility.
- `type` (String) The type of the project : Project or ProxyCache.
- `vulnerability_scanning` (Boolean) If the images is scanned for vulnerabilities when push to harbor.
51 changes: 30 additions & 21 deletions docs/data-sources/projects.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
# Data Source: harbor_projects
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "harbor_projects Data Source - terraform-provider-harbor"
subcategory: ""
description: |-
---

# harbor_projects (Data Source)

<!-- schema generated by tfplugindocs -->

## Example Usage
```hcl

```terraform
data "harbor_projects" "proxycache" {
type = "ProxyCache"
}
Expand All @@ -11,30 +22,28 @@ output "proxy_cache_projects" {
}
```

## Argument Reference
The following arguments are supported:
## Schema

* **name** - (Optional) The name of the project.
### Optional

* **type** - (Optional) The type of the project : Project or ProxyCache.
- `name` (String) The name of the project.
- `public` (Boolean) If the project has public accessibility.
- `type` (String) The type of the project : Project or ProxyCache.
- `vulnerability_scanning` (Boolean) If the images will be scanned for vulnerabilities when push to harbor.

* **public** - (Optional) If the project has public accessibility.

* **vulnerability_scanning** - (Optional) If the images will be scanned for vulnerabilities when push to harbor.

## Attributes Reference
In addition to all argument, the following attributes are exported:

* **projects** - A list of projects matching previous arguments. Each **project** object provides the attributes documented below.

---
### Read-Only

**project** object exports the following:
- `id` (String) The ID of this resource.
- `projects` (List of Object) (see [below for nested schema](#nestedatt--projects))

* **name** - The name of the project.
<a id="nestedatt--projects"></a>

* **type** - The type of the project : Project or ProxyCache.
### Nested Schema for `projects`

* **public** - If the project has public accessibility.
Read-Only:

* **vulnerability_scanning** - If the images will be scanned for vulnerabilities when push to harbor.
- `name` (String)
- `project_id` (Number)
- `public` (Boolean)
- `type` (String)
- `vulnerability_scanning` (Boolean)
40 changes: 23 additions & 17 deletions docs/data-sources/registry.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
# Data Source: harbor_registry
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "harbor_registry Data Source - terraform-provider-harbor"
subcategory: ""
description: |-
---

# harbor_registry (Data Source)

<!-- schema generated by tfplugindocs -->

## Example Usage

```hcl
```terraform
data "harbor_registry" "main" {
name = "test_docker_harbor"
}
Expand All @@ -12,22 +22,18 @@ output "harbor_registry_id" {
}
```

## Argument Reference
The following arguments are supported:

* **name** - (Required) The name of the register.
## Schema

## Attributes Reference
In addition to all argument, the following attributes are exported:
### Required

* **registry_id** - The id of the register within harbor.

* **status** - The health status of the external container register

* **endpoint_url** - The url endpoint for the external container register

* **description** - The description of the external container register.
- `name` (String) The name of the register.

* **insecure** - If the certificate of the external container register can be verified.
### Read-Only

* **type** - The type of the provider type.
- `description` (String) The description of the external container register.
- `id` (String) The ID of this resource.
- `insecure` (Boolean) If the certificate of the external container register can be verified.
- `registry_id` (Number) The id of the register within harbor.
- `status` (String) The health status of the external container register
- `type` (String) The type of the provider type.
- `url` (String) The url endpoint for the external container register
65 changes: 20 additions & 45 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,25 @@
# Harbor Provider
The Harbor provider is used to configure an instance of Harbor. The provider needs to be configured with the proper credentials before it can be used.
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "harbor Provider"
subcategory: ""
description: |-
---

## Resources
* [Resource: harbor_configuration](resources/configuration.md)
* [Resource: harbor_config_system](resources/config_system.md)
* [Resource: harbor_config_email](resources/config_email.md)
* [Resource: harbor_garbage_collection](resources/garbage_collection.md)
* [Resource: harbor_purge_audit_log](resources/purge-audit-log.md)
* [Resource: harbor_immutable_tag_rule](resources/immutable_tag_rule.md)
* [Resource: harbor_interrogation_services](resources/interrogation_services.md)
* [Resource: harbor_label](resources/label.md)
* [Resource: harbor_project_member_group](resources/project_member_group.md)
* [Resource: harbor_project_member_user](resources/project_member_user.md)
* [Resource: harbor_project](resources/project.md)
* [Resource: harbor_registry](resources/registry.md)
* [Resource: harbor_replication](resources/replication.md)
* [Resource: harbor_retention_policy](resources/retention_policy.md)
* [Resource: harbor_robot_account](resources/robot_account.md)
* [Resource: harbor_tasks](resources/tasks.md)
* [Resource: harbor_user](resources/user.md)
# harbor Provider

## Authentication
```hcl
provider "harbor" {
url = "https://harbor.aceme_corpartion.com"
username = "insert_admin_username_here"
password = "insert_password_here"
bearer_token = "insert_bearer_token_here"
}
```
<!-- schema generated by tfplugindocs -->

Alternatively, these environment variables can be used to set the provider config values:
```
HARBOR_URL
HARBOR_USERNAME
HARBOR_PASSWORD
HARBOR_BEARER_TOKEN
HARBOR_IGNORE_CERT
```
## Schema

## Argument Reference
The following arguments are supported:
### Required

* **url** - (Required) The url of harbor
* **username** - (Required) The username to be used to access harbor
* **password** - (Required) The password to be used to access harbor
* **bearer_token** - (Optional) The bearer token to be used to access harbor. Will take precedence over username and password if set
* **insecure** - (Optional) Choose to ignore certificate errors
* **api_version** - (Optional) Choose which version of the api you would like to use 1 or 2. Default is `2`
- `url` (String) The url of harbor
- `password` (String) The password to be used to access harbor
- `username` (String) The username to be used to access harbor

### Optional

- `api_version` (Number) Choose which version of the api you would like to use 1 or 2. Default is `2`
- `bearer_token` (String) The bearer token to be used to access harbor. Will take precedence over username and password if set
- `insecure` (Boolean) Choose to ignore certificate errors
Loading

0 comments on commit cb9cdb2

Please sign in to comment.