feat: implement library resource and data source

This commit is contained in:
2026-06-01 11:21:32 -04:00
parent 1337034f07
commit bcc8a1a47d
8 changed files with 633 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "immich_libraries Data Source - terraform-provider-immich"
subcategory: ""
description: |-
Retrieves a list of all Immich libraries.
---
# immich_libraries (Data Source)
Retrieves a list of all Immich libraries.
## Example Usage
```terraform
data "immich_libraries" "all" {}
output "library_names" {
value = data.immich_libraries.all.libraries[*].name
}
output "external_libraries" {
value = [for l in data.immich_libraries.all.libraries : l if l.type == "EXTERNAL"]
}
```
<!-- schema generated by tfplugindocs -->
## Schema
### Read-Only
- `libraries` (Attributes List) List of libraries. (see [below for nested schema](#nestedatt--libraries))
<a id="nestedatt--libraries"></a>
### Nested Schema for `libraries`
Read-Only:
- `asset_count` (Number) Number of assets in the library.
- `id` (String) Unique identifier for the library.
- `name` (String) Display name of the library.
- `owner_id` (String) Unique identifier of the library owner.
- `type` (String) Type of the library (UPLOAD or EXTERNAL).
+54
View File
@@ -0,0 +1,54 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "immich_library Resource - terraform-provider-immich"
subcategory: ""
description: |-
Manages an Immich library.
---
# immich_library (Resource)
Manages an Immich library.
## Example Usage
```terraform
resource "immich_library" "external" {
name = "My External Photos"
type = "EXTERNAL"
import_paths = [
"/mnt/photos/vacation_2023",
"/mnt/photos/family"
]
exclusion_patterns = [
"**/tmp/**",
"**/.DS_Store"
]
is_visible = true
}
resource "immich_library" "upload" {
name = "Personal Uploads"
type = "UPLOAD"
}
```
<!-- schema generated by tfplugindocs -->
## Schema
### Required
- `name` (String) Display name of the library.
- `type` (String) Type of the library. Must be either `UPLOAD` or `EXTERNAL`.
### Optional
- `exclusion_patterns` (List of String) List of glob patterns to exclude from import.
- `import_paths` (List of String) List of filesystem paths to import assets from (required for `EXTERNAL` libraries).
- `is_visible` (Boolean) Whether the library is visible in the UI.
### Read-Only
- `asset_count` (Number) Number of assets currently in the library.
- `id` (String) Unique identifier for the library.
- `owner_id` (String) Unique identifier of the library owner.