-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata-source.tf
More file actions
63 lines (56 loc) · 1.62 KB
/
data-source.tf
File metadata and controls
63 lines (56 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Look up an identity schema by its API-assigned ID
data "ory_identity_schema" "customer" {
id = "abc123def456..."
}
output "schema_content" {
value = data.ory_identity_schema.customer.schema
}
# Or reference the ID from a resource
resource "ory_identity_schema" "employee" {
schema_id = "employee"
schema = jsonencode({
"$id" = "https://example.com/employee.schema.json"
"$schema" = "http://json-schema.org/draft-07/schema#"
title = "Employee"
type = "object"
properties = {
traits = {
type = "object"
properties = {
email = {
type = "string"
format = "email"
"ory.sh/kratos" = {
credentials = { password = { identifier = true } }
verification = { via = "email" }
recovery = { via = "email" }
}
}
}
required = ["email"]
}
}
})
}
data "ory_identity_schema" "employee" {
id = ory_identity_schema.employee.id
}
# Look up a schema during project bootstrap (no project_slug/project_api_key needed)
data "ory_identity_schema" "bootstrap" {
id = "preset://username"
project_id = "your-project-uuid"
}
# Create a new project and reuse an existing workspace schema as default
resource "ory_project" "new" {
name = "my-new-project"
}
data "ory_identity_schema" "existing" {
id = "670f71...full-hash-id"
project_id = ory_project.new.id
}
resource "ory_identity_schema" "default" {
schema_id = "customer"
project_id = ory_project.new.id
schema = data.ory_identity_schema.existing.schema
set_default = true
}