Skip to content

Commit 7193b3b

Browse files
authored
Merge pull request #33 from ory/docs/fix-documentation-accuracy
docs: fix documentation accuracy across all resources
2 parents c7bb766 + 40fa303 commit 7193b3b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1074
-525
lines changed

.githooks/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# Pre-commit hook for terraform-provider-orynetwork
2+
# Pre-commit hook for terraform-provider-ory
33

44
set -e
55

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Binaries
2-
terraform-provider-orynetwork
2+
terraform-provider-ory
33
*.exe
44
*.dll
55
*.so

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ formatters:
7777
simplify: true
7878
goimports:
7979
local-prefixes:
80-
- github.com/ory/terraform-provider-orynetwork
80+
- github.com/ory/terraform-provider-ory
8181

8282
output:
8383
show-stats: true

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ Thank you for your interest in contributing to the Ory Terraform Provider!
1414

1515
```bash
1616
# Clone the repository
17-
git clone https://github.com/ory/terraform-provider-orynetwork.git
18-
cd terraform-provider-orynetwork
17+
git clone https://github.com/ory/terraform-provider-ory.git
18+
cd terraform-provider-ory
1919

2020
# Install development tools and set up git hooks
2121
make tools
@@ -106,7 +106,7 @@ package myresource_test
106106
import (
107107
"testing"
108108
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
109-
"github.com/ory/terraform-provider-orynetwork/internal/acctest"
109+
"github.com/ory/terraform-provider-ory/internal/acctest"
110110
)
111111

112112
func TestAccMyResource_basic(t *testing.T) {
@@ -171,7 +171,7 @@ To use a locally built provider, create a `~/.terraformrc` file:
171171
```hcl
172172
provider_installation {
173173
dev_overrides {
174-
"ory/terraform-provider-orynetwork" = "/path/to/terraform-provider-orynetwork"
174+
"ory/terraform-provider-ory" = "/path/to/terraform-provider-ory"
175175
}
176176
direct {}
177177
}

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Terraform Provider Ory Network
2-
# ==============================
1+
# Terraform Provider Ory
2+
# ======================
33
#
44
# Development and testing Makefile
55
#
@@ -12,8 +12,8 @@
1212
# ORY_PROJECT_API_URL - Project API URL template (default: https://%s.projects.oryapis.com)
1313

1414
SHELL := /bin/bash -o pipefail
15-
BINARY_NAME := terraform-provider-orynetwork
16-
INSTALL_DIR := ~/.terraform.d/plugins/registry.terraform.io/ory/orynetwork/0.0.1/$(shell go env GOOS)_$(shell go env GOARCH)
15+
BINARY_NAME := terraform-provider-ory
16+
INSTALL_DIR := ~/.terraform.d/plugins/registry.terraform.io/ory/ory/0.0.1/$(shell go env GOOS)_$(shell go env GOARCH)
1717

1818
# Platform detection for tool downloads
1919
OS := $(shell uname -s | tr '[:upper:]' '[:lower:]')

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Terraform Provider for Ory Network
22

