Skip to content

Commit d5cb671

Browse files
authored
Merge pull request #74 from ory/docs/update-readme
ci: update readme
2 parents 1476899 + ea45b27 commit d5cb671

File tree

2 files changed

+123
-96
lines changed

2 files changed

+123
-96
lines changed

CHANGELOG.md

Lines changed: 0 additions & 60 deletions
This file was deleted.

README.md

Lines changed: 123 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,31 @@ A Terraform provider for managing [Ory Network](https://www.ory.sh/) resources u
1616
1717
## Features
1818

19+
### Resources
20+
21+
- **Project & Workspace Management**: Create and manage Ory Network projects and workspaces
22+
- **Project Configuration**: CORS, session settings, password policies, MFA, OAuth2/Hydra settings
1923
- **Identity Management**: Create and manage user identities with custom schemas
24+
- **Identity Schemas**: Define custom identity schemas for your project
2025
- **Authentication Flows**: Configure social providers (Google, GitHub, Microsoft, Apple, OIDC)
21-
- **Project Configuration**: CORS, session settings, password policies, MFA
2226
- **Webhooks/Actions**: Trigger webhooks on identity flow events
2327
- **Email Templates**: Customize verification, recovery, and login code emails
2428
- **OAuth2 Clients**: Manage OAuth2/OIDC client applications and dynamic client registration (RFC 7591)
29+
- **JSON Web Key Sets**: Manage JWK sets for token signing and verification
2530
- **JWT Grant Trust**: Trust external identity providers for RFC 7523 JWT Bearer grants
2631
- **Event Streams**: Publish Ory events to external systems like AWS SNS (Enterprise)
2732
- **Organizations**: Multi-tenancy support for B2B applications
2833
- **Permissions (Keto)**: Manage relationship tuples for fine-grained authorization
2934
- **API Key Management**: Manage project API keys
3035

36+
### Data Sources
37+
38+
- **Project** / **Workspace** — Look up existing projects and workspaces
39+
- **Identity** — Query user identities
40+
- **Identity Schemas** — List available identity schemas
41+
- **OAuth2 Client** — Look up OAuth2 client details
42+
- **Organization** — Look up organization details
43+
3144
## Requirements
3245

3346
- [Terraform](https://www.terraform.io/downloads) >= 1.0
@@ -53,7 +66,7 @@ terraform {
5366
```bash
5467
git clone https://github.com/ory/terraform-provider-ory.git
5568
cd terraform-provider-ory
56-
go build -o terraform-provider-ory
69+
make build
5770
```
5871

5972
Then configure Terraform to use the local provider:
@@ -123,7 +136,7 @@ resource "ory_social_provider" "google" {
123136
provider_id = "google"
124137
client_id = var.google_client_id
125138
client_secret = var.google_client_secret
126-
scopes = ["email", "profile"]
139+
scope = ["email", "profile"]
127140
}
128141
129142
# Create a webhook for new registrations
@@ -251,49 +264,70 @@ resource "ory_email_template" "recovery" {
251264

252265
## Development
253266

254-
### Building
267+
### Setup
255268

256269
```bash
257-
go build -o terraform-provider-ory
270+
git clone https://github.com/ory/terraform-provider-ory.git
271+
cd terraform-provider-ory
272+
273+
# Install dependencies and development tools (linters, doc generators, security scanners)
274+
make deps
275+
276+
# Set up git hooks (conventional commit validation, pre-push checks)
277+
git config core.hooksPath .githooks
278+
279+
# Build the provider
280+
make build
281+
282+
# Install to local Terraform plugins directory
283+
make install
258284
```
259285

260286
### Testing
261287

262-
Acceptance tests are **self-contained** - they automatically create a temporary Ory project, run tests against it, and clean up when done.
288+
#### Unit Tests
263289

264-
#### Required Environment Variables
290+
Unit tests run without any credentials:
265291

266292
```bash
267-
# Required for acceptance tests
268-
export ORY_WORKSPACE_API_KEY="ory_wak_..." # Workspace API key
269-
export ORY_WORKSPACE_ID="..." # Workspace ID
293+
make test # Run all unit tests
294+
make test-short # Run unit tests in short mode
270295
```
271296

272-
#### Running Tests
297+
#### Acceptance Tests
298+
299+
Acceptance tests run against a **pre-created Ory project**. Copy `.env.example` to `.env` and fill in your credentials:
273300

274301
```bash
275-
# Unit tests only (no credentials needed)
276-
make test
302+
cp .env.example .env
303+
```
277304

278-
# All acceptance tests
279-
make test-acc
305+
At minimum you need:
280306

281-
# Acceptance tests with debug logging
282-
make test-acc-verbose
307+
```bash
308+
# Workspace credentials
309+
ORY_WORKSPACE_API_KEY=ory_wak_...
310+
ORY_WORKSPACE_ID=...
311+
312+
# Pre-created test project
313+
ORY_PROJECT_ID=...
314+
ORY_PROJECT_SLUG=...
315+
ORY_PROJECT_API_KEY=ory_pat_...
316+
ORY_PROJECT_ENVIRONMENT=prod
317+
```
283318

284-
# Only Keto/relationship tests
285-
make test-acc-keto
319+
The `.env` file is gitignored and automatically loaded by `make` targets.
286320

287-
# All tests with all features enabled
288-
make test-acc-all
321+
```bash
322+
make test-acc # Standard acceptance tests
323+
make test-acc-verbose # With debug logging
324+
make test-acc-keto # Run only Keto/relationship tests
325+
make test-acc-all # All tests with all features enabled
289326
```
290327

291328
Or run directly with `go test`:
292329

293330
```bash
294-
# Unit tests
295-
go test -short ./...
296-
297331
# Acceptance tests
298332
TF_ACC=1 go test -tags acceptance -p 1 -v -timeout 30m ./...
299333

@@ -334,6 +368,25 @@ Some tests require additional feature flags or specific Ory plan features:
334368

335369
\*Organizations require B2B features to be enabled on your plan.
336370

371+
### Duration Format
372+
373+
Time-based attributes (e.g., `session_lifespan`, `oauth2_access_token_lifespan`) use Go duration strings. The Ory API normalizes durations on write, so use the full normalized format to avoid perpetual diffs in `terraform plan`:
374+
375+
| Write | API Returns | Use in Config |
376+
|-------|-------------|---------------|
377+
| `1h` | `1h0m0s` | `1h0m0s` |
378+
| `30m` | `30m0s` | `30m0s` |
379+
| `720h` | `720h0m0s` | `720h0m0s` |
380+
381+
### Known Limitations
382+
383+
- `ory_identity_schema`: Content is immutable; changes require resource replacement. Delete not supported by Ory API (resource removed from state only).
384+
- `ory_workspace`: Delete not supported by Ory API.
385+
- `ory_oauth2_client`: `client_secret` only returned on initial creation.
386+
- `ory_email_template`: Delete resets to Ory defaults rather than removing.
387+
- `ory_relationship`: Requires Ory Permissions (Keto) to be enabled on the project.
388+
- `ory_project_config`: Cannot be deleted — it always exists for a project. Only attributes present in your Terraform configuration are tracked for drift.
389+
337390
### Documentation
338391

339392
Documentation is auto-generated from **templates** using [tfplugindocs](https://github.com/hashicorp/terraform-plugin-docs). Do NOT edit files in `docs/` directly — they are overwritten on every build.
@@ -352,30 +405,64 @@ Templates use Go template syntax with these variables:
352405
```
353406
templates/
354407
├── index.md.tmpl # Provider-level docs
355-
├── resources/
356-
│ ├── oauth2_client.md.tmpl # Each resource has a template
357-
│ ├── oidc_dynamic_client.md.tmpl
408+
├── resources/ # 16 resource templates
409+
│ ├── action.md.tmpl
410+
│ ├── email_template.md.tmpl
358411
│ ├── event_stream.md.tmpl
412+
│ ├── identity.md.tmpl
413+
│ ├── identity_schema.md.tmpl
414+
│ ├── json_web_key_set.md.tmpl
415+
│ ├── oauth2_client.md.tmpl
416+
│ ├── oidc_dynamic_client.md.tmpl
417+
│ ├── organization.md.tmpl
418+
│ ├── project.md.tmpl
419+
│ ├── project_api_key.md.tmpl
420+
│ ├── project_config.md.tmpl
421+
│ ├── relationship.md.tmpl
422+
│ ├── social_provider.md.tmpl
359423
│ ├── trusted_oauth2_jwt_grant_issuer.md.tmpl
360-
│ └── ...
361-
└── data-sources/
362-
├── project.md.tmpl # Data source templates
363-
├── workspace.md.tmpl
424+
│ └── workspace.md.tmpl
425+
└── data-sources/ # 6 data source templates
364426
├── identity.md.tmpl
427+
├── identity_schemas.md.tmpl
365428
├── oauth2_client.md.tmpl
366429
├── organization.md.tmpl
367-
├── identity_schemas.md.tmpl
368-
└── ...
430+
├── project.md.tmpl
431+
└── workspace.md.tmpl
432+
```
433+
434+
### Pre-Commit Checklist
435+
436+
Run these checks locally before committing. They mirror what CI runs on every push.
437+
438+
```bash
439+
# Minimum before committing:
440+
make build && make format && make test
441+
442+
# Full CI-equivalent check:
443+
make build && make format && make test && make sec && make licenses
444+
```
445+
446+
`make format` runs several tools in sequence: `go fmt`, `gofmt -s`, `terraform fmt`, `go mod tidy`, `tfplugindocs generate`, and `golangci-lint --fix`.
447+
448+
### Security Scanning
449+
450+
```bash
451+
make sec # Run all security scans
452+
make sec-vuln # govulncheck — known Go vulnerabilities
453+
make sec-gosec # gosec — Go security patterns
454+
make sec-gitleaks # gitleaks — hardcoded secrets
455+
make sec-trivy # trivy — vulnerability and misconfig scanning
369456
```
370457

371458
## Contributing
372459

373-
Contributions are welcome! Please feel free to submit a Pull Request.
460+
Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines on development setup, testing, writing acceptance tests, and the contribution checklist.
374461

375462
1. Fork the repository
376463
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
377-
3. Commit your changes (`git commit -m 'Add amazing feature'`)
378-
4. Push to the branch (`git push origin feature/amazing-feature`)
464+
3. Run checks: `make build && make format && make test`
465+
4. Commit using [Conventional Commits](https://www.conventionalcommits.org/) format
379466
5. Open a Pull Request
380467

381468
## Related Links

0 commit comments

Comments
 (0)