You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# 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
258
284
```
259
285
260
286
### Testing
261
287
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
263
289
264
-
#### Required Environment Variables
290
+
Unit tests run without any credentials:
265
291
266
292
```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
270
295
```
271
296
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:
273
300
274
301
```bash
275
-
# Unit tests only (no credentials needed)
276
-
make test
302
+
cp .env.example .env
303
+
```
277
304
278
-
# All acceptance tests
279
-
make test-acc
305
+
At minimum you need:
280
306
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
+
```
283
318
284
-
# Only Keto/relationship tests
285
-
make test-acc-keto
319
+
The `.env` file is gitignored and automatically loaded by `make` targets.
286
320
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
289
326
```
290
327
291
328
Or run directly with `go test`:
292
329
293
330
```bash
294
-
# Unit tests
295
-
go test -short ./...
296
-
297
331
# Acceptance tests
298
332
TF_ACC=1 go test -tags acceptance -p 1 -v -timeout 30m ./...
299
333
@@ -334,6 +368,25 @@ Some tests require additional feature flags or specific Ory plan features:
334
368
335
369
\*Organizations require B2B features to be enabled on your plan.
336
370
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
+
337
390
### Documentation
338
391
339
392
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:
352
405
```
353
406
templates/
354
407
├── 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
358
411
│ ├── 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
359
423
│ ├── 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
364
426
├── identity.md.tmpl
427
+
├── identity_schemas.md.tmpl
365
428
├── oauth2_client.md.tmpl
366
429
├── 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
369
456
```
370
457
371
458
## Contributing
372
459
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.
374
461
375
462
1. Fork the repository
376
463
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
0 commit comments