Skip to content

Commit 9e55e5b

Browse files
authored
Merge branch 'main' into renovate/github-actions
2 parents 9826690 + 5aafe20 commit 9e55e5b

File tree

16 files changed

+1173
-46
lines changed

16 files changed

+1173
-46
lines changed

docs/resources/custom_domain.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
page_title: "ory_custom_domain Resource - ory"
3+
subcategory: ""
4+
description: |-
5+
Manages an Ory Network custom domain.
6+
---
7+
8+
# ory_custom_domain (Resource)
9+
10+
Manages an Ory Network custom domain.
11+
12+
Custom domains allow you to expose Ory APIs on your own domain (e.g., `auth.example.com`) instead of the default
13+
`{slug}.projects.oryapis.com` domain. This is the correct way to configure session cookie domains on Ory Network —
14+
the reverse proxy rewrites cookies to use the `cookie_domain` you specify.
15+
16+
-> **Plan:** Custom domains may require specific Ory Network plan features. Check your plan's quota for available custom domains.
17+
18+
~> **DNS Required:** After creating a custom domain, you must add a CNAME record pointing your hostname to Ory.
19+
Monitor the `verification_status` attribute to track DNS verification progress.
20+
21+
## Example Usage
22+
23+
```terraform
24+
# Basic custom domain
25+
resource "ory_custom_domain" "auth" {
26+
hostname = "auth.example.com"
27+
cookie_domain = "example.com"
28+
}
29+
30+
# Custom domain with CORS and custom UI
31+
resource "ory_custom_domain" "full" {
32+
hostname = "auth.example.com"
33+
cookie_domain = "example.com"
34+
35+
cors_enabled = true
36+
cors_allowed_origins = ["https://app.example.com", "https://admin.example.com"]
37+
custom_ui_base_url = "https://app.example.com/auth"
38+
}
39+
```
40+
41+
## Import
42+
43+
Custom domains can be imported using either format:
44+
45+
```shell
46+
# Import with explicit project ID
47+
terraform import ory_custom_domain.auth <project-id>/<custom-domain-id>
48+
49+
# Import using provider-level project_id
50+
terraform import ory_custom_domain.auth <custom-domain-id>
51+
```
52+
53+
<!-- schema generated by tfplugindocs -->
54+
## Schema
55+
56+
### Required
57+
58+
- `hostname` (String) The custom hostname where the API will be exposed (e.g., 'auth.example.com').
59+
60+
### Optional
61+
62+
- `cookie_domain` (String) The domain where session cookies will be set. Must be a parent domain of the hostname (e.g., 'example.com' for hostname 'auth.example.com').
63+
- `cors_allowed_origins` (List of String) CORS allowed origins for the custom hostname (max 50).
64+
- `cors_enabled` (Boolean) Whether CORS is enabled for the custom hostname.
65+
- `custom_ui_base_url` (String) The base URL where the custom user interface is exposed (e.g., 'https://app.example.com/auth').
66+
- `project_id` (String) The project ID. If not set, uses the provider's project_id.
67+
68+
### Read-Only
69+
70+
- `created_at` (String) Timestamp when the custom domain was created.
71+
- `id` (String) The unique identifier of the custom domain.
72+
- `ssl_status` (String) SSL certificate status of the custom domain.
73+
- `updated_at` (String) Timestamp when the custom domain was last updated.
74+
- `verification_errors` (List of String) DNS verification errors, if any.
75+
- `verification_status` (String) DNS verification status of the custom domain (e.g., 'pending', 'active').

docs/resources/social_provider.md

Lines changed: 46 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,18 @@ The `provider_type` attribute determines which OAuth2/OIDC integration to use:
3333

3434
~> **Note:** When using `provider_type = "generic"`, you **must** set `issuer_url` to the OIDC issuer URL. The provider uses OIDC discovery to find authorization and token endpoints automatically.
3535

