Skip to content

Commit

Permalink
Update documentation, add namespace support
Browse files Browse the repository at this point in the history
  • Loading branch information
papegaaij committed Nov 7, 2023
1 parent 81e03f4 commit 4ef44c1
Show file tree
Hide file tree
Showing 29 changed files with 531 additions and 198 deletions.
21 changes: 0 additions & 21 deletions .copywrite.hcl

This file was deleted.

1 change: 0 additions & 1 deletion .github/CODEOWNERS

This file was deleted.

5 changes: 0 additions & 5 deletions .github/CODE_OF_CONDUCT.md

This file was deleted.

7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.1.0 (Unreleased)
## 0.0.2
* Add support for provisioned namespaces
* Updated documentation

## 0.0.1 (Initial release)

FEATURES:
* First implementation of a new Topicus KeyHub Terraform provider
137 changes: 74 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,75 @@
# Terraform Provider Scaffolding (Terraform Plugin Framework)

_This template repository is built on the [Terraform Plugin Framework](https://github.com/hashicorp/terraform-plugin-framework). The template repository built on the [Terraform Plugin SDK](https://github.com/hashicorp/terraform-plugin-sdk) can be found at [terraform-provider-scaffolding](https://github.com/hashicorp/terraform-provider-scaffolding). See [Which SDK Should I Use?](https://www.terraform.io/docs/plugin/which-sdk.html) in the Terraform documentation for additional information._

This repository is a *template* for a [Terraform](https://www.terraform.io) provider. It is intended as a starting point for creating Terraform providers, containing:

- A resource and a data source (`internal/provider/`),
- Examples (`examples/`) and generated documentation (`docs/`),
- Miscellaneous meta files.

These files contain boilerplate code that you will need to edit to create your own Terraform provider. Tutorials for creating Terraform providers can be found on the [HashiCorp Learn](https://learn.hashicorp.com/collections/terraform/providers-plugin-framework) platform. _Terraform Plugin Framework specific guides are titled accordingly._

Please see the [GitHub template repository documentation](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-from-a-template) for how to create a new repository from this template on GitHub.

Once you've written your provider, you'll want to [publish it on the Terraform Registry](https://www.terraform.io/docs/registry/providers/publishing.html) so that others can use it.

## Requirements

- [Terraform](https://www.terraform.io/downloads.html) >= 1.0
- [Go](https://golang.org/doc/install) >= 1.19

## Building The Provider

1. Clone the repository
1. Enter the repository directory
1. Build the provider using the Go `install` command:

```shell
go install
```

## Adding Dependencies

This provider uses [Go modules](https://github.com/golang/go/wiki/Modules).
Please see the Go documentation for the most up to date information about using Go modules.

To add a new dependency `github.com/author/dependency` to your Terraform provider:

```shell
go get github.com/author/dependency
go mod tidy
```

Then commit the changes to `go.mod` and `go.sum`.

## Using the provider

Fill this in for each provider

## Developing the Provider

If you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine (see [Requirements](#requirements) above).

To compile the provider, run `go install`. This will build the provider and put the provider binary in the `$GOPATH/bin` directory.

To generate or update documentation, run `go generate`.

In order to run the full suite of Acceptance tests, run `make testacc`.

*Note:* Acceptance tests create real resources, and often cost money to run.

```shell
make testacc
# Terraform Provider for Topicus KeyHub

_This provider is currently in preview. It requires a current nightly version of Topicus KeyHub._

The Terraform Provider for Topicus KeyHub allows managing resources within a Topicus KeyHub appliance.
It requires at least Terraform 1.0 and the most recent version of Terraform is recommended.

For more information see:
* [Terraform Website](https://www.terraform.io)
* [Topicus KeyHub Provider Documentation](https://registry.terraform.io/providers/topicuskeyhub/keyhubpreview/latest/docs)

The used provider version must match your Topicus KeyHub release.
For example, use the provider version 0.30.0 for Topicus KeyHub 30.
An older version of the provider may work on a newer version of Topicus KeyHub.
A newer version of the provder will fail on an older version of Topicus KeyHub.

## Usage example

```hcl
# 1. Specify the version of the Topicus KeyHub Provider to use
terraform {
required_providers {
keyhubpreview = {
source = "registry.terraform.io/hashicorp/keyhubpreview"
version = "=0.0.2"
}
}
}
# 2. Configure the Topicus KeyHub provider
variable "keyhub_secret" {
type = string
description = "Client secret on KeyHub"
}
provider "keyhubpreview" {
issuer = "https://keyhub.example.com"
clientid = "ebdf81ac-b02b-4335-9dc4-4a9bc4eb406d"
clientsecret = var.keyhub_secret
}
# 3. Create a group in Topicus KeyHub
resource "keyhubpreview_group" "group_in_keyhub" {
name = "Terraform"
accounts = [{
uuid = "7ea6622b-f9d2-4e52-a799-217b26f88376"
rights = "MANAGER"
}]
client_permissions = [{
client_uuid = "ebdf81ac-b02b-4335-9dc4-4a9bc4eb406d"
value = "GROUP_FULL_VAULT_ACCESS"
}]
}
# 4. Create a vault record in the newly created group
resource "keyhubpreview_group_vaultrecord" "vaultrecord_in_keyhub" {
name = "Terraform Record"
group_uuid = resource.keyhubpreview_group.group_in_keyhub.uuid
secret = {
password = "test3"
}
}
# 5. Setup provisioning for the group
resource "keyhubpreview_grouponsystem" "provisioning" {
provisioned_system_uuid = "47923975-b1af-47c8-bd7a-e52ebb4b9b84"
owner_uuid = resource.keyhubpreview_group.group_in_keyhub.uuid
name_in_system = "cn=terraform,ou=groups,dc=demo,dc=topicus-keyhub,dc=com"
type = "GROUP"
provgroups = [{
activation_required = "false"
group_uuid = "c6c98d08-2cbf-45e9-937a-c5c0427348e2"
}]
}
```
9 changes: 8 additions & 1 deletion docs/data-sources/group.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ description: |-




## Example Usage

```terraform
data "keyhubpreview_group" "group_from_keyhub" {
uuid = "0449c302-3701-44cf-a09f-9a6d903a763b"
additional = ["accounts", "audit", "nestedGroups"]
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
20 changes: 18 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,24 @@ description: |-
## Example Usage

```terraform
provider "scaffolding" {
# example configuration here
terraform {
required_providers {
keyhubpreview = {
source = "registry.terraform.io/hashicorp/keyhubpreview"
version = "=0.30.0"
}
}
}
variable "keyhub_secret" {
type = string
description = "Client secret on KeyHub"
}
provider "keyhubpreview" {
issuer = "https://keyhub.example.com"
clientid = "ebdf81ac-b02b-4335-9dc4-4a9bc4eb406d"
clientsecret = var.keyhub_secret
}
```

Expand Down
17 changes: 16 additions & 1 deletion docs/resources/group.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,22 @@ description: |-




## Example Usage

```terraform
resource "keyhubpreview_group" "terra" {
name = "Terraform"
application_administration = "true"
accounts = [{
uuid = "7ea6622b-f9d2-4e52-a799-217b26f88376"
rights = "MANAGER"
}]
client_permissions = [{
client_uuid = "ebdf81ac-b02b-4335-9dc4-4a9bc4eb406d"
value = "GROUP_FULL_VAULT_ACCESS"
}]
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
9 changes: 0 additions & 9 deletions examples/README.md

This file was deleted.

4 changes: 4 additions & 0 deletions examples/data-sources/keyhubpreview_group/data-source.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
data "keyhubpreview_group" "group_from_keyhub" {
uuid = "0449c302-3701-44cf-a09f-9a6d903a763b"
additional = ["accounts", "audit", "nestedGroups"]
}
3 changes: 0 additions & 3 deletions examples/data-sources/scaffolding_example/data-source.tf

This file was deleted.

20 changes: 18 additions & 2 deletions examples/provider/provider.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
provider "scaffolding" {
# example configuration here
terraform {
required_providers {
keyhubpreview = {
source = "registry.terraform.io/hashicorp/keyhubpreview"
version = "=0.30.0"
}
}
}

variable "keyhub_secret" {
type = string
description = "Client secret on KeyHub"
}

provider "keyhubpreview" {
issuer = "https://keyhub.example.com"
clientid = "ebdf81ac-b02b-4335-9dc4-4a9bc4eb406d"
clientsecret = var.keyhub_secret
}
12 changes: 12 additions & 0 deletions examples/resources/keyhubpreview_group/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
resource "keyhubpreview_group" "terra" {
name = "Terraform"
application_administration = "true"
accounts = [{
uuid = "7ea6622b-f9d2-4e52-a799-217b26f88376"
rights = "MANAGER"
}]
client_permissions = [{
client_uuid = "ebdf81ac-b02b-4335-9dc4-4a9bc4eb406d"
value = "GROUP_FULL_VAULT_ACCESS"
}]
}
3 changes: 0 additions & 3 deletions examples/resources/scaffolding_example/resource.tf

This file was deleted.

13 changes: 6 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ require (
github.com/hashicorp/terraform-plugin-framework v1.4.2
github.com/hashicorp/terraform-plugin-framework-validators v0.12.0
github.com/hashicorp/terraform-plugin-log v0.9.0
github.com/microsoft/kiota-abstractions-go v1.3.1
github.com/topicuskeyhub/sdk-go v0.29.1-0.20231031163120-580c3f972b4d
github.com/microsoft/kiota-abstractions-go v1.4.0
github.com/topicuskeyhub/sdk-go v0.29.1-0.20231107100645-f5ba1db322e2
golang.org/x/exp v0.0.0-20231006140011-7918f672742d
)

Expand All @@ -24,7 +24,7 @@ require (
github.com/cjlapao/common-go v0.0.39 // indirect
github.com/cloudflare/circl v1.3.3 // indirect
github.com/coreos/go-oidc v2.2.1+incompatible // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
Expand Down Expand Up @@ -56,7 +56,6 @@ require (
github.com/oklog/run v1.1.0 // indirect
github.com/posener/complete v1.2.3 // indirect
github.com/pquerna/cachecontrol v0.2.0 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/russross/blackfriday v1.6.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/spf13/cast v1.5.1 // indirect
Expand All @@ -71,10 +70,10 @@ require (
golang.org/x/mod v0.13.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.13.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
Expand Down
Loading

0 comments on commit 4ef44c1

Please sign in to comment.