Skip to content

hypnoglow/terraform-provider-oryhydra

Repository files navigation

ORY Hydra Terraform Provider

Maintenance main release Go Report Card

Terraform provider for ORY Hydra.

Using the provider

The provider is published to the Terraform Registry. 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, add it into your Terraform configuration. Then, run terraform init.

terraform {
  required_providers {
    oryhydra = {
      source = "hypnoglow/oryhydra"
      version = "0.4.0"
    }
  }
}

provider "oryhydra" {}

To configure the provider, define the url argument:

provider "oryhydra" {
  url = "https://admin.hydra.example.tld"
}

Alternatively you can set ORY_HYDRA_URL environment variable.

Refer to documentation for available resources reference.

Examples can be found in 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:

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:

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:

terraform init

terraform plan

terraform apply

Test release

Releases managed by GoReleaser.

Run goreleaser locally:

goreleaser release --config .github/goreleaser.yaml --clean --skip=publish --skip=validate