36+
## Apple Sign-In
37+
38+
Apple uses a non-standard authentication flow. Instead of a static `client_secret`, Apple requires:
39+
40+
- **`apple_team_id`** — Your Apple Developer Team ID (e.g., `KP76DQS54M`)
41+
- **`apple_private_key_id`** — The key ID from the Apple Developer portal (e.g., `UX56C66723`)
42+
- **`apple_private_key`** — The private key in PEM format (the contents of your `.p8` file)
43+
44+
Ory uses these to automatically generate the JWT `client_secret` required by Apple's OAuth2 flow. You do **not** need to set `client_secret` when using Apple-specific fields.
45+
46+
Alternatively, you may provide a pre-generated `client_secret` directly if you prefer to manage the JWT yourself.
47+
3648
## Example Usage
3749

3850
```terraform
@@ -64,13 +76,15 @@ resource "ory_social_provider" "microsoft" {
6476
scope = ["openid", "profile", "email"]
6577
}
6678
67-
# Apple Sign-In
79+
# Apple Sign-In (using Apple-specific credentials)
6880
resource "ory_social_provider" "apple" {
69-
provider_id = "apple"
70-
provider_type = "apple"
71-
client_id = var.apple_client_id
72-
client_secret = var.apple_client_secret
73-
scope = ["email", "name"]
81+
provider_id = "apple"
82+
provider_type = "apple"
83+
client_id = var.apple_service_id
84+
apple_team_id = var.apple_team_id
85+
apple_private_key_id = var.apple_private_key_id
86+
apple_private_key = var.apple_private_key
87+
scope = ["email", "name"]
7488
}
7589
7690
# Generic OIDC Provider with custom claims mapping
@@ -129,13 +143,25 @@ variable "azure_tenant_id" {
129143
type = string
130144
}
131145
132-
variable "apple_client_id" {
133-
type = string
146+
variable "apple_service_id" {
147+
description = "Apple Service ID (e.g., com.example.auth)"
148+
type = string
134149
}
135150
136-
variable "apple_client_secret" {
137-
type = string
138-
sensitive = true
151+
variable "apple_team_id" {
152+
description = "Apple Developer Team ID"
153+
type = string
154+
}
155+
156+
variable "apple_private_key_id" {
157+
description = "Apple private key ID from the Developer portal"
158+
type = string
159+
}
160+
161+
variable "apple_private_key" {
162+
description = "Apple private key in PEM format (.p8 file contents)"
163+
type = string
164+
sensitive = true
139165
}
140166
141167
variable "sso_client_id" {
@@ -173,6 +199,7 @@ If not set, the provider uses a default mapper that extracts the email claim.
173199
- **`provider_id` and `provider_type` cannot be changed** after creation. Changing either forces a new resource.
174200
- **`client_secret` is write-only.** The API does not return secrets on read, so Terraform cannot detect external changes to the secret.
175201
- **`tenant` maps to `microsoft_tenant`** in the Ory API. This is only used with `provider_type = "microsoft"`.
202+
- **Apple-specific fields** (`apple_team_id`, `apple_private_key_id`, `apple_private_key`) are only valid with `provider_type = "apple"`. The `apple_private_key` is write-only (not returned by API).
176203
- **Deleting the last provider** resets the entire OIDC configuration to a disabled state with an empty providers array.
177204

178205
## Import
@@ -183,21 +210,27 @@ Import using the provider ID:
183210
terraform import ory_social_provider.google google
184211
```
185212

186-
The `provider_id` is the unique identifier you chose when creating the provider. After import, you must provide `client_secret` in your configuration since it cannot be read from the API.
213+
The `provider_id` is the unique identifier you chose when creating the provider. After import, you must provide write-only credentials in your configuration since they cannot be read from the API:
214+
215+
- **Non-Apple providers:** Set `client_secret`.
216+
- **Apple providers:** Set either `client_secret` (pre-generated JWT) or all three Apple-specific fields (`apple_team_id`, `apple_private_key_id`, and `apple_private_key`).
187217

