From f2b245f31a81194b68d9f6c17cabc33de432bfec Mon Sep 17 00:00:00 2001 From: Russ Long Date: Mon, 1 Jun 2026 11:42:33 -0400 Subject: [PATCH] docs: add examples and generate documentation for all new resources --- docs/data-sources/server_info.md | 35 +++++++++++ docs/resources/memory.md | 35 +++++++++++ docs/resources/partner.md | 36 +++++++++++ docs/resources/person.md | 37 +++++++++++ docs/resources/stack.md | 38 +++++++++++ docs/resources/tag.md | 32 ++++++++++ docs/resources/workflow.md | 63 +++++++++++++++++++ .../immich_server_info/data-source.tf | 5 ++ examples/resources/immich_memory/resource.tf | 4 ++ examples/resources/immich_partner/resource.tf | 4 ++ examples/resources/immich_person/resource.tf | 7 +++ examples/resources/immich_stack/resource.tf | 7 +++ examples/resources/immich_tag/resource.tf | 4 ++ .../resources/immich_workflow/resource.tf | 29 +++++++++ internal/provider/workflow_resource.go | 1 - 15 files changed, 336 insertions(+), 1 deletion(-) create mode 100644 docs/data-sources/server_info.md create mode 100644 docs/resources/memory.md create mode 100644 docs/resources/partner.md create mode 100644 docs/resources/person.md create mode 100644 docs/resources/stack.md create mode 100644 docs/resources/tag.md create mode 100644 docs/resources/workflow.md create mode 100644 examples/data-sources/immich_server_info/data-source.tf create mode 100644 examples/resources/immich_memory/resource.tf create mode 100644 examples/resources/immich_partner/resource.tf create mode 100644 examples/resources/immich_person/resource.tf create mode 100644 examples/resources/immich_stack/resource.tf create mode 100644 examples/resources/immich_tag/resource.tf create mode 100644 examples/resources/immich_workflow/resource.tf diff --git a/docs/data-sources/server_info.md b/docs/data-sources/server_info.md new file mode 100644 index 0000000..96ede37 --- /dev/null +++ b/docs/data-sources/server_info.md @@ -0,0 +1,35 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "immich_server_info Data Source - terraform-provider-immich" +subcategory: "" +description: |- + Retrieves information about the Immich server. +--- + +# immich_server_info (Data Source) + +Retrieves information about the Immich server. + +## Example Usage + +```terraform +data "immich_server_info" "current" {} + +output "server_version" { + value = data.immich_server_info.current.version +} +``` + + +## Schema + +### Read-Only + +- `build` (String) Build ID. +- `exiftool` (String) ExifTool version. +- `ffmpeg` (String) FFmpeg version. +- `id` (String) The ID of this resource. +- `imagemagick` (String) ImageMagick version. +- `libvips` (String) libvips version. +- `nodejs` (String) Node.js version. +- `version` (String) Server version. diff --git a/docs/resources/memory.md b/docs/resources/memory.md new file mode 100644 index 0000000..9678e11 --- /dev/null +++ b/docs/resources/memory.md @@ -0,0 +1,35 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "immich_memory Resource - terraform-provider-immich" +subcategory: "" +description: |- + Manages an Immich memory. +--- + +# immich_memory (Resource) + +Manages an Immich memory. + +## Example Usage + +```terraform +resource "immich_memory" "example" { + memory_at = "2023-06-01T00:00:00Z" + is_saved = true +} +``` + + +## Schema + +### Required + +- `memory_at` (String) The date the memory represents (ISO 8601). + +### Optional + +- `is_saved` (Boolean) Whether the memory is saved by the user. + +### Read-Only + +- `id` (String) Unique identifier for the memory. diff --git a/docs/resources/partner.md b/docs/resources/partner.md new file mode 100644 index 0000000..b63883c --- /dev/null +++ b/docs/resources/partner.md @@ -0,0 +1,36 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "immich_partner Resource - terraform-provider-immich" +subcategory: "" +description: |- + Manages an Immich partner connection. +--- + +# immich_partner (Resource) + +Manages an Immich partner connection. + +## Example Usage + +```terraform +resource "immich_partner" "example" { + partner_id = "other-user-uuid" + in_timeline = true +} +``` + + +## Schema + +### Required + +- `partner_id` (String) The ID of the user to partner with. + +### Optional + +- `in_timeline` (Boolean) Whether the partner's assets should appear in your timeline. + +### Read-Only + +- `email` (String) Email of the partner user. +- `name` (String) Name of the partner user. diff --git a/docs/resources/person.md b/docs/resources/person.md new file mode 100644 index 0000000..a55c2dd --- /dev/null +++ b/docs/resources/person.md @@ -0,0 +1,37 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "immich_person Resource - terraform-provider-immich" +subcategory: "" +description: |- + Manages an Immich person. Note: Persons are usually created automatically by Immich facial recognition. This resource is used to update their details. +--- + +# immich_person (Resource) + +Manages an Immich person. Note: Persons are usually created automatically by Immich facial recognition. This resource is used to update their details. + +## Example Usage + +```terraform +resource "immich_person" "example" { + id = "your-person-uuid" + name = "John Doe" + birth_date = "1990-01-01" + is_hidden = false + is_favorite = true +} +``` + + +## Schema + +### Required + +- `id` (String) Unique identifier for the person. + +### Optional + +- `birth_date` (String) Birth date of the person (ISO 8601). +- `is_favorite` (Boolean) Whether the person is marked as a favorite. +- `is_hidden` (Boolean) Whether the person is hidden from the UI. +- `name` (String) Name of the person. diff --git a/docs/resources/stack.md b/docs/resources/stack.md new file mode 100644 index 0000000..6492bfc --- /dev/null +++ b/docs/resources/stack.md @@ -0,0 +1,38 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "immich_stack Resource - terraform-provider-immich" +subcategory: "" +description: |- + Manages an Immich asset stack. +--- + +# immich_stack (Resource) + +Manages an Immich asset stack. + +## Example Usage + +```terraform +resource "immich_stack" "example" { + asset_ids = [ + "asset-uuid-1", + "asset-uuid-2" + ] + primary_asset_id = "asset-uuid-1" +} +``` + + +## Schema + +### Required + +- `asset_ids` (List of String) List of asset IDs to include in the stack. The first ID will be the primary asset by default. + +### Optional + +- `primary_asset_id` (String) The ID of the primary asset in the stack. + +### Read-Only + +- `id` (String) Unique identifier for the stack. diff --git a/docs/resources/tag.md b/docs/resources/tag.md new file mode 100644 index 0000000..874ba37 --- /dev/null +++ b/docs/resources/tag.md @@ -0,0 +1,32 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "immich_tag Resource - terraform-provider-immich" +subcategory: "" +description: |- + Manages an Immich tag. +--- + +# immich_tag (Resource) + +Manages an Immich tag. + +## Example Usage + +```terraform +resource "immich_tag" "example" { + name = "Vacation" + type = "OBJECT" +} +``` + + +## Schema + +### Required + +- `name` (String) Name of the tag. +- `type` (String) Type of the tag (OBJECT or USER). + +### Read-Only + +- `id` (String) Unique identifier for the tag. diff --git a/docs/resources/workflow.md b/docs/resources/workflow.md new file mode 100644 index 0000000..e4d925e --- /dev/null +++ b/docs/resources/workflow.md @@ -0,0 +1,63 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "immich_workflow Resource - terraform-provider-immich" +subcategory: "" +description: |- + Manages an Immich workflow (Experimental). +--- + +# immich_workflow (Resource) + +Manages an Immich workflow (Experimental). + +## Example Usage + +```terraform +resource "immich_workflow" "example" { + name = "Auto-Tag Video" + enabled = true + + triggers = jsonencode([ + { + "type": "asset.upload", + "options": {} + } + ]) + + filters = jsonencode([ + { + "type": "asset.type", + "options": { + "type": "video" + } + } + ]) + + actions = jsonencode([ + { + "type": "asset.tag", + "options": { + "tagId": "your-tag-uuid" + } + } + ]) +} +``` + + +## Schema + +### Required + +- `actions` (String) JSON string representing the workflow actions. +- `name` (String) Name of the workflow. +- `triggers` (String) JSON string representing the workflow triggers. + +### Optional + +- `enabled` (Boolean) Whether the workflow is enabled. +- `filters` (String) JSON string representing the workflow filters. + +### Read-Only + +- `id` (String) Unique identifier for the workflow. diff --git a/examples/data-sources/immich_server_info/data-source.tf b/examples/data-sources/immich_server_info/data-source.tf new file mode 100644 index 0000000..3fd1ebe --- /dev/null +++ b/examples/data-sources/immich_server_info/data-source.tf @@ -0,0 +1,5 @@ +data "immich_server_info" "current" {} + +output "server_version" { + value = data.immich_server_info.current.version +} diff --git a/examples/resources/immich_memory/resource.tf b/examples/resources/immich_memory/resource.tf new file mode 100644 index 0000000..d026076 --- /dev/null +++ b/examples/resources/immich_memory/resource.tf @@ -0,0 +1,4 @@ +resource "immich_memory" "example" { + memory_at = "2023-06-01T00:00:00Z" + is_saved = true +} diff --git a/examples/resources/immich_partner/resource.tf b/examples/resources/immich_partner/resource.tf new file mode 100644 index 0000000..5c9a9ce --- /dev/null +++ b/examples/resources/immich_partner/resource.tf @@ -0,0 +1,4 @@ +resource "immich_partner" "example" { + partner_id = "other-user-uuid" + in_timeline = true +} diff --git a/examples/resources/immich_person/resource.tf b/examples/resources/immich_person/resource.tf new file mode 100644 index 0000000..73b9190 --- /dev/null +++ b/examples/resources/immich_person/resource.tf @@ -0,0 +1,7 @@ +resource "immich_person" "example" { + id = "your-person-uuid" + name = "John Doe" + birth_date = "1990-01-01" + is_hidden = false + is_favorite = true +} diff --git a/examples/resources/immich_stack/resource.tf b/examples/resources/immich_stack/resource.tf new file mode 100644 index 0000000..75b2665 --- /dev/null +++ b/examples/resources/immich_stack/resource.tf @@ -0,0 +1,7 @@ +resource "immich_stack" "example" { + asset_ids = [ + "asset-uuid-1", + "asset-uuid-2" + ] + primary_asset_id = "asset-uuid-1" +} diff --git a/examples/resources/immich_tag/resource.tf b/examples/resources/immich_tag/resource.tf new file mode 100644 index 0000000..0a0b444 --- /dev/null +++ b/examples/resources/immich_tag/resource.tf @@ -0,0 +1,4 @@ +resource "immich_tag" "example" { + name = "Vacation" + type = "OBJECT" +} diff --git a/examples/resources/immich_workflow/resource.tf b/examples/resources/immich_workflow/resource.tf new file mode 100644 index 0000000..206c61c --- /dev/null +++ b/examples/resources/immich_workflow/resource.tf @@ -0,0 +1,29 @@ +resource "immich_workflow" "example" { + name = "Auto-Tag Video" + enabled = true + + triggers = jsonencode([ + { + "type": "asset.upload", + "options": {} + } + ]) + + filters = jsonencode([ + { + "type": "asset.type", + "options": { + "type": "video" + } + } + ]) + + actions = jsonencode([ + { + "type": "asset.tag", + "options": { + "tagId": "your-tag-uuid" + } + } + ]) +} diff --git a/internal/provider/workflow_resource.go b/internal/provider/workflow_resource.go index c43ea56..d107fe5 100644 --- a/internal/provider/workflow_resource.go +++ b/internal/provider/workflow_resource.go @@ -71,7 +71,6 @@ func (r *workflowResource) Schema(ctx context.Context, req resource.SchemaReques "filters": schema.StringAttribute{ Optional: true, Computed: true, - Default: booldefault.StaticBool(false), // placeholder for empty MarkdownDescription: "JSON string representing the workflow filters.", }, "actions": schema.StringAttribute{