Skip to content

Commit

Permalink
Merge pull request #6 from hypnoglow/update-readme
Browse files Browse the repository at this point in the history
Update README
  • Loading branch information
hypnoglow authored Sep 30, 2020
2 parents e609834 + 4123baa commit 39624df
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 59 deletions.
6 changes: 1 addition & 5 deletions .github/goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ builds:
goarch: '386'

archives:
- id: zip
format: zip
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
- id: targz
format: tar.gz
- format: zip
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"

checksum:
Expand Down
81 changes: 64 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,81 @@

Terraform provider for [ORY Hydra](https://github.com/ory/hydra).

## Install
## Using the provider

As this provider is custom, terraform won't be able to download it automatically.
The provider is published to the [Terraform Registry](https://registry.terraform.io/providers/hypnoglow/oryhydra/latest).
Terraform v0.13.0+ supports automatic provider installation from the Terraform Registry. If you run older versions of terraform, you
will have to install the provider manually.

To install this provider in a [recommended way](https://www.terraform.io/docs/configuration/providers.html#third-party-plugins)
e.g. for Linux:
To install this provider, add it into your Terraform configuration. Then, run `terraform init`.

```shell script
VERSION="0.1.1"
```hcl
terraform {
required_providers {
oryhydra = {
source = "hypnoglow/oryhydra"
version = "0.2.0"
}
}
}
cd /tmp
wget https://github.com/hypnoglow/terraform-provider-oryhydra/releases/download/v${VERSION}/terraform-provider-oryhydra_${VERSION}_linux_amd64.tar.gz
tar xzf terraform-provider-oryhydra_${VERSION}_linux_amd64.tar.gz
mv terraform-provider-oryhydra_v${VERSION} ~/.terraform.d/plugins/linux_amd64/terraform-provider-oryhydra_v${VERSION}
provider "oryhydra" {}
```

Then you can set up a provider in your terraform project:
To configure the provider, define the `url` argument:

```hcl-terraform
```hcl
provider "oryhydra" {
version = "0.1.1"
url = "https://admin.hydra.example.tld"
}
```

Alternatively you can set `ORY_HYDRA_URL` environment variable.

Refer to [documentation](https://registry.terraform.io/providers/hypnoglow/oryhydra/latest/docs) for available resources reference.

Examples can be found in [examples](examples/) directory.

## Developing the Provider

This section explains how to build the provider and test it out on the example.

First of all you need to build the provider and link it to the examples:

```shell script
make build
make prepare-examples
```

To test examples, you need a running Hydra instance. For demonstrational purposes,
we can run Hydra locally as a Docker container:

```shell script
docker container run -i -t --rm --name hydra \
-p 4444:4444 \
-p 4445:4445 \
-e LOG_LEVEL=debug \
-e DSN=memory \
oryd/hydra:v1.4.10 serve all --dangerous-force-http
```

## Usage
Then you can simply run examples as usual terraform project. Enter a particular example directory (e.g. `cd examples/oryhydra_oauth2_client`)
and run:

For example usage see [examples](examples/README.md).
```shell script
terraform init

terraform plan

## Implemented resources
terraform apply
```

- OAuth2 Client - `oryhydra_oauth2_client`
### Test release

Releases managed by [GoReleaser](https://goreleaser.com/).

Run goreleaser locally:

```shell script
goreleaser release --config .github/goreleaser.yaml --rm-dist --skip-publish --skip-validate
```
9 changes: 0 additions & 9 deletions develop.md

This file was deleted.

30 changes: 2 additions & 28 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,5 @@
# Examples

First of all you need to build the provider and link it to the examples:
This directory contains provider usage examples.

```shell script
make build
make prepare-examples
```

To test examples, you need a running Hydra instance. For demonstrational purposes,
we can run Hydra locally as a Docker container:

```shell script
docker container run -i -t --rm --name hydra \
-p 4444:4444 \
-p 4445:4445 \
-e LOG_LEVEL=debug \
-e DSN=memory \
oryd/hydra:v1.4.10 serve all --dangerous-force-http
```

Then you can simply run examples as usual terraform project. Enter a particular example directory (e.g. `cd examples/oryhydra_oauth2_client`)
and run:

```shell script
terraform init

terraform plan

terraform apply
```
- [OAuth2 Client example](./oryhydra_oauth2_client)

0 comments on commit 39624df

Please sign in to comment.