188218
<!-- schema generated by tfplugindocs -->
189219
## Schema
190220

191221
### Required
192222

193223
- `client_id` (String) OAuth2 client ID from the provider.
194-
- `client_secret` (String, Sensitive) OAuth2 client secret from the provider.
195224
- `provider_id` (String) Unique identifier for the provider (used in callback URLs).
196225
- `provider_type` (String) Provider type (google, github, microsoft, apple, generic, etc.).
197226

198227
### Optional
199228

229+
- `apple_private_key` (String, Sensitive) Apple private key in PEM format (contents of the .p8 file). Required when provider_type is "apple" and client_secret is not set. Ory uses this to generate the JWT client secret automatically.
230+
- `apple_private_key_id` (String) Apple private key ID from the Apple Developer portal (e.g., "UX56C66723"). Required when provider_type is "apple" and client_secret is not set.
231+
- `apple_team_id` (String) Apple Developer Team ID (e.g., "KP76DQS54M"). Required when provider_type is "apple" and client_secret is not set.
200232
- `auth_url` (String) Custom authorization URL (for non-standard providers).
233+
- `client_secret` (String, Sensitive) OAuth2 client secret from the provider. Required for all providers except Apple (where Ory generates the secret from apple_team_id, apple_private_key_id, and apple_private_key).
201234
- `issuer_url` (String) OIDC issuer URL (required for generic providers).
202235
- `mapper_url` (String) Jsonnet mapper URL for claims mapping. Can be a URL or base64-encoded Jsonnet (base64://...). If not set, a default mapper that extracts email from claims will be used.
203236
- `project_id` (String) Project ID. If not set, uses provider's project_id.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Basic custom domain
2+
resource "ory_custom_domain" "auth" {
3+
hostname = "auth.example.com"
4+
cookie_domain = "example.com"
5+
}
6+
7+
# Custom domain with CORS and custom UI
8+
resource "ory_custom_domain" "full" {
9+
hostname = "auth.example.com"
10+
cookie_domain = "example.com"
11+
12+
cors_enabled = true
13+
cors_allowed_origins = ["https://app.example.com", "https://admin.example.com"]
14+
custom_ui_base_url = "https://app.example.com/auth"
15+
}

examples/resources/ory_social_provider/resource.tf

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@ resource "ory_social_provider" "microsoft" {
2626
scope = ["openid", "profile", "email"]
2727
}
2828

29-
# Apple Sign-In
29+
# Apple Sign-In (using Apple-specific credentials)
3030
resource "ory_social_provider" "apple" {
31-
provider_id = "apple"
32-
provider_type = "apple"
33-
client_id = var.apple_client_id
34-
client_secret = var.apple_client_secret
35-
scope = ["email", "name"]
31+
provider_id = "apple"
32+
provider_type = "apple"
33+
client_id = var.apple_service_id
34+
apple_team_id = var.apple_team_id
35+
apple_private_key_id = var.apple_private_key_id
36+
apple_private_key = var.apple_private_key
37+
scope = ["email", "name"]
3638
}
3739

3840
# Generic OIDC Provider with custom claims mapping
@@ -91,13 +93,25 @@ variable "azure_tenant_id" {
9193
type = string
9294
}
9395

94-
variable "apple_client_id" {
95-
type = string
96+
variable "apple_service_id" {
97+
description = "Apple Service ID (e.g., com.example.auth)"
98+
type = string
9699
}
97100

98-
variable "apple_client_secret" {
99-
type = string
100-
sensitive = true
101+
variable "apple_team_id" {
102+
description = "Apple Developer Team ID"
103+
type = string
104+
}
105+
106+
variable "apple_private_key_id" {
107+
description = "Apple private key ID from the Developer portal"
108+
type = string
109+
}
110+
111+
variable "apple_private_key" {
112+
description = "Apple private key in PEM format (.p8 file contents)"
113+
type = string
114+
sensitive = true
101115
}
102116

103117
variable "sso_client_id" {

0 commit comments

Comments
 (0)