3-
[![Go Reference](https://pkg.go.dev/badge/github.com/ory/terraform-provider-orynetwork.svg)](https://pkg.go.dev/github.com/ory/terraform-provider-orynetwork)
4-
[![Go Report Card](https://goreportcard.com/badge/github.com/ory/terraform-provider-orynetwork)](https://goreportcard.com/report/github.com/ory/terraform-provider-orynetwork)
3+
[![Go Reference](https://pkg.go.dev/badge/github.com/ory/terraform-provider-ory.svg)](https://pkg.go.dev/github.com/ory/terraform-provider-ory)
4+
[![Go Report Card](https://goreportcard.com/badge/github.com/ory/terraform-provider-ory)](https://goreportcard.com/report/github.com/ory/terraform-provider-ory)
55

66
> **Special Thanks**
77
> Shoutout to [Jason Hernandez](https://github.com/jasonhernandez) and the [Materialize](https://materialize.com/) team for creating the initial version of this provider! Also see [NOTICE.md](./NOTICE.md)
@@ -39,7 +39,7 @@ A Terraform provider for managing [Ory Network](https://www.ory.sh/) resources u
3939
terraform {
4040
required_providers {
4141
ory = {
42-
source = "ory/orynetwork"
42+
source = "ory/ory"
4343
version = "~> 0.1"
4444
}
4545
}
@@ -49,9 +49,9 @@ terraform {
4949
### From Source
5050

5151
```bash
52-
git clone https://github.com/ory/terraform-provider-orynetwork.git
53-
cd terraform-provider-orynetwork
54-
go build -o terraform-provider-orynetwork
52+
git clone https://github.com/ory/terraform-provider-ory.git
53+
cd terraform-provider-ory
54+
go build -o terraform-provider-ory
5555
```
5656

5757
Then configure Terraform to use the local provider:
@@ -60,7 +60,7 @@ Then configure Terraform to use the local provider:
6060
# ~/.terraformrc
6161
provider_installation {
6262
dev_overrides {
63-
"ory/orynetwork" = "/path/to/terraform-provider-orynetwork"
63+
"ory/ory" = "/path/to/terraform-provider-ory"
6464
}
6565
direct {}
6666
}
@@ -101,7 +101,7 @@ provider "ory" {
101101
terraform {
102102
required_providers {
103103
ory = {
104-
source = "ory/orynetwork"
104+
source = "ory/ory"
105105
}
106106
}
107107
}
@@ -288,7 +288,7 @@ resource "ory_email_template" "recovery" {
288288
### Building
289289

290290
```bash
291-
go build -o terraform-provider-orynetwork
291+
go build -o terraform-provider-ory
292292
```
293293

294294
### Testing

docs/data-sources/project.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
# generated by https://github.com/hashicorp/terraform-plugin-docs
32
page_title: "ory_project Data Source - ory"
43
subcategory: ""
54
description: |-
@@ -10,6 +9,8 @@ description: |-
109

1110
Fetches information about an Ory project.
1211

12+
This data source retrieves basic metadata about a project. It can look up the project configured in the provider, or a specific project by ID.
13+
1314
## Example Usage
1415

1516
```terraform
@@ -34,6 +35,12 @@ data "ory_project" "other" {
3435
}
3536
```
3637

38+
## ID Fallback Behavior
39+
40+
If `id` is not specified, the data source uses the `project_id` from the provider configuration. If neither is available, the read will fail with an error.
41+
42+
~> **Note:** This data source only returns basic project metadata (name, slug, state, workspace). It does not include the project's `environment`, `home_region`, or detailed configuration. Use `ory_project_config` to manage project settings.
43+
3744
<!-- schema generated by tfplugindocs -->
3845
## Schema
3946

docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export ORY_PROJECT_SLUG="..."
3737
terraform {
3838
required_providers {
3939
ory = {
40-
source = "ory/orynetwork"
40+
source = "ory/ory"
4141
}
4242
}
4343
}
@@ -53,7 +53,7 @@ Define variables and pass values via `terraform.tfvars` or `-var` flags:
5353
terraform {
5454
required_providers {
5555
ory = {
56-
source = "ory/orynetwork"
56+
source = "ory/ory"
5757
}
5858
}
5959
}

docs/resources/email_template.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ description: |-
99

1010
Manages an Ory Network email template.
1111

12+
Email templates use [Go template syntax](https://pkg.go.dev/text/template) for variable substitution. HTML bodies use `html/template` (auto-escaping) and plaintext bodies use `text/template`. [Sprig template functions](http://masterminds.github.io/sprig/) are available, except date, random, OS, and network functions.
13+
1214
## Template Types
1315

1416
| Template Type | UI Name | Description |
@@ -28,6 +30,31 @@ Manages an Ory Network email template.
2830

2931
**Note:** The "_invalid" templates are sent when a code has expired or is incorrect. The non-code variants (recovery_valid, verification_valid) are for legacy link-based flows.
3032

33+
## Template Variables
34+
35+
Each template type has access to different variables:
36+
37+
| Template | Available Variables |
38+
|----------|-------------------|
39+
| `recovery_code_valid` | `.To`, `.RecoveryCode`, `.Identity`, `.ExpiresInMinutes` |
40+
| `recovery_code_invalid` | `.To` |
41+
| `verification_code_valid` | `.To`, `.VerificationCode`, `.VerificationURL`, `.Identity`, `.ExpiresInMinutes` |
42+
| `verification_code_invalid` | `.To` |
43+
| `login_code_valid` | `.To`, `.LoginCode`, `.Identity`, `.ExpiresInMinutes` |
44+
| `login_code_invalid` | `.To` |
45+
| `registration_code_valid` | `.To`, `.RegistrationCode`, `.Traits`, `.ExpiresInMinutes` |
46+
| `registration_code_invalid` | `.To` |
47+
| `recovery_valid` | `.To`, `.RecoveryURL`, `.Identity`, `.ExpiresInMinutes` |
48+
| `verification_valid` | `.To`, `.VerificationURL`, `.Identity`, `.ExpiresInMinutes` |
49+
50+
The `.Identity` object provides access to `.Identity.traits` and `.Identity.metadata_public`.
51+
52+
## Important Behaviors
53+
54+
- **Destroying resets to defaults:** Deleting this resource resets the template to Ory's built-in default template. It does not leave a blank template.
55+
- **Base64 encoding is automatic:** You provide raw template content; the provider handles base64 encoding internally.
56+
- **Subject is optional:** If not specified, Ory uses a default subject line.
57+
3158
## Example Usage
3259

3360
```terraform

docs/resources/identity.md

Lines changed: 29 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,15 @@
11
---
2-
# generated by https://github.com/hashicorp/terraform-plugin-docs
32
page_title: "ory_identity Resource - ory"
43
subcategory: ""
54
description: |-
65
Manages an Ory Network identity (user).
7-
Identities represent users in your application. Each identity has traits
8-
(profile data) defined by an identity schema.
9-
Required Provider Configuration
10-
This resource requires the following provider configuration:
11-
12-
provider "ory" {
13-
project_api_key = var.ory_project_api_key # or ORY_PROJECT_API_KEY env var
14-
project_slug = var.ory_project_slug # or ORY_PROJECT_SLUG env var
15-
}
16-
17-
Or via environment variables:
18-
19-
export ORY_PROJECT_API_KEY="ory_pat_..."
20-
export ORY_PROJECT_SLUG="your-project-slug"
21-
22-
Schema ID
23-
The schema_id attribute specifies which identity schema defines the structure of the identity's traits:
24-
Use the default schema: Most projects have a default schema (often named default)Reference a Terraform-managed schema: ory_identity_schema.customer.idUse a preset (must be enabled first): preset://email or preset://username
25-
~> Note: Preset schemas must be enabled in your Ory project before use. If you get a 500 error with a preset, it may not be enabled. Check your project's identity schema settings or use a custom schema.
26-
Example Usage
27-
28-
# Identity using the default schema
29-
resource "ory_identity" "user" {
30-
schema_id = "default"
31-
32-
traits = jsonencode({
33-
email = "user@example.com"
34-
})
35-
}
36-
37-
# Identity with password
38-
resource "ory_identity" "user_with_password" {
39-
schema_id = "default"
40-
41-
traits = jsonencode({
42-
email = "user@example.com"
43-
})
44-
45-
password = var.user_password # Use a variable, never hardcode
46-
47-
metadata_public = jsonencode({
48-
role = "user"
49-
})
50-
}
51-
52-
# Identity using a custom Terraform-managed schema
53-
resource "ory_identity" "customer" {
54-
schema_id = ory_identity_schema.customer.id
55-
56-
traits = jsonencode({
57-
email = "customer@example.com"
58-
})
59-
}
60-
61-
Import
62-
Identities can be imported using their ID:
63-
64-
terraform import ory_identity.user <identity-id>
65-
66-
Note: If the identity is deleted outside of Terraform (e.g., via UI or API),
67-
the next terraform plan will detect this and remove it from state.
686
---
697

708
# ory_identity (Resource)
719

7210
Manages an Ory Network identity (user).
7311

74-
Identities represent users in your application. Each identity has traits
75-
(profile data) defined by an identity schema.
12+
Identities represent users in your application. Each identity has traits (profile data) defined by an identity schema.
7613

7714
## Required Provider Configuration
7815

@@ -94,61 +31,24 @@ export ORY_PROJECT_SLUG="your-project-slug"
9431

9532
## Schema ID
9633

97-
The `schema_id` attribute specifies which identity schema defines the structure of the identity's traits:
34+
The `schema_id` attribute specifies which identity schema defines the structure of the identity's traits.
9835

99-
- **Use the default schema**: Most projects have a default schema (often named `default`)
100-
- **Reference a Terraform-managed schema**: `ory_identity_schema.customer.id`
101-
- **Use a preset** (must be enabled first): `preset://email` or `preset://username`
36+
~> **Important:** The value of `schema_id` must match a schema that exists in your project. Using a schema ID that doesn't exist (including `"default"` on projects that don't have a schema named "default") will result in an HTTP 500 error.
10237

103-
~> **Note:** Preset schemas must be enabled in your Ory project before use. If you get a 500 error with a preset, it may not be enabled. Check your project's identity schema settings or use a custom schema.
38+
**How to find your project's schema IDs:**
10439

105-
## Example Usage
106-
107-
```hcl
108-
# Identity using the default schema
109-
resource "ory_identity" "user" {
110-
schema_id = "default"
111-
112-
traits = jsonencode({
113-
email = "user@example.com"
114-
})
115-
}
116-
117-
# Identity with password
118-
resource "ory_identity" "user_with_password" {
119-
schema_id = "default"
120-
121-
traits = jsonencode({
122-
email = "user@example.com"
123-
})
124-
125-
password = var.user_password # Use a variable, never hardcode
126-
127-
metadata_public = jsonencode({
128-
role = "user"
129-
})
130-
}
131-
132-
# Identity using a custom Terraform-managed schema
133-
resource "ory_identity" "customer" {
134-
schema_id = ory_identity_schema.customer.id
135-
136-
traits = jsonencode({
137-
email = "customer@example.com"
138-
})
139-
}
140-
```
40+
1. **Ory Console:** Go to your project > Identity Schema to see configured schemas
41+
2. **API:** `GET /projects/<project-id>` and check `services.identity.config.identity.schemas`
42+
3. **Terraform:** Use `ory_identity_schema` resources and reference their IDs
14143

142-
## Import
44+
**Common schema ID values:**
14345

144-
Identities can be imported using their ID:
145-
146-
```shell
147-
terraform import ory_identity.user <identity-id>
148-
```
149-
150-
**Note**: If the identity is deleted outside of Terraform (e.g., via UI or API),
151-
the next `terraform plan` will detect this and remove it from state.
46+
| Schema ID | Description |
47+
|-----------|-------------|
48+
| `preset://email` | Built-in email schema (most common default for new projects) |
49+
| `preset://username` | Built-in username schema |
50+
| `default` | Only valid if your project has a schema explicitly named "default" |
51+
| Custom IDs | e.g., `customer_v1` - if created via `ory_identity_schema` or Console |
15252

15353
## Example Usage
15454

@@ -196,6 +96,21 @@ variable "user_password" {
19696
}
19797
```
19898

99+
## Important Behaviors
100+
101+
- **Password is write-only:** The `password` attribute is not returned on read and cannot be imported. It is only used during creation and updates.
102+
- **External deletion detection:** If an identity is deleted outside of Terraform (via UI or API), the next `terraform plan` will detect the 404 and remove it from state automatically.
103+
- **Traits must match schema:** The JSON structure of `traits` must match the identity schema definition. Mismatched traits will cause API errors.
104+
- **Metadata visibility:** `metadata_public` is visible to the identity owner. `metadata_admin` is only visible via the admin API and is marked sensitive in Terraform.
105+
106+
## Import
107+
108+
```shell
109+
terraform import ory_identity.user <identity-id>
110+
```
111+
112+
~> **Note:** Imported identities will not have `password` in state since it is write-only.
113+
199114
<!-- schema generated by tfplugindocs -->
200115
## Schema
201116

0 commit comments

Comments
 